Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 1 | // Copyright (C) 2019 The Android Open Source Project |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package sdk |
| 16 | |
| 17 | import ( |
Paul Duffin | 6369622 | 2021-09-06 10:28:34 +0100 | [diff] [blame] | 18 | "fmt" |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 19 | "testing" |
| 20 | |
Paul Duffin | 1356d8c | 2020-02-25 19:26:33 +0000 | [diff] [blame] | 21 | "android/soong/android" |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 22 | "android/soong/cc" |
| 23 | ) |
| 24 | |
Paul Duffin | 4a2a29c | 2021-03-09 22:27:13 +0000 | [diff] [blame] | 25 | var ccTestFs = android.MockFS{ |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 26 | "Test.cpp": nil, |
| 27 | "myinclude/Test.h": nil, |
| 28 | "myinclude-android/AndroidTest.h": nil, |
| 29 | "myinclude-host/HostTest.h": nil, |
| 30 | "arm64/include/Arm64Test.h": nil, |
| 31 | "libfoo.so": nil, |
| 32 | "aidl/foo/bar/Test.aidl": nil, |
| 33 | "some/where/stubslib.map.txt": nil, |
Martin Stjernholm | 7feceb2 | 2020-07-11 04:33:29 +0100 | [diff] [blame] | 34 | } |
| 35 | |
Paul Duffin | 93b750e | 2019-11-19 19:44:10 +0000 | [diff] [blame] | 36 | // Adds a native bridge target to the configured list of targets. |
| 37 | var prepareForTestWithNativeBridgeTarget = android.FixtureModifyConfig(func(config android.Config) { |
| 38 | config.Targets[android.Android] = append(config.Targets[android.Android], android.Target{ |
| 39 | Os: android.Android, |
| 40 | Arch: android.Arch{ |
| 41 | ArchType: android.Arm64, |
| 42 | ArchVariant: "armv8-a", |
| 43 | CpuVariant: "cpu", |
| 44 | Abi: nil, |
| 45 | ArchFeatures: nil, |
| 46 | }, |
| 47 | NativeBridge: android.NativeBridgeEnabled, |
| 48 | NativeBridgeHostArchName: "x86_64", |
| 49 | NativeBridgeRelativePath: "native_bridge", |
| 50 | }) |
| 51 | }) |
| 52 | |
Paul Duffin | 4a2a29c | 2021-03-09 22:27:13 +0000 | [diff] [blame] | 53 | func testSdkWithCc(t *testing.T, bp string) *android.TestResult { |
Paul Duffin | d835daa | 2019-11-30 17:49:09 +0000 | [diff] [blame] | 54 | t.Helper() |
Martin Stjernholm | 7feceb2 | 2020-07-11 04:33:29 +0100 | [diff] [blame] | 55 | return testSdkWithFs(t, bp, ccTestFs) |
Paul Duffin | d835daa | 2019-11-30 17:49:09 +0000 | [diff] [blame] | 56 | } |
| 57 | |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 58 | // Contains tests for SDK members provided by the cc package. |
| 59 | |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 60 | func TestSingleDeviceOsAssumption(t *testing.T) { |
| 61 | // Mock a module with DeviceSupported() == true. |
| 62 | s := &sdk{} |
| 63 | android.InitAndroidArchModule(s, android.DeviceSupported, android.MultilibCommon) |
| 64 | |
| 65 | osTypes := s.getPossibleOsTypes() |
| 66 | if len(osTypes) != 1 { |
| 67 | // The snapshot generation assumes there is a single device OS. If more are |
| 68 | // added it might need to disable them by default, like it does for host |
| 69 | // OS'es. |
| 70 | t.Errorf("expected a single device OS, got %v", osTypes) |
| 71 | } |
| 72 | } |
| 73 | |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 74 | func TestSdkIsCompileMultilibBoth(t *testing.T) { |
Paul Duffin | d835daa | 2019-11-30 17:49:09 +0000 | [diff] [blame] | 75 | result := testSdkWithCc(t, ` |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 76 | sdk { |
| 77 | name: "mysdk", |
| 78 | native_shared_libs: ["sdkmember"], |
| 79 | } |
| 80 | |
| 81 | cc_library_shared { |
| 82 | name: "sdkmember", |
| 83 | srcs: ["Test.cpp"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 84 | stl: "none", |
| 85 | } |
| 86 | `) |
| 87 | |
Colin Cross | 7113d20 | 2019-11-20 16:39:12 -0800 | [diff] [blame] | 88 | armOutput := result.Module("sdkmember", "android_arm_armv7-a-neon_shared").(*cc.Module).OutputFile() |
| 89 | arm64Output := result.Module("sdkmember", "android_arm64_armv8-a_shared").(*cc.Module).OutputFile() |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 90 | |
| 91 | var inputs []string |
Paul Duffin | 1356d8c | 2020-02-25 19:26:33 +0000 | [diff] [blame] | 92 | buildParams := result.Module("mysdk", android.CommonOS.Name).BuildParamsForTests() |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 93 | for _, bp := range buildParams { |
| 94 | if bp.Input != nil { |
| 95 | inputs = append(inputs, bp.Input.String()) |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | // ensure that both 32/64 outputs are inputs of the sdk snapshot |
| 100 | ensureListContains(t, inputs, armOutput.String()) |
| 101 | ensureListContains(t, inputs, arm64Output.String()) |
| 102 | } |
| 103 | |
Martin Stjernholm | 26ab8e8 | 2020-06-30 20:34:00 +0100 | [diff] [blame] | 104 | func TestSdkCompileMultilibOverride(t *testing.T) { |
| 105 | result := testSdkWithCc(t, ` |
| 106 | sdk { |
| 107 | name: "mysdk", |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 108 | host_supported: true, |
Martin Stjernholm | 26ab8e8 | 2020-06-30 20:34:00 +0100 | [diff] [blame] | 109 | native_shared_libs: ["sdkmember"], |
| 110 | compile_multilib: "64", |
| 111 | } |
| 112 | |
| 113 | cc_library_shared { |
| 114 | name: "sdkmember", |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 115 | host_supported: true, |
Martin Stjernholm | 26ab8e8 | 2020-06-30 20:34:00 +0100 | [diff] [blame] | 116 | srcs: ["Test.cpp"], |
| 117 | stl: "none", |
| 118 | compile_multilib: "64", |
| 119 | } |
| 120 | `) |
| 121 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 122 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 123 | checkUnversionedAndroidBpContents(` |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 124 | // This is auto-generated. DO NOT EDIT. |
| 125 | |
| 126 | cc_prebuilt_library_shared { |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 127 | name: "sdkmember", |
| 128 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 129 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 130 | apex_available: ["//apex_available:platform"], |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 131 | host_supported: true, |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 132 | stl: "none", |
| 133 | compile_multilib: "64", |
Martin Stjernholm | 4cfa2c6 | 2020-07-10 19:55:36 +0100 | [diff] [blame] | 134 | target: { |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 135 | host: { |
| 136 | enabled: false, |
| 137 | }, |
Martin Stjernholm | 4cfa2c6 | 2020-07-10 19:55:36 +0100 | [diff] [blame] | 138 | android_arm64: { |
| 139 | srcs: ["android/arm64/lib/sdkmember.so"], |
| 140 | }, |
| 141 | linux_glibc_x86_64: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 142 | enabled: true, |
Martin Stjernholm | 4cfa2c6 | 2020-07-10 19:55:36 +0100 | [diff] [blame] | 143 | srcs: ["linux_glibc/x86_64/lib/sdkmember.so"], |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 144 | }, |
| 145 | }, |
| 146 | } |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 147 | `), |
| 148 | checkVersionedAndroidBpContents(` |
| 149 | // This is auto-generated. DO NOT EDIT. |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 150 | |
| 151 | cc_prebuilt_library_shared { |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 152 | name: "mysdk_sdkmember@current", |
| 153 | sdk_member_name: "sdkmember", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 154 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 155 | apex_available: ["//apex_available:platform"], |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 156 | host_supported: true, |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 157 | installable: false, |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 158 | stl: "none", |
| 159 | compile_multilib: "64", |
Martin Stjernholm | 4cfa2c6 | 2020-07-10 19:55:36 +0100 | [diff] [blame] | 160 | target: { |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 161 | host: { |
| 162 | enabled: false, |
| 163 | }, |
Martin Stjernholm | 4cfa2c6 | 2020-07-10 19:55:36 +0100 | [diff] [blame] | 164 | android_arm64: { |
| 165 | srcs: ["android/arm64/lib/sdkmember.so"], |
| 166 | }, |
| 167 | linux_glibc_x86_64: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 168 | enabled: true, |
Martin Stjernholm | 4cfa2c6 | 2020-07-10 19:55:36 +0100 | [diff] [blame] | 169 | srcs: ["linux_glibc/x86_64/lib/sdkmember.so"], |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 170 | }, |
| 171 | }, |
| 172 | } |
| 173 | |
| 174 | sdk_snapshot { |
| 175 | name: "mysdk@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 176 | visibility: ["//visibility:public"], |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 177 | host_supported: true, |
Martin Stjernholm | 4cfa2c6 | 2020-07-10 19:55:36 +0100 | [diff] [blame] | 178 | compile_multilib: "64", |
Paul Duffin | 7b0259f | 2021-04-24 11:34:46 +0100 | [diff] [blame] | 179 | native_shared_libs: ["mysdk_sdkmember@current"], |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 180 | target: { |
| 181 | host: { |
| 182 | enabled: false, |
| 183 | }, |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 184 | linux_glibc_x86_64: { |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 185 | enabled: true, |
| 186 | }, |
| 187 | }, |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 188 | } |
| 189 | `), |
Martin Stjernholm | 26ab8e8 | 2020-06-30 20:34:00 +0100 | [diff] [blame] | 190 | checkAllCopyRules(` |
Martin Stjernholm | 4cfa2c6 | 2020-07-10 19:55:36 +0100 | [diff] [blame] | 191 | .intermediates/sdkmember/android_arm64_armv8-a_shared/sdkmember.so -> android/arm64/lib/sdkmember.so |
| 192 | .intermediates/sdkmember/linux_glibc_x86_64_shared/sdkmember.so -> linux_glibc/x86_64/lib/sdkmember.so |
Martin Stjernholm | 26ab8e8 | 2020-06-30 20:34:00 +0100 | [diff] [blame] | 193 | `)) |
| 194 | } |
| 195 | |
Paul Duffin | a0843f6 | 2019-12-13 19:50:38 +0000 | [diff] [blame] | 196 | // Make sure the sdk can use host specific cc libraries static/shared and both. |
| 197 | func TestHostSdkWithCc(t *testing.T) { |
| 198 | testSdkWithCc(t, ` |
| 199 | sdk { |
| 200 | name: "mysdk", |
| 201 | device_supported: false, |
| 202 | host_supported: true, |
| 203 | native_shared_libs: ["sdkshared"], |
| 204 | native_static_libs: ["sdkstatic"], |
| 205 | } |
| 206 | |
| 207 | cc_library_host_shared { |
| 208 | name: "sdkshared", |
Paul Duffin | a0843f6 | 2019-12-13 19:50:38 +0000 | [diff] [blame] | 209 | stl: "none", |
| 210 | } |
| 211 | |
| 212 | cc_library_host_static { |
| 213 | name: "sdkstatic", |
Paul Duffin | a0843f6 | 2019-12-13 19:50:38 +0000 | [diff] [blame] | 214 | stl: "none", |
| 215 | } |
| 216 | `) |
| 217 | } |
| 218 | |
| 219 | // Make sure the sdk can use cc libraries static/shared and both. |
| 220 | func TestSdkWithCc(t *testing.T) { |
| 221 | testSdkWithCc(t, ` |
| 222 | sdk { |
| 223 | name: "mysdk", |
| 224 | native_shared_libs: ["sdkshared", "sdkboth1"], |
| 225 | native_static_libs: ["sdkstatic", "sdkboth2"], |
| 226 | } |
| 227 | |
| 228 | cc_library_shared { |
| 229 | name: "sdkshared", |
Paul Duffin | a0843f6 | 2019-12-13 19:50:38 +0000 | [diff] [blame] | 230 | stl: "none", |
| 231 | } |
| 232 | |
| 233 | cc_library_static { |
| 234 | name: "sdkstatic", |
Paul Duffin | a0843f6 | 2019-12-13 19:50:38 +0000 | [diff] [blame] | 235 | stl: "none", |
| 236 | } |
| 237 | |
| 238 | cc_library { |
| 239 | name: "sdkboth1", |
Paul Duffin | a0843f6 | 2019-12-13 19:50:38 +0000 | [diff] [blame] | 240 | stl: "none", |
| 241 | } |
| 242 | |
| 243 | cc_library { |
| 244 | name: "sdkboth2", |
Paul Duffin | a0843f6 | 2019-12-13 19:50:38 +0000 | [diff] [blame] | 245 | stl: "none", |
| 246 | } |
| 247 | `) |
| 248 | } |
| 249 | |
Martin Stjernholm | cd07bce | 2020-03-10 22:37:59 +0000 | [diff] [blame] | 250 | func TestSnapshotWithObject(t *testing.T) { |
| 251 | result := testSdkWithCc(t, ` |
| 252 | sdk { |
| 253 | name: "mysdk", |
| 254 | native_objects: ["crtobj"], |
| 255 | } |
| 256 | |
| 257 | cc_object { |
| 258 | name: "crtobj", |
| 259 | stl: "none", |
Colin Cross | 6b8f425 | 2021-07-22 11:39:44 -0700 | [diff] [blame] | 260 | system_shared_libs: [], |
Martin Stjernholm | fbb486f | 2020-08-21 18:43:51 +0100 | [diff] [blame] | 261 | sanitize: { |
| 262 | never: true, |
| 263 | }, |
Martin Stjernholm | cd07bce | 2020-03-10 22:37:59 +0000 | [diff] [blame] | 264 | } |
| 265 | `) |
| 266 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 267 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 268 | checkUnversionedAndroidBpContents(` |
Martin Stjernholm | cd07bce | 2020-03-10 22:37:59 +0000 | [diff] [blame] | 269 | // This is auto-generated. DO NOT EDIT. |
| 270 | |
| 271 | cc_prebuilt_object { |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 272 | name: "crtobj", |
| 273 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 274 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 275 | apex_available: ["//apex_available:platform"], |
Martin Stjernholm | cd07bce | 2020-03-10 22:37:59 +0000 | [diff] [blame] | 276 | stl: "none", |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 277 | compile_multilib: "both", |
Colin Cross | 6b8f425 | 2021-07-22 11:39:44 -0700 | [diff] [blame] | 278 | system_shared_libs: [], |
Martin Stjernholm | fbb486f | 2020-08-21 18:43:51 +0100 | [diff] [blame] | 279 | sanitize: { |
| 280 | never: true, |
| 281 | }, |
Martin Stjernholm | cd07bce | 2020-03-10 22:37:59 +0000 | [diff] [blame] | 282 | arch: { |
| 283 | arm64: { |
| 284 | srcs: ["arm64/lib/crtobj.o"], |
| 285 | }, |
| 286 | arm: { |
| 287 | srcs: ["arm/lib/crtobj.o"], |
| 288 | }, |
| 289 | }, |
| 290 | } |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 291 | `), |
| 292 | // Make sure that the generated sdk_snapshot uses the native_objects property. |
| 293 | checkVersionedAndroidBpContents(` |
| 294 | // This is auto-generated. DO NOT EDIT. |
Martin Stjernholm | cd07bce | 2020-03-10 22:37:59 +0000 | [diff] [blame] | 295 | |
| 296 | cc_prebuilt_object { |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 297 | name: "mysdk_crtobj@current", |
| 298 | sdk_member_name: "crtobj", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 299 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 300 | apex_available: ["//apex_available:platform"], |
Martin Stjernholm | cd07bce | 2020-03-10 22:37:59 +0000 | [diff] [blame] | 301 | stl: "none", |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 302 | compile_multilib: "both", |
Colin Cross | 6b8f425 | 2021-07-22 11:39:44 -0700 | [diff] [blame] | 303 | system_shared_libs: [], |
Martin Stjernholm | fbb486f | 2020-08-21 18:43:51 +0100 | [diff] [blame] | 304 | sanitize: { |
| 305 | never: true, |
| 306 | }, |
Martin Stjernholm | cd07bce | 2020-03-10 22:37:59 +0000 | [diff] [blame] | 307 | arch: { |
| 308 | arm64: { |
| 309 | srcs: ["arm64/lib/crtobj.o"], |
| 310 | }, |
| 311 | arm: { |
| 312 | srcs: ["arm/lib/crtobj.o"], |
| 313 | }, |
| 314 | }, |
| 315 | } |
| 316 | |
| 317 | sdk_snapshot { |
| 318 | name: "mysdk@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 319 | visibility: ["//visibility:public"], |
Martin Stjernholm | cd07bce | 2020-03-10 22:37:59 +0000 | [diff] [blame] | 320 | native_objects: ["mysdk_crtobj@current"], |
| 321 | } |
| 322 | `), |
| 323 | checkAllCopyRules(` |
| 324 | .intermediates/crtobj/android_arm64_armv8-a/crtobj.o -> arm64/lib/crtobj.o |
| 325 | .intermediates/crtobj/android_arm_armv7-a-neon/crtobj.o -> arm/lib/crtobj.o |
| 326 | `), |
| 327 | ) |
| 328 | } |
| 329 | |
Paul Duffin | c62a510 | 2019-12-11 18:34:15 +0000 | [diff] [blame] | 330 | func TestSnapshotWithCcDuplicateHeaders(t *testing.T) { |
| 331 | result := testSdkWithCc(t, ` |
| 332 | sdk { |
| 333 | name: "mysdk", |
| 334 | native_shared_libs: ["mynativelib1", "mynativelib2"], |
| 335 | } |
| 336 | |
| 337 | cc_library_shared { |
| 338 | name: "mynativelib1", |
| 339 | srcs: [ |
| 340 | "Test.cpp", |
| 341 | ], |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 342 | export_include_dirs: ["myinclude"], |
Paul Duffin | c62a510 | 2019-12-11 18:34:15 +0000 | [diff] [blame] | 343 | stl: "none", |
| 344 | } |
| 345 | |
| 346 | cc_library_shared { |
| 347 | name: "mynativelib2", |
| 348 | srcs: [ |
| 349 | "Test.cpp", |
| 350 | ], |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 351 | export_include_dirs: ["myinclude"], |
Paul Duffin | c62a510 | 2019-12-11 18:34:15 +0000 | [diff] [blame] | 352 | stl: "none", |
| 353 | } |
| 354 | `) |
| 355 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 356 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | c62a510 | 2019-12-11 18:34:15 +0000 | [diff] [blame] | 357 | checkAllCopyRules(` |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 358 | myinclude/Test.h -> include/myinclude/Test.h |
Colin Cross | 7113d20 | 2019-11-20 16:39:12 -0800 | [diff] [blame] | 359 | .intermediates/mynativelib1/android_arm64_armv8-a_shared/mynativelib1.so -> arm64/lib/mynativelib1.so |
| 360 | .intermediates/mynativelib1/android_arm_armv7-a-neon_shared/mynativelib1.so -> arm/lib/mynativelib1.so |
| 361 | .intermediates/mynativelib2/android_arm64_armv8-a_shared/mynativelib2.so -> arm64/lib/mynativelib2.so |
| 362 | .intermediates/mynativelib2/android_arm_armv7-a-neon_shared/mynativelib2.so -> arm/lib/mynativelib2.so |
Paul Duffin | c62a510 | 2019-12-11 18:34:15 +0000 | [diff] [blame] | 363 | `), |
| 364 | ) |
| 365 | } |
| 366 | |
Paul Duffin | a43f927 | 2021-02-17 10:55:25 +0000 | [diff] [blame] | 367 | func TestSnapshotWithCcExportGeneratedHeaders(t *testing.T) { |
| 368 | result := testSdkWithCc(t, ` |
| 369 | sdk { |
| 370 | name: "mysdk", |
| 371 | native_shared_libs: ["mynativelib"], |
| 372 | } |
| 373 | |
| 374 | cc_library_shared { |
| 375 | name: "mynativelib", |
| 376 | srcs: [ |
| 377 | "Test.cpp", |
| 378 | ], |
| 379 | generated_headers: [ |
| 380 | "generated_foo", |
| 381 | ], |
| 382 | export_generated_headers: [ |
| 383 | "generated_foo", |
| 384 | ], |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 385 | export_include_dirs: ["myinclude"], |
Paul Duffin | a43f927 | 2021-02-17 10:55:25 +0000 | [diff] [blame] | 386 | stl: "none", |
| 387 | } |
| 388 | |
| 389 | genrule { |
| 390 | name: "generated_foo", |
| 391 | cmd: "generate-foo", |
| 392 | out: [ |
| 393 | "generated_foo/protos/foo/bar.h", |
| 394 | ], |
| 395 | export_include_dirs: [ |
| 396 | ".", |
| 397 | "protos", |
| 398 | ], |
| 399 | } |
| 400 | `) |
| 401 | |
Paul Duffin | db462dd | 2021-03-21 22:01:55 +0000 | [diff] [blame] | 402 | // TODO(b/183322862): Remove this and fix the issue. |
| 403 | errorHandler := android.FixtureExpectsAtLeastOneErrorMatchingPattern(`module source path "snapshot/include_gen/generated_foo/gen/protos" does not exist`) |
| 404 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 405 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | a43f927 | 2021-02-17 10:55:25 +0000 | [diff] [blame] | 406 | checkUnversionedAndroidBpContents(` |
| 407 | // This is auto-generated. DO NOT EDIT. |
| 408 | |
| 409 | cc_prebuilt_library_shared { |
| 410 | name: "mynativelib", |
| 411 | prefer: false, |
| 412 | visibility: ["//visibility:public"], |
| 413 | apex_available: ["//apex_available:platform"], |
| 414 | stl: "none", |
| 415 | compile_multilib: "both", |
Paul Duffin | 7a7d067 | 2021-02-17 12:17:40 +0000 | [diff] [blame] | 416 | export_include_dirs: [ |
| 417 | "include/myinclude", |
| 418 | "include_gen/generated_foo/gen", |
| 419 | "include_gen/generated_foo/gen/protos", |
| 420 | ], |
Paul Duffin | a43f927 | 2021-02-17 10:55:25 +0000 | [diff] [blame] | 421 | arch: { |
| 422 | arm64: { |
| 423 | srcs: ["arm64/lib/mynativelib.so"], |
Paul Duffin | a43f927 | 2021-02-17 10:55:25 +0000 | [diff] [blame] | 424 | }, |
| 425 | arm: { |
| 426 | srcs: ["arm/lib/mynativelib.so"], |
Paul Duffin | a43f927 | 2021-02-17 10:55:25 +0000 | [diff] [blame] | 427 | }, |
| 428 | }, |
| 429 | } |
| 430 | `), |
| 431 | checkAllCopyRules(` |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 432 | myinclude/Test.h -> include/myinclude/Test.h |
Paul Duffin | 7a7d067 | 2021-02-17 12:17:40 +0000 | [diff] [blame] | 433 | .intermediates/generated_foo/gen/generated_foo/protos/foo/bar.h -> include_gen/generated_foo/gen/generated_foo/protos/foo/bar.h |
Paul Duffin | a43f927 | 2021-02-17 10:55:25 +0000 | [diff] [blame] | 434 | .intermediates/mynativelib/android_arm64_armv8-a_shared/mynativelib.so -> arm64/lib/mynativelib.so |
Paul Duffin | a43f927 | 2021-02-17 10:55:25 +0000 | [diff] [blame] | 435 | .intermediates/mynativelib/android_arm_armv7-a-neon_shared/mynativelib.so -> arm/lib/mynativelib.so |
Paul Duffin | a43f927 | 2021-02-17 10:55:25 +0000 | [diff] [blame] | 436 | `), |
Paul Duffin | db462dd | 2021-03-21 22:01:55 +0000 | [diff] [blame] | 437 | snapshotTestErrorHandler(checkSnapshotWithoutSource, errorHandler), |
| 438 | snapshotTestErrorHandler(checkSnapshotWithSourcePreferred, errorHandler), |
| 439 | snapshotTestErrorHandler(checkSnapshotPreferredWithSource, errorHandler), |
Paul Duffin | a43f927 | 2021-02-17 10:55:25 +0000 | [diff] [blame] | 440 | ) |
| 441 | } |
| 442 | |
Martin Stjernholm | b024957 | 2020-09-15 02:32:35 +0100 | [diff] [blame] | 443 | // Verify that when the shared library has some common and some arch specific |
| 444 | // properties that the generated snapshot is optimized properly. Substruct |
| 445 | // handling is tested with the sanitize clauses (but note there's a lot of |
| 446 | // built-in logic in sanitize.go that can affect those flags). |
Paul Duffin | a7cd8c8 | 2019-12-11 20:00:57 +0000 | [diff] [blame] | 447 | func TestSnapshotWithCcSharedLibraryCommonProperties(t *testing.T) { |
| 448 | result := testSdkWithCc(t, ` |
| 449 | sdk { |
| 450 | name: "mysdk", |
| 451 | native_shared_libs: ["mynativelib"], |
| 452 | } |
| 453 | |
| 454 | cc_library_shared { |
| 455 | name: "mynativelib", |
| 456 | srcs: [ |
| 457 | "Test.cpp", |
| 458 | "aidl/foo/bar/Test.aidl", |
| 459 | ], |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 460 | export_include_dirs: ["myinclude"], |
Martin Stjernholm | b024957 | 2020-09-15 02:32:35 +0100 | [diff] [blame] | 461 | sanitize: { |
| 462 | fuzzer: false, |
| 463 | integer_overflow: true, |
| 464 | diag: { undefined: false }, |
| 465 | }, |
Paul Duffin | a7cd8c8 | 2019-12-11 20:00:57 +0000 | [diff] [blame] | 466 | arch: { |
| 467 | arm64: { |
| 468 | export_system_include_dirs: ["arm64/include"], |
Martin Stjernholm | b024957 | 2020-09-15 02:32:35 +0100 | [diff] [blame] | 469 | sanitize: { |
Martin Stjernholm | b024957 | 2020-09-15 02:32:35 +0100 | [diff] [blame] | 470 | integer_overflow: false, |
| 471 | }, |
Paul Duffin | a7cd8c8 | 2019-12-11 20:00:57 +0000 | [diff] [blame] | 472 | }, |
| 473 | }, |
Paul Duffin | a7cd8c8 | 2019-12-11 20:00:57 +0000 | [diff] [blame] | 474 | stl: "none", |
| 475 | } |
| 476 | `) |
| 477 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 478 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 479 | checkUnversionedAndroidBpContents(` |
Paul Duffin | a7cd8c8 | 2019-12-11 20:00:57 +0000 | [diff] [blame] | 480 | // This is auto-generated. DO NOT EDIT. |
| 481 | |
| 482 | cc_prebuilt_library_shared { |
Paul Duffin | a7cd8c8 | 2019-12-11 20:00:57 +0000 | [diff] [blame] | 483 | name: "mynativelib", |
| 484 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 485 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 486 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 487 | stl: "none", |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 488 | compile_multilib: "both", |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 489 | export_include_dirs: ["include/myinclude"], |
Martin Stjernholm | b024957 | 2020-09-15 02:32:35 +0100 | [diff] [blame] | 490 | sanitize: { |
| 491 | fuzzer: false, |
| 492 | diag: { |
| 493 | undefined: false, |
| 494 | }, |
| 495 | }, |
Paul Duffin | a7cd8c8 | 2019-12-11 20:00:57 +0000 | [diff] [blame] | 496 | arch: { |
| 497 | arm64: { |
| 498 | srcs: ["arm64/lib/mynativelib.so"], |
| 499 | export_system_include_dirs: ["arm64/include/arm64/include"], |
Martin Stjernholm | b024957 | 2020-09-15 02:32:35 +0100 | [diff] [blame] | 500 | sanitize: { |
Martin Stjernholm | b024957 | 2020-09-15 02:32:35 +0100 | [diff] [blame] | 501 | integer_overflow: false, |
| 502 | }, |
Paul Duffin | a7cd8c8 | 2019-12-11 20:00:57 +0000 | [diff] [blame] | 503 | }, |
| 504 | arm: { |
| 505 | srcs: ["arm/lib/mynativelib.so"], |
Martin Stjernholm | b024957 | 2020-09-15 02:32:35 +0100 | [diff] [blame] | 506 | sanitize: { |
| 507 | integer_overflow: true, |
| 508 | }, |
Paul Duffin | a7cd8c8 | 2019-12-11 20:00:57 +0000 | [diff] [blame] | 509 | }, |
| 510 | }, |
Paul Duffin | a7cd8c8 | 2019-12-11 20:00:57 +0000 | [diff] [blame] | 511 | } |
Paul Duffin | a7cd8c8 | 2019-12-11 20:00:57 +0000 | [diff] [blame] | 512 | `), |
| 513 | checkAllCopyRules(` |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 514 | myinclude/Test.h -> include/myinclude/Test.h |
Martin Stjernholm | 59e0c7a | 2020-10-28 23:38:33 +0000 | [diff] [blame] | 515 | .intermediates/mynativelib/android_arm64_armv8-a_shared/mynativelib.so -> arm64/lib/mynativelib.so |
Paul Duffin | a7cd8c8 | 2019-12-11 20:00:57 +0000 | [diff] [blame] | 516 | arm64/include/Arm64Test.h -> arm64/include/arm64/include/Arm64Test.h |
Colin Cross | 7113d20 | 2019-11-20 16:39:12 -0800 | [diff] [blame] | 517 | .intermediates/mynativelib/android_arm_armv7-a-neon_shared/mynativelib.so -> arm/lib/mynativelib.so`), |
Paul Duffin | a7cd8c8 | 2019-12-11 20:00:57 +0000 | [diff] [blame] | 518 | ) |
| 519 | } |
| 520 | |
Paul Duffin | 25ce04b | 2020-01-16 11:47:25 +0000 | [diff] [blame] | 521 | func TestSnapshotWithCcBinary(t *testing.T) { |
| 522 | result := testSdkWithCc(t, ` |
| 523 | module_exports { |
| 524 | name: "mymodule_exports", |
| 525 | native_binaries: ["mynativebinary"], |
| 526 | } |
| 527 | |
| 528 | cc_binary { |
| 529 | name: "mynativebinary", |
| 530 | srcs: [ |
| 531 | "Test.cpp", |
| 532 | ], |
| 533 | compile_multilib: "both", |
Paul Duffin | 25ce04b | 2020-01-16 11:47:25 +0000 | [diff] [blame] | 534 | } |
| 535 | `) |
| 536 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 537 | CheckSnapshot(t, result, "mymodule_exports", "", |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 538 | checkUnversionedAndroidBpContents(` |
Paul Duffin | 25ce04b | 2020-01-16 11:47:25 +0000 | [diff] [blame] | 539 | // This is auto-generated. DO NOT EDIT. |
| 540 | |
| 541 | cc_prebuilt_binary { |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 542 | name: "mynativebinary", |
| 543 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 544 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 545 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 25ce04b | 2020-01-16 11:47:25 +0000 | [diff] [blame] | 546 | compile_multilib: "both", |
| 547 | arch: { |
| 548 | arm64: { |
| 549 | srcs: ["arm64/bin/mynativebinary"], |
| 550 | }, |
| 551 | arm: { |
| 552 | srcs: ["arm/bin/mynativebinary"], |
| 553 | }, |
| 554 | }, |
| 555 | } |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 556 | `), |
| 557 | // Make sure that the generated sdk_snapshot uses the native_binaries property. |
| 558 | checkVersionedAndroidBpContents(` |
| 559 | // This is auto-generated. DO NOT EDIT. |
Paul Duffin | 25ce04b | 2020-01-16 11:47:25 +0000 | [diff] [blame] | 560 | |
| 561 | cc_prebuilt_binary { |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 562 | name: "mymodule_exports_mynativebinary@current", |
| 563 | sdk_member_name: "mynativebinary", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 564 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 565 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 566 | installable: false, |
Paul Duffin | 25ce04b | 2020-01-16 11:47:25 +0000 | [diff] [blame] | 567 | compile_multilib: "both", |
| 568 | arch: { |
| 569 | arm64: { |
| 570 | srcs: ["arm64/bin/mynativebinary"], |
| 571 | }, |
| 572 | arm: { |
| 573 | srcs: ["arm/bin/mynativebinary"], |
| 574 | }, |
| 575 | }, |
| 576 | } |
| 577 | |
| 578 | module_exports_snapshot { |
| 579 | name: "mymodule_exports@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 580 | visibility: ["//visibility:public"], |
Paul Duffin | 25ce04b | 2020-01-16 11:47:25 +0000 | [diff] [blame] | 581 | native_binaries: ["mymodule_exports_mynativebinary@current"], |
| 582 | } |
| 583 | `), |
| 584 | checkAllCopyRules(` |
| 585 | .intermediates/mynativebinary/android_arm64_armv8-a/mynativebinary -> arm64/bin/mynativebinary |
| 586 | .intermediates/mynativebinary/android_arm_armv7-a-neon/mynativebinary -> arm/bin/mynativebinary |
| 587 | `), |
| 588 | ) |
| 589 | } |
| 590 | |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 591 | func TestMultipleHostOsTypesSnapshotWithCcBinary(t *testing.T) { |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 592 | result := testSdkWithCc(t, ` |
| 593 | module_exports { |
| 594 | name: "myexports", |
| 595 | device_supported: false, |
| 596 | host_supported: true, |
| 597 | native_binaries: ["mynativebinary"], |
| 598 | target: { |
| 599 | windows: { |
| 600 | enabled: true, |
| 601 | }, |
| 602 | }, |
| 603 | } |
| 604 | |
| 605 | cc_binary { |
| 606 | name: "mynativebinary", |
| 607 | device_supported: false, |
| 608 | host_supported: true, |
| 609 | srcs: [ |
| 610 | "Test.cpp", |
| 611 | ], |
| 612 | compile_multilib: "both", |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 613 | stl: "none", |
| 614 | target: { |
| 615 | windows: { |
| 616 | enabled: true, |
| 617 | }, |
| 618 | }, |
| 619 | } |
| 620 | `) |
| 621 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 622 | CheckSnapshot(t, result, "myexports", "", |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 623 | checkUnversionedAndroidBpContents(` |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 624 | // This is auto-generated. DO NOT EDIT. |
| 625 | |
| 626 | cc_prebuilt_binary { |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 627 | name: "mynativebinary", |
| 628 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 629 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 630 | apex_available: ["//apex_available:platform"], |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 631 | device_supported: false, |
| 632 | host_supported: true, |
Martin Stjernholm | 7130fab | 2020-05-28 22:58:01 +0100 | [diff] [blame] | 633 | stl: "none", |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 634 | target: { |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 635 | host: { |
| 636 | enabled: false, |
| 637 | }, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 638 | linux_glibc: { |
| 639 | compile_multilib: "both", |
| 640 | }, |
| 641 | linux_glibc_x86_64: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 642 | enabled: true, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 643 | srcs: ["linux_glibc/x86_64/bin/mynativebinary"], |
| 644 | }, |
| 645 | linux_glibc_x86: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 646 | enabled: true, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 647 | srcs: ["linux_glibc/x86/bin/mynativebinary"], |
| 648 | }, |
| 649 | windows: { |
| 650 | compile_multilib: "64", |
| 651 | }, |
| 652 | windows_x86_64: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 653 | enabled: true, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 654 | srcs: ["windows/x86_64/bin/mynativebinary.exe"], |
| 655 | }, |
| 656 | }, |
| 657 | } |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 658 | `), |
| 659 | checkVersionedAndroidBpContents(` |
| 660 | // This is auto-generated. DO NOT EDIT. |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 661 | |
| 662 | cc_prebuilt_binary { |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 663 | name: "myexports_mynativebinary@current", |
| 664 | sdk_member_name: "mynativebinary", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 665 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 666 | apex_available: ["//apex_available:platform"], |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 667 | device_supported: false, |
| 668 | host_supported: true, |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 669 | installable: false, |
Martin Stjernholm | 7130fab | 2020-05-28 22:58:01 +0100 | [diff] [blame] | 670 | stl: "none", |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 671 | target: { |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 672 | host: { |
| 673 | enabled: false, |
| 674 | }, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 675 | linux_glibc: { |
| 676 | compile_multilib: "both", |
| 677 | }, |
| 678 | linux_glibc_x86_64: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 679 | enabled: true, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 680 | srcs: ["linux_glibc/x86_64/bin/mynativebinary"], |
| 681 | }, |
| 682 | linux_glibc_x86: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 683 | enabled: true, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 684 | srcs: ["linux_glibc/x86/bin/mynativebinary"], |
| 685 | }, |
| 686 | windows: { |
| 687 | compile_multilib: "64", |
| 688 | }, |
| 689 | windows_x86_64: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 690 | enabled: true, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 691 | srcs: ["windows/x86_64/bin/mynativebinary.exe"], |
| 692 | }, |
| 693 | }, |
| 694 | } |
| 695 | |
| 696 | module_exports_snapshot { |
| 697 | name: "myexports@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 698 | visibility: ["//visibility:public"], |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 699 | device_supported: false, |
| 700 | host_supported: true, |
| 701 | native_binaries: ["myexports_mynativebinary@current"], |
Paul Duffin | 6a7e953 | 2020-03-20 17:50:07 +0000 | [diff] [blame] | 702 | target: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 703 | windows: { |
| 704 | compile_multilib: "64", |
| 705 | }, |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 706 | host: { |
| 707 | enabled: false, |
| 708 | }, |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 709 | linux_glibc_x86_64: { |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 710 | enabled: true, |
| 711 | }, |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 712 | linux_glibc_x86: { |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 713 | enabled: true, |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 714 | }, |
| 715 | windows_x86_64: { |
| 716 | enabled: true, |
Paul Duffin | 6a7e953 | 2020-03-20 17:50:07 +0000 | [diff] [blame] | 717 | }, |
| 718 | }, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 719 | } |
| 720 | `), |
| 721 | checkAllCopyRules(` |
| 722 | .intermediates/mynativebinary/linux_glibc_x86_64/mynativebinary -> linux_glibc/x86_64/bin/mynativebinary |
| 723 | .intermediates/mynativebinary/linux_glibc_x86/mynativebinary -> linux_glibc/x86/bin/mynativebinary |
| 724 | .intermediates/mynativebinary/windows_x86_64/mynativebinary.exe -> windows/x86_64/bin/mynativebinary.exe |
| 725 | `), |
| 726 | ) |
| 727 | } |
| 728 | |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 729 | func TestSnapshotWithSingleHostOsType(t *testing.T) { |
Paul Duffin | 89648f9 | 2021-03-20 00:36:55 +0000 | [diff] [blame] | 730 | result := android.GroupFixturePreparers( |
| 731 | prepareForSdkTest, |
Paul Duffin | 4a2a29c | 2021-03-09 22:27:13 +0000 | [diff] [blame] | 732 | ccTestFs.AddToFixture(), |
| 733 | cc.PrepareForTestOnLinuxBionic, |
| 734 | android.FixtureModifyConfig(func(config android.Config) { |
| 735 | config.Targets[android.LinuxBionic] = []android.Target{ |
| 736 | {android.LinuxBionic, android.Arch{ArchType: android.X86_64}, android.NativeBridgeDisabled, "", "", false}, |
| 737 | } |
| 738 | }), |
| 739 | ).RunTestWithBp(t, ` |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 740 | cc_defaults { |
| 741 | name: "mydefaults", |
| 742 | device_supported: false, |
| 743 | host_supported: true, |
| 744 | compile_multilib: "64", |
| 745 | target: { |
| 746 | host: { |
| 747 | enabled: false, |
| 748 | }, |
| 749 | linux_bionic: { |
| 750 | enabled: true, |
| 751 | }, |
| 752 | }, |
| 753 | } |
| 754 | |
| 755 | module_exports { |
| 756 | name: "myexports", |
| 757 | defaults: ["mydefaults"], |
| 758 | native_shared_libs: ["mynativelib"], |
| 759 | native_binaries: ["mynativebinary"], |
| 760 | compile_multilib: "64", // The built-in default in sdk.go overrides mydefaults. |
| 761 | } |
| 762 | |
| 763 | cc_library { |
| 764 | name: "mynativelib", |
| 765 | defaults: ["mydefaults"], |
| 766 | srcs: [ |
| 767 | "Test.cpp", |
| 768 | ], |
| 769 | stl: "none", |
| 770 | } |
| 771 | |
| 772 | cc_binary { |
| 773 | name: "mynativebinary", |
| 774 | defaults: ["mydefaults"], |
| 775 | srcs: [ |
| 776 | "Test.cpp", |
| 777 | ], |
| 778 | stl: "none", |
| 779 | } |
Paul Duffin | 4a2a29c | 2021-03-09 22:27:13 +0000 | [diff] [blame] | 780 | `) |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 781 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 782 | CheckSnapshot(t, result, "myexports", "", |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 783 | checkUnversionedAndroidBpContents(` |
| 784 | // This is auto-generated. DO NOT EDIT. |
| 785 | |
| 786 | cc_prebuilt_binary { |
| 787 | name: "mynativebinary", |
| 788 | prefer: false, |
| 789 | visibility: ["//visibility:public"], |
| 790 | apex_available: ["//apex_available:platform"], |
| 791 | device_supported: false, |
| 792 | host_supported: true, |
| 793 | stl: "none", |
| 794 | compile_multilib: "64", |
| 795 | target: { |
| 796 | host: { |
| 797 | enabled: false, |
| 798 | }, |
| 799 | linux_bionic_x86_64: { |
| 800 | enabled: true, |
| 801 | srcs: ["x86_64/bin/mynativebinary"], |
| 802 | }, |
| 803 | }, |
| 804 | } |
| 805 | |
| 806 | cc_prebuilt_library_shared { |
| 807 | name: "mynativelib", |
| 808 | prefer: false, |
| 809 | visibility: ["//visibility:public"], |
| 810 | apex_available: ["//apex_available:platform"], |
| 811 | device_supported: false, |
| 812 | host_supported: true, |
| 813 | stl: "none", |
| 814 | compile_multilib: "64", |
| 815 | target: { |
| 816 | host: { |
| 817 | enabled: false, |
| 818 | }, |
| 819 | linux_bionic_x86_64: { |
| 820 | enabled: true, |
| 821 | srcs: ["x86_64/lib/mynativelib.so"], |
| 822 | }, |
| 823 | }, |
| 824 | } |
| 825 | `), |
| 826 | checkVersionedAndroidBpContents(` |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 827 | // This is auto-generated. DO NOT EDIT. |
| 828 | |
| 829 | cc_prebuilt_binary { |
| 830 | name: "myexports_mynativebinary@current", |
| 831 | sdk_member_name: "mynativebinary", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 832 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 833 | apex_available: ["//apex_available:platform"], |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 834 | device_supported: false, |
| 835 | host_supported: true, |
| 836 | installable: false, |
| 837 | stl: "none", |
| 838 | compile_multilib: "64", |
| 839 | target: { |
| 840 | host: { |
| 841 | enabled: false, |
| 842 | }, |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 843 | linux_bionic_x86_64: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 844 | enabled: true, |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 845 | srcs: ["x86_64/bin/mynativebinary"], |
| 846 | }, |
| 847 | }, |
| 848 | } |
| 849 | |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 850 | cc_prebuilt_library_shared { |
| 851 | name: "myexports_mynativelib@current", |
| 852 | sdk_member_name: "mynativelib", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 853 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 854 | apex_available: ["//apex_available:platform"], |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 855 | device_supported: false, |
| 856 | host_supported: true, |
| 857 | installable: false, |
| 858 | stl: "none", |
| 859 | compile_multilib: "64", |
| 860 | target: { |
| 861 | host: { |
| 862 | enabled: false, |
| 863 | }, |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 864 | linux_bionic_x86_64: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 865 | enabled: true, |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 866 | srcs: ["x86_64/lib/mynativelib.so"], |
| 867 | }, |
| 868 | }, |
| 869 | } |
| 870 | |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 871 | module_exports_snapshot { |
| 872 | name: "myexports@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 873 | visibility: ["//visibility:public"], |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 874 | device_supported: false, |
| 875 | host_supported: true, |
Paul Duffin | 7b0259f | 2021-04-24 11:34:46 +0100 | [diff] [blame] | 876 | compile_multilib: "64", |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 877 | native_binaries: ["myexports_mynativebinary@current"], |
| 878 | native_shared_libs: ["myexports_mynativelib@current"], |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 879 | target: { |
| 880 | host: { |
| 881 | enabled: false, |
| 882 | }, |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 883 | linux_bionic_x86_64: { |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 884 | enabled: true, |
| 885 | }, |
| 886 | }, |
| 887 | } |
| 888 | `), |
| 889 | checkAllCopyRules(` |
| 890 | .intermediates/mynativebinary/linux_bionic_x86_64/mynativebinary -> x86_64/bin/mynativebinary |
| 891 | .intermediates/mynativelib/linux_bionic_x86_64_shared/mynativelib.so -> x86_64/lib/mynativelib.so |
| 892 | `), |
| 893 | ) |
| 894 | } |
| 895 | |
Martin Stjernholm | 7130fab | 2020-05-28 22:58:01 +0100 | [diff] [blame] | 896 | // Test that we support the necessary flags for the linker binary, which is |
| 897 | // special in several ways. |
| 898 | func TestSnapshotWithCcStaticNocrtBinary(t *testing.T) { |
Martin Stjernholm | 7130fab | 2020-05-28 22:58:01 +0100 | [diff] [blame] | 899 | result := testSdkWithCc(t, ` |
| 900 | module_exports { |
| 901 | name: "mymodule_exports", |
| 902 | host_supported: true, |
| 903 | device_supported: false, |
| 904 | native_binaries: ["linker"], |
| 905 | } |
| 906 | |
| 907 | cc_binary { |
| 908 | name: "linker", |
| 909 | host_supported: true, |
| 910 | static_executable: true, |
| 911 | nocrt: true, |
| 912 | stl: "none", |
| 913 | srcs: [ |
| 914 | "Test.cpp", |
| 915 | ], |
| 916 | compile_multilib: "both", |
| 917 | } |
| 918 | `) |
| 919 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 920 | CheckSnapshot(t, result, "mymodule_exports", "", |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 921 | checkUnversionedAndroidBpContents(` |
Martin Stjernholm | 7130fab | 2020-05-28 22:58:01 +0100 | [diff] [blame] | 922 | // This is auto-generated. DO NOT EDIT. |
| 923 | |
| 924 | cc_prebuilt_binary { |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 925 | name: "linker", |
| 926 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 927 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 928 | apex_available: ["//apex_available:platform"], |
Martin Stjernholm | 7130fab | 2020-05-28 22:58:01 +0100 | [diff] [blame] | 929 | device_supported: false, |
| 930 | host_supported: true, |
Martin Stjernholm | 7130fab | 2020-05-28 22:58:01 +0100 | [diff] [blame] | 931 | stl: "none", |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 932 | compile_multilib: "both", |
Martin Stjernholm | 7130fab | 2020-05-28 22:58:01 +0100 | [diff] [blame] | 933 | static_executable: true, |
| 934 | nocrt: true, |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 935 | target: { |
| 936 | host: { |
| 937 | enabled: false, |
| 938 | }, |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 939 | linux_glibc_x86_64: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 940 | enabled: true, |
Martin Stjernholm | 7130fab | 2020-05-28 22:58:01 +0100 | [diff] [blame] | 941 | srcs: ["x86_64/bin/linker"], |
| 942 | }, |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 943 | linux_glibc_x86: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 944 | enabled: true, |
Martin Stjernholm | 7130fab | 2020-05-28 22:58:01 +0100 | [diff] [blame] | 945 | srcs: ["x86/bin/linker"], |
| 946 | }, |
| 947 | }, |
| 948 | } |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 949 | `), |
| 950 | checkVersionedAndroidBpContents(` |
| 951 | // This is auto-generated. DO NOT EDIT. |
Martin Stjernholm | 7130fab | 2020-05-28 22:58:01 +0100 | [diff] [blame] | 952 | |
| 953 | cc_prebuilt_binary { |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 954 | name: "mymodule_exports_linker@current", |
| 955 | sdk_member_name: "linker", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 956 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 957 | apex_available: ["//apex_available:platform"], |
Martin Stjernholm | 7130fab | 2020-05-28 22:58:01 +0100 | [diff] [blame] | 958 | device_supported: false, |
| 959 | host_supported: true, |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 960 | installable: false, |
Martin Stjernholm | 7130fab | 2020-05-28 22:58:01 +0100 | [diff] [blame] | 961 | stl: "none", |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 962 | compile_multilib: "both", |
Martin Stjernholm | 7130fab | 2020-05-28 22:58:01 +0100 | [diff] [blame] | 963 | static_executable: true, |
| 964 | nocrt: true, |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 965 | target: { |
| 966 | host: { |
| 967 | enabled: false, |
| 968 | }, |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 969 | linux_glibc_x86_64: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 970 | enabled: true, |
Martin Stjernholm | 7130fab | 2020-05-28 22:58:01 +0100 | [diff] [blame] | 971 | srcs: ["x86_64/bin/linker"], |
| 972 | }, |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 973 | linux_glibc_x86: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 974 | enabled: true, |
Martin Stjernholm | 7130fab | 2020-05-28 22:58:01 +0100 | [diff] [blame] | 975 | srcs: ["x86/bin/linker"], |
| 976 | }, |
| 977 | }, |
| 978 | } |
| 979 | |
| 980 | module_exports_snapshot { |
| 981 | name: "mymodule_exports@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 982 | visibility: ["//visibility:public"], |
Martin Stjernholm | 7130fab | 2020-05-28 22:58:01 +0100 | [diff] [blame] | 983 | device_supported: false, |
| 984 | host_supported: true, |
| 985 | native_binaries: ["mymodule_exports_linker@current"], |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 986 | target: { |
| 987 | host: { |
| 988 | enabled: false, |
| 989 | }, |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 990 | linux_glibc_x86_64: { |
| 991 | enabled: true, |
| 992 | }, |
| 993 | linux_glibc_x86: { |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 994 | enabled: true, |
| 995 | }, |
| 996 | }, |
Martin Stjernholm | 7130fab | 2020-05-28 22:58:01 +0100 | [diff] [blame] | 997 | } |
| 998 | `), |
| 999 | checkAllCopyRules(` |
| 1000 | .intermediates/linker/linux_glibc_x86_64/linker -> x86_64/bin/linker |
| 1001 | .intermediates/linker/linux_glibc_x86/linker -> x86/bin/linker |
| 1002 | `), |
| 1003 | ) |
| 1004 | } |
| 1005 | |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1006 | func TestSnapshotWithCcSharedLibrary(t *testing.T) { |
Paul Duffin | d835daa | 2019-11-30 17:49:09 +0000 | [diff] [blame] | 1007 | result := testSdkWithCc(t, ` |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 1008 | sdk { |
| 1009 | name: "mysdk", |
| 1010 | native_shared_libs: ["mynativelib"], |
| 1011 | } |
| 1012 | |
| 1013 | cc_library_shared { |
| 1014 | name: "mynativelib", |
| 1015 | srcs: [ |
| 1016 | "Test.cpp", |
| 1017 | "aidl/foo/bar/Test.aidl", |
| 1018 | ], |
Paul Duffin | befa4b9 | 2020-03-04 14:22:45 +0000 | [diff] [blame] | 1019 | apex_available: ["apex1", "apex2"], |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1020 | export_include_dirs: ["myinclude"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 1021 | aidl: { |
| 1022 | export_aidl_headers: true, |
| 1023 | }, |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 1024 | stl: "none", |
| 1025 | } |
| 1026 | `) |
| 1027 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 1028 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1029 | checkUnversionedAndroidBpContents(` |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 1030 | // This is auto-generated. DO NOT EDIT. |
| 1031 | |
| 1032 | cc_prebuilt_library_shared { |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 1033 | name: "mynativelib", |
| 1034 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1035 | visibility: ["//visibility:public"], |
Paul Duffin | befa4b9 | 2020-03-04 14:22:45 +0000 | [diff] [blame] | 1036 | apex_available: [ |
| 1037 | "apex1", |
| 1038 | "apex2", |
| 1039 | ], |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 1040 | stl: "none", |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 1041 | compile_multilib: "both", |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1042 | export_include_dirs: ["include/myinclude"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 1043 | arch: { |
| 1044 | arm64: { |
| 1045 | srcs: ["arm64/lib/mynativelib.so"], |
Paul Duffin | 42dd4e6 | 2021-02-22 11:35:24 +0000 | [diff] [blame] | 1046 | export_include_dirs: ["arm64/include_gen/mynativelib/android_arm64_armv8-a_shared/gen/aidl"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 1047 | }, |
| 1048 | arm: { |
| 1049 | srcs: ["arm/lib/mynativelib.so"], |
Paul Duffin | 42dd4e6 | 2021-02-22 11:35:24 +0000 | [diff] [blame] | 1050 | export_include_dirs: ["arm/include_gen/mynativelib/android_arm_armv7-a-neon_shared/gen/aidl"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 1051 | }, |
| 1052 | }, |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 1053 | } |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 1054 | `), |
| 1055 | checkAllCopyRules(` |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1056 | myinclude/Test.h -> include/myinclude/Test.h |
Colin Cross | 7113d20 | 2019-11-20 16:39:12 -0800 | [diff] [blame] | 1057 | .intermediates/mynativelib/android_arm64_armv8-a_shared/mynativelib.so -> arm64/lib/mynativelib.so |
Paul Duffin | 42dd4e6 | 2021-02-22 11:35:24 +0000 | [diff] [blame] | 1058 | .intermediates/mynativelib/android_arm64_armv8-a_shared/gen/aidl/aidl/foo/bar/Test.h -> arm64/include_gen/mynativelib/android_arm64_armv8-a_shared/gen/aidl/aidl/foo/bar/Test.h |
| 1059 | .intermediates/mynativelib/android_arm64_armv8-a_shared/gen/aidl/aidl/foo/bar/BnTest.h -> arm64/include_gen/mynativelib/android_arm64_armv8-a_shared/gen/aidl/aidl/foo/bar/BnTest.h |
| 1060 | .intermediates/mynativelib/android_arm64_armv8-a_shared/gen/aidl/aidl/foo/bar/BpTest.h -> arm64/include_gen/mynativelib/android_arm64_armv8-a_shared/gen/aidl/aidl/foo/bar/BpTest.h |
Colin Cross | 7113d20 | 2019-11-20 16:39:12 -0800 | [diff] [blame] | 1061 | .intermediates/mynativelib/android_arm_armv7-a-neon_shared/mynativelib.so -> arm/lib/mynativelib.so |
Paul Duffin | 42dd4e6 | 2021-02-22 11:35:24 +0000 | [diff] [blame] | 1062 | .intermediates/mynativelib/android_arm_armv7-a-neon_shared/gen/aidl/aidl/foo/bar/Test.h -> arm/include_gen/mynativelib/android_arm_armv7-a-neon_shared/gen/aidl/aidl/foo/bar/Test.h |
| 1063 | .intermediates/mynativelib/android_arm_armv7-a-neon_shared/gen/aidl/aidl/foo/bar/BnTest.h -> arm/include_gen/mynativelib/android_arm_armv7-a-neon_shared/gen/aidl/aidl/foo/bar/BnTest.h |
| 1064 | .intermediates/mynativelib/android_arm_armv7-a-neon_shared/gen/aidl/aidl/foo/bar/BpTest.h -> arm/include_gen/mynativelib/android_arm_armv7-a-neon_shared/gen/aidl/aidl/foo/bar/BpTest.h |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 1065 | `), |
| 1066 | ) |
| 1067 | } |
| 1068 | |
Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 1069 | func TestSnapshotWithCcSharedLibrarySharedLibs(t *testing.T) { |
| 1070 | result := testSdkWithCc(t, ` |
| 1071 | sdk { |
| 1072 | name: "mysdk", |
| 1073 | native_shared_libs: [ |
| 1074 | "mynativelib", |
| 1075 | "myothernativelib", |
| 1076 | "mysystemnativelib", |
| 1077 | ], |
| 1078 | } |
| 1079 | |
| 1080 | cc_library { |
| 1081 | name: "mysystemnativelib", |
| 1082 | srcs: [ |
| 1083 | "Test.cpp", |
| 1084 | ], |
Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 1085 | stl: "none", |
| 1086 | } |
| 1087 | |
| 1088 | cc_library_shared { |
| 1089 | name: "myothernativelib", |
| 1090 | srcs: [ |
| 1091 | "Test.cpp", |
| 1092 | ], |
| 1093 | system_shared_libs: [ |
| 1094 | // A reference to a library that is not an sdk member. Uses libm as that |
| 1095 | // is in the default set of modules available to this test and so is available |
| 1096 | // both here and also when the generated Android.bp file is tested in |
| 1097 | // CheckSnapshot(). This ensures that the system_shared_libs property correctly |
| 1098 | // handles references to modules that are not sdk members. |
| 1099 | "libm", |
| 1100 | ], |
| 1101 | stl: "none", |
| 1102 | } |
| 1103 | |
| 1104 | cc_library { |
| 1105 | name: "mynativelib", |
| 1106 | srcs: [ |
| 1107 | "Test.cpp", |
| 1108 | ], |
| 1109 | shared_libs: [ |
| 1110 | // A reference to another sdk member. |
| 1111 | "myothernativelib", |
| 1112 | ], |
| 1113 | target: { |
| 1114 | android: { |
| 1115 | shared: { |
| 1116 | shared_libs: [ |
| 1117 | // A reference to a library that is not an sdk member. The libc library |
| 1118 | // is used here to check that the shared_libs property is handled correctly |
| 1119 | // in a similar way to how libm is used to check system_shared_libs above. |
| 1120 | "libc", |
| 1121 | ], |
| 1122 | }, |
| 1123 | }, |
| 1124 | }, |
Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 1125 | stl: "none", |
| 1126 | } |
| 1127 | `) |
| 1128 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 1129 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1130 | checkUnversionedAndroidBpContents(` |
Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 1131 | // This is auto-generated. DO NOT EDIT. |
| 1132 | |
| 1133 | cc_prebuilt_library_shared { |
Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 1134 | name: "mynativelib", |
| 1135 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1136 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1137 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 1138 | stl: "none", |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 1139 | compile_multilib: "both", |
Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 1140 | shared_libs: [ |
| 1141 | "myothernativelib", |
| 1142 | "libc", |
| 1143 | ], |
| 1144 | arch: { |
| 1145 | arm64: { |
| 1146 | srcs: ["arm64/lib/mynativelib.so"], |
| 1147 | }, |
| 1148 | arm: { |
| 1149 | srcs: ["arm/lib/mynativelib.so"], |
| 1150 | }, |
| 1151 | }, |
Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 1152 | } |
| 1153 | |
| 1154 | cc_prebuilt_library_shared { |
Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 1155 | name: "myothernativelib", |
| 1156 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1157 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1158 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 1159 | stl: "none", |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 1160 | compile_multilib: "both", |
Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 1161 | system_shared_libs: ["libm"], |
| 1162 | arch: { |
| 1163 | arm64: { |
| 1164 | srcs: ["arm64/lib/myothernativelib.so"], |
| 1165 | }, |
| 1166 | arm: { |
| 1167 | srcs: ["arm/lib/myothernativelib.so"], |
| 1168 | }, |
| 1169 | }, |
Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 1170 | } |
| 1171 | |
| 1172 | cc_prebuilt_library_shared { |
Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 1173 | name: "mysystemnativelib", |
| 1174 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1175 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1176 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 1177 | stl: "none", |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 1178 | compile_multilib: "both", |
Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 1179 | arch: { |
| 1180 | arm64: { |
| 1181 | srcs: ["arm64/lib/mysystemnativelib.so"], |
| 1182 | }, |
| 1183 | arm: { |
| 1184 | srcs: ["arm/lib/mysystemnativelib.so"], |
| 1185 | }, |
| 1186 | }, |
Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 1187 | } |
Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 1188 | `), |
| 1189 | checkAllCopyRules(` |
| 1190 | .intermediates/mynativelib/android_arm64_armv8-a_shared/mynativelib.so -> arm64/lib/mynativelib.so |
| 1191 | .intermediates/mynativelib/android_arm_armv7-a-neon_shared/mynativelib.so -> arm/lib/mynativelib.so |
| 1192 | .intermediates/myothernativelib/android_arm64_armv8-a_shared/myothernativelib.so -> arm64/lib/myothernativelib.so |
| 1193 | .intermediates/myothernativelib/android_arm_armv7-a-neon_shared/myothernativelib.so -> arm/lib/myothernativelib.so |
| 1194 | .intermediates/mysystemnativelib/android_arm64_armv8-a_shared/mysystemnativelib.so -> arm64/lib/mysystemnativelib.so |
| 1195 | .intermediates/mysystemnativelib/android_arm_armv7-a-neon_shared/mysystemnativelib.so -> arm/lib/mysystemnativelib.so |
| 1196 | `), |
| 1197 | ) |
| 1198 | } |
| 1199 | |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1200 | func TestHostSnapshotWithCcSharedLibrary(t *testing.T) { |
Paul Duffin | d835daa | 2019-11-30 17:49:09 +0000 | [diff] [blame] | 1201 | result := testSdkWithCc(t, ` |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 1202 | sdk { |
| 1203 | name: "mysdk", |
| 1204 | device_supported: false, |
| 1205 | host_supported: true, |
| 1206 | native_shared_libs: ["mynativelib"], |
| 1207 | } |
| 1208 | |
| 1209 | cc_library_shared { |
| 1210 | name: "mynativelib", |
| 1211 | device_supported: false, |
| 1212 | host_supported: true, |
| 1213 | srcs: [ |
| 1214 | "Test.cpp", |
| 1215 | "aidl/foo/bar/Test.aidl", |
| 1216 | ], |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1217 | export_include_dirs: ["myinclude"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 1218 | aidl: { |
| 1219 | export_aidl_headers: true, |
| 1220 | }, |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 1221 | stl: "none", |
Paul Duffin | 0c394f3 | 2020-03-05 14:09:58 +0000 | [diff] [blame] | 1222 | sdk_version: "minimum", |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 1223 | } |
| 1224 | `) |
| 1225 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 1226 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1227 | checkUnversionedAndroidBpContents(` |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 1228 | // This is auto-generated. DO NOT EDIT. |
| 1229 | |
| 1230 | cc_prebuilt_library_shared { |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1231 | name: "mynativelib", |
| 1232 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1233 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1234 | apex_available: ["//apex_available:platform"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 1235 | device_supported: false, |
| 1236 | host_supported: true, |
Paul Duffin | 0c394f3 | 2020-03-05 14:09:58 +0000 | [diff] [blame] | 1237 | sdk_version: "minimum", |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 1238 | stl: "none", |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 1239 | compile_multilib: "both", |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1240 | export_include_dirs: ["include/myinclude"], |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1241 | target: { |
| 1242 | host: { |
| 1243 | enabled: false, |
| 1244 | }, |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1245 | linux_glibc_x86_64: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 1246 | enabled: true, |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 1247 | srcs: ["x86_64/lib/mynativelib.so"], |
Paul Duffin | 42dd4e6 | 2021-02-22 11:35:24 +0000 | [diff] [blame] | 1248 | export_include_dirs: ["x86_64/include_gen/mynativelib/linux_glibc_x86_64_shared/gen/aidl"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 1249 | }, |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1250 | linux_glibc_x86: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 1251 | enabled: true, |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 1252 | srcs: ["x86/lib/mynativelib.so"], |
Paul Duffin | 42dd4e6 | 2021-02-22 11:35:24 +0000 | [diff] [blame] | 1253 | export_include_dirs: ["x86/include_gen/mynativelib/linux_glibc_x86_shared/gen/aidl"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 1254 | }, |
| 1255 | }, |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 1256 | } |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1257 | `), |
| 1258 | checkVersionedAndroidBpContents(` |
| 1259 | // This is auto-generated. DO NOT EDIT. |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 1260 | |
| 1261 | cc_prebuilt_library_shared { |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1262 | name: "mysdk_mynativelib@current", |
| 1263 | sdk_member_name: "mynativelib", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1264 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1265 | apex_available: ["//apex_available:platform"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 1266 | device_supported: false, |
| 1267 | host_supported: true, |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1268 | installable: false, |
Paul Duffin | 0c394f3 | 2020-03-05 14:09:58 +0000 | [diff] [blame] | 1269 | sdk_version: "minimum", |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 1270 | stl: "none", |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 1271 | compile_multilib: "both", |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1272 | export_include_dirs: ["include/myinclude"], |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1273 | target: { |
| 1274 | host: { |
| 1275 | enabled: false, |
| 1276 | }, |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1277 | linux_glibc_x86_64: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 1278 | enabled: true, |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 1279 | srcs: ["x86_64/lib/mynativelib.so"], |
Paul Duffin | 42dd4e6 | 2021-02-22 11:35:24 +0000 | [diff] [blame] | 1280 | export_include_dirs: ["x86_64/include_gen/mynativelib/linux_glibc_x86_64_shared/gen/aidl"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 1281 | }, |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1282 | linux_glibc_x86: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 1283 | enabled: true, |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 1284 | srcs: ["x86/lib/mynativelib.so"], |
Paul Duffin | 42dd4e6 | 2021-02-22 11:35:24 +0000 | [diff] [blame] | 1285 | export_include_dirs: ["x86/include_gen/mynativelib/linux_glibc_x86_shared/gen/aidl"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 1286 | }, |
| 1287 | }, |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 1288 | } |
| 1289 | |
| 1290 | sdk_snapshot { |
| 1291 | name: "mysdk@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1292 | visibility: ["//visibility:public"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 1293 | device_supported: false, |
| 1294 | host_supported: true, |
| 1295 | native_shared_libs: ["mysdk_mynativelib@current"], |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1296 | target: { |
| 1297 | host: { |
| 1298 | enabled: false, |
| 1299 | }, |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 1300 | linux_glibc_x86_64: { |
| 1301 | enabled: true, |
| 1302 | }, |
| 1303 | linux_glibc_x86: { |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1304 | enabled: true, |
| 1305 | }, |
| 1306 | }, |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 1307 | } |
| 1308 | `), |
| 1309 | checkAllCopyRules(` |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1310 | myinclude/Test.h -> include/myinclude/Test.h |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 1311 | .intermediates/mynativelib/linux_glibc_x86_64_shared/mynativelib.so -> x86_64/lib/mynativelib.so |
Paul Duffin | 42dd4e6 | 2021-02-22 11:35:24 +0000 | [diff] [blame] | 1312 | .intermediates/mynativelib/linux_glibc_x86_64_shared/gen/aidl/aidl/foo/bar/Test.h -> x86_64/include_gen/mynativelib/linux_glibc_x86_64_shared/gen/aidl/aidl/foo/bar/Test.h |
| 1313 | .intermediates/mynativelib/linux_glibc_x86_64_shared/gen/aidl/aidl/foo/bar/BnTest.h -> x86_64/include_gen/mynativelib/linux_glibc_x86_64_shared/gen/aidl/aidl/foo/bar/BnTest.h |
| 1314 | .intermediates/mynativelib/linux_glibc_x86_64_shared/gen/aidl/aidl/foo/bar/BpTest.h -> x86_64/include_gen/mynativelib/linux_glibc_x86_64_shared/gen/aidl/aidl/foo/bar/BpTest.h |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 1315 | .intermediates/mynativelib/linux_glibc_x86_shared/mynativelib.so -> x86/lib/mynativelib.so |
Paul Duffin | 42dd4e6 | 2021-02-22 11:35:24 +0000 | [diff] [blame] | 1316 | .intermediates/mynativelib/linux_glibc_x86_shared/gen/aidl/aidl/foo/bar/Test.h -> x86/include_gen/mynativelib/linux_glibc_x86_shared/gen/aidl/aidl/foo/bar/Test.h |
| 1317 | .intermediates/mynativelib/linux_glibc_x86_shared/gen/aidl/aidl/foo/bar/BnTest.h -> x86/include_gen/mynativelib/linux_glibc_x86_shared/gen/aidl/aidl/foo/bar/BnTest.h |
| 1318 | .intermediates/mynativelib/linux_glibc_x86_shared/gen/aidl/aidl/foo/bar/BpTest.h -> x86/include_gen/mynativelib/linux_glibc_x86_shared/gen/aidl/aidl/foo/bar/BpTest.h |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 1319 | `), |
| 1320 | ) |
| 1321 | } |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1322 | |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1323 | func TestMultipleHostOsTypesSnapshotWithCcSharedLibrary(t *testing.T) { |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1324 | result := testSdkWithCc(t, ` |
| 1325 | sdk { |
| 1326 | name: "mysdk", |
| 1327 | device_supported: false, |
| 1328 | host_supported: true, |
| 1329 | native_shared_libs: ["mynativelib"], |
| 1330 | target: { |
| 1331 | windows: { |
| 1332 | enabled: true, |
| 1333 | }, |
| 1334 | }, |
| 1335 | } |
| 1336 | |
| 1337 | cc_library_shared { |
| 1338 | name: "mynativelib", |
| 1339 | device_supported: false, |
| 1340 | host_supported: true, |
| 1341 | srcs: [ |
| 1342 | "Test.cpp", |
| 1343 | ], |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1344 | stl: "none", |
| 1345 | target: { |
| 1346 | windows: { |
| 1347 | enabled: true, |
| 1348 | }, |
| 1349 | }, |
| 1350 | } |
| 1351 | `) |
| 1352 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 1353 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1354 | checkUnversionedAndroidBpContents(` |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1355 | // This is auto-generated. DO NOT EDIT. |
| 1356 | |
| 1357 | cc_prebuilt_library_shared { |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1358 | name: "mynativelib", |
| 1359 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1360 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1361 | apex_available: ["//apex_available:platform"], |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1362 | device_supported: false, |
| 1363 | host_supported: true, |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 1364 | stl: "none", |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1365 | target: { |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1366 | host: { |
| 1367 | enabled: false, |
| 1368 | }, |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 1369 | linux_glibc: { |
| 1370 | compile_multilib: "both", |
| 1371 | }, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1372 | linux_glibc_x86_64: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 1373 | enabled: true, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1374 | srcs: ["linux_glibc/x86_64/lib/mynativelib.so"], |
| 1375 | }, |
| 1376 | linux_glibc_x86: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 1377 | enabled: true, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1378 | srcs: ["linux_glibc/x86/lib/mynativelib.so"], |
| 1379 | }, |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 1380 | windows: { |
| 1381 | compile_multilib: "64", |
| 1382 | }, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1383 | windows_x86_64: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 1384 | enabled: true, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1385 | srcs: ["windows/x86_64/lib/mynativelib.dll"], |
| 1386 | }, |
| 1387 | }, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1388 | } |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1389 | `), |
| 1390 | checkVersionedAndroidBpContents(` |
| 1391 | // This is auto-generated. DO NOT EDIT. |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1392 | |
| 1393 | cc_prebuilt_library_shared { |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1394 | name: "mysdk_mynativelib@current", |
| 1395 | sdk_member_name: "mynativelib", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1396 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1397 | apex_available: ["//apex_available:platform"], |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1398 | device_supported: false, |
| 1399 | host_supported: true, |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1400 | installable: false, |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 1401 | stl: "none", |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1402 | target: { |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1403 | host: { |
| 1404 | enabled: false, |
| 1405 | }, |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 1406 | linux_glibc: { |
| 1407 | compile_multilib: "both", |
| 1408 | }, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1409 | linux_glibc_x86_64: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 1410 | enabled: true, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1411 | srcs: ["linux_glibc/x86_64/lib/mynativelib.so"], |
| 1412 | }, |
| 1413 | linux_glibc_x86: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 1414 | enabled: true, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1415 | srcs: ["linux_glibc/x86/lib/mynativelib.so"], |
| 1416 | }, |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 1417 | windows: { |
| 1418 | compile_multilib: "64", |
| 1419 | }, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1420 | windows_x86_64: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 1421 | enabled: true, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1422 | srcs: ["windows/x86_64/lib/mynativelib.dll"], |
| 1423 | }, |
| 1424 | }, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1425 | } |
| 1426 | |
| 1427 | sdk_snapshot { |
| 1428 | name: "mysdk@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1429 | visibility: ["//visibility:public"], |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1430 | device_supported: false, |
| 1431 | host_supported: true, |
| 1432 | native_shared_libs: ["mysdk_mynativelib@current"], |
Paul Duffin | 6a7e953 | 2020-03-20 17:50:07 +0000 | [diff] [blame] | 1433 | target: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 1434 | windows: { |
| 1435 | compile_multilib: "64", |
| 1436 | }, |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1437 | host: { |
| 1438 | enabled: false, |
| 1439 | }, |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 1440 | linux_glibc_x86_64: { |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1441 | enabled: true, |
| 1442 | }, |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 1443 | linux_glibc_x86: { |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1444 | enabled: true, |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 1445 | }, |
| 1446 | windows_x86_64: { |
| 1447 | enabled: true, |
Paul Duffin | 6a7e953 | 2020-03-20 17:50:07 +0000 | [diff] [blame] | 1448 | }, |
| 1449 | }, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1450 | } |
| 1451 | `), |
| 1452 | checkAllCopyRules(` |
| 1453 | .intermediates/mynativelib/linux_glibc_x86_64_shared/mynativelib.so -> linux_glibc/x86_64/lib/mynativelib.so |
| 1454 | .intermediates/mynativelib/linux_glibc_x86_shared/mynativelib.so -> linux_glibc/x86/lib/mynativelib.so |
| 1455 | .intermediates/mynativelib/windows_x86_64_shared/mynativelib.dll -> windows/x86_64/lib/mynativelib.dll |
| 1456 | `), |
| 1457 | ) |
| 1458 | } |
| 1459 | |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1460 | func TestSnapshotWithCcStaticLibrary(t *testing.T) { |
| 1461 | result := testSdkWithCc(t, ` |
Paul Duffin | e602918 | 2019-12-16 17:43:48 +0000 | [diff] [blame] | 1462 | module_exports { |
| 1463 | name: "myexports", |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1464 | native_static_libs: ["mynativelib"], |
| 1465 | } |
| 1466 | |
| 1467 | cc_library_static { |
| 1468 | name: "mynativelib", |
| 1469 | srcs: [ |
| 1470 | "Test.cpp", |
| 1471 | "aidl/foo/bar/Test.aidl", |
| 1472 | ], |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1473 | export_include_dirs: ["myinclude"], |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1474 | aidl: { |
| 1475 | export_aidl_headers: true, |
| 1476 | }, |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1477 | stl: "none", |
| 1478 | } |
| 1479 | `) |
| 1480 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 1481 | CheckSnapshot(t, result, "myexports", "", |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1482 | checkUnversionedAndroidBpContents(` |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1483 | // This is auto-generated. DO NOT EDIT. |
| 1484 | |
| 1485 | cc_prebuilt_library_static { |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1486 | name: "mynativelib", |
| 1487 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1488 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1489 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 1490 | stl: "none", |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 1491 | compile_multilib: "both", |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1492 | export_include_dirs: ["include/myinclude"], |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1493 | arch: { |
| 1494 | arm64: { |
| 1495 | srcs: ["arm64/lib/mynativelib.a"], |
Paul Duffin | 42dd4e6 | 2021-02-22 11:35:24 +0000 | [diff] [blame] | 1496 | export_include_dirs: ["arm64/include_gen/mynativelib/android_arm64_armv8-a_static/gen/aidl"], |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1497 | }, |
| 1498 | arm: { |
| 1499 | srcs: ["arm/lib/mynativelib.a"], |
Paul Duffin | 42dd4e6 | 2021-02-22 11:35:24 +0000 | [diff] [blame] | 1500 | export_include_dirs: ["arm/include_gen/mynativelib/android_arm_armv7-a-neon_static/gen/aidl"], |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1501 | }, |
| 1502 | }, |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1503 | } |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1504 | `), |
| 1505 | checkAllCopyRules(` |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1506 | myinclude/Test.h -> include/myinclude/Test.h |
Colin Cross | 7113d20 | 2019-11-20 16:39:12 -0800 | [diff] [blame] | 1507 | .intermediates/mynativelib/android_arm64_armv8-a_static/mynativelib.a -> arm64/lib/mynativelib.a |
Paul Duffin | 42dd4e6 | 2021-02-22 11:35:24 +0000 | [diff] [blame] | 1508 | .intermediates/mynativelib/android_arm64_armv8-a_static/gen/aidl/aidl/foo/bar/Test.h -> arm64/include_gen/mynativelib/android_arm64_armv8-a_static/gen/aidl/aidl/foo/bar/Test.h |
| 1509 | .intermediates/mynativelib/android_arm64_armv8-a_static/gen/aidl/aidl/foo/bar/BnTest.h -> arm64/include_gen/mynativelib/android_arm64_armv8-a_static/gen/aidl/aidl/foo/bar/BnTest.h |
| 1510 | .intermediates/mynativelib/android_arm64_armv8-a_static/gen/aidl/aidl/foo/bar/BpTest.h -> arm64/include_gen/mynativelib/android_arm64_armv8-a_static/gen/aidl/aidl/foo/bar/BpTest.h |
Colin Cross | 7113d20 | 2019-11-20 16:39:12 -0800 | [diff] [blame] | 1511 | .intermediates/mynativelib/android_arm_armv7-a-neon_static/mynativelib.a -> arm/lib/mynativelib.a |
Paul Duffin | 42dd4e6 | 2021-02-22 11:35:24 +0000 | [diff] [blame] | 1512 | .intermediates/mynativelib/android_arm_armv7-a-neon_static/gen/aidl/aidl/foo/bar/Test.h -> arm/include_gen/mynativelib/android_arm_armv7-a-neon_static/gen/aidl/aidl/foo/bar/Test.h |
| 1513 | .intermediates/mynativelib/android_arm_armv7-a-neon_static/gen/aidl/aidl/foo/bar/BnTest.h -> arm/include_gen/mynativelib/android_arm_armv7-a-neon_static/gen/aidl/aidl/foo/bar/BnTest.h |
| 1514 | .intermediates/mynativelib/android_arm_armv7-a-neon_static/gen/aidl/aidl/foo/bar/BpTest.h -> arm/include_gen/mynativelib/android_arm_armv7-a-neon_static/gen/aidl/aidl/foo/bar/BpTest.h |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1515 | `), |
| 1516 | ) |
| 1517 | } |
| 1518 | |
| 1519 | func TestHostSnapshotWithCcStaticLibrary(t *testing.T) { |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1520 | result := testSdkWithCc(t, ` |
Paul Duffin | e602918 | 2019-12-16 17:43:48 +0000 | [diff] [blame] | 1521 | module_exports { |
| 1522 | name: "myexports", |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1523 | device_supported: false, |
| 1524 | host_supported: true, |
| 1525 | native_static_libs: ["mynativelib"], |
| 1526 | } |
| 1527 | |
| 1528 | cc_library_static { |
| 1529 | name: "mynativelib", |
| 1530 | device_supported: false, |
| 1531 | host_supported: true, |
| 1532 | srcs: [ |
| 1533 | "Test.cpp", |
| 1534 | "aidl/foo/bar/Test.aidl", |
| 1535 | ], |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1536 | export_include_dirs: ["myinclude"], |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1537 | aidl: { |
| 1538 | export_aidl_headers: true, |
| 1539 | }, |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1540 | stl: "none", |
| 1541 | } |
| 1542 | `) |
| 1543 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 1544 | CheckSnapshot(t, result, "myexports", "", |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1545 | checkUnversionedAndroidBpContents(` |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1546 | // This is auto-generated. DO NOT EDIT. |
| 1547 | |
| 1548 | cc_prebuilt_library_static { |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1549 | name: "mynativelib", |
| 1550 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1551 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1552 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1553 | device_supported: false, |
| 1554 | host_supported: true, |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 1555 | stl: "none", |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 1556 | compile_multilib: "both", |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1557 | export_include_dirs: ["include/myinclude"], |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1558 | target: { |
| 1559 | host: { |
| 1560 | enabled: false, |
| 1561 | }, |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1562 | linux_glibc_x86_64: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 1563 | enabled: true, |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1564 | srcs: ["x86_64/lib/mynativelib.a"], |
Paul Duffin | 42dd4e6 | 2021-02-22 11:35:24 +0000 | [diff] [blame] | 1565 | export_include_dirs: ["x86_64/include_gen/mynativelib/linux_glibc_x86_64_static/gen/aidl"], |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1566 | }, |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1567 | linux_glibc_x86: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 1568 | enabled: true, |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1569 | srcs: ["x86/lib/mynativelib.a"], |
Paul Duffin | 42dd4e6 | 2021-02-22 11:35:24 +0000 | [diff] [blame] | 1570 | export_include_dirs: ["x86/include_gen/mynativelib/linux_glibc_x86_static/gen/aidl"], |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1571 | }, |
| 1572 | }, |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1573 | } |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1574 | `), |
| 1575 | checkVersionedAndroidBpContents(` |
| 1576 | // This is auto-generated. DO NOT EDIT. |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1577 | |
| 1578 | cc_prebuilt_library_static { |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1579 | name: "myexports_mynativelib@current", |
| 1580 | sdk_member_name: "mynativelib", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1581 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1582 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1583 | device_supported: false, |
| 1584 | host_supported: true, |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1585 | installable: false, |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 1586 | stl: "none", |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 1587 | compile_multilib: "both", |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1588 | export_include_dirs: ["include/myinclude"], |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1589 | target: { |
| 1590 | host: { |
| 1591 | enabled: false, |
| 1592 | }, |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1593 | linux_glibc_x86_64: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 1594 | enabled: true, |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1595 | srcs: ["x86_64/lib/mynativelib.a"], |
Paul Duffin | 42dd4e6 | 2021-02-22 11:35:24 +0000 | [diff] [blame] | 1596 | export_include_dirs: ["x86_64/include_gen/mynativelib/linux_glibc_x86_64_static/gen/aidl"], |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1597 | }, |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1598 | linux_glibc_x86: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 1599 | enabled: true, |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1600 | srcs: ["x86/lib/mynativelib.a"], |
Paul Duffin | 42dd4e6 | 2021-02-22 11:35:24 +0000 | [diff] [blame] | 1601 | export_include_dirs: ["x86/include_gen/mynativelib/linux_glibc_x86_static/gen/aidl"], |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1602 | }, |
| 1603 | }, |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1604 | } |
| 1605 | |
Paul Duffin | e602918 | 2019-12-16 17:43:48 +0000 | [diff] [blame] | 1606 | module_exports_snapshot { |
| 1607 | name: "myexports@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1608 | visibility: ["//visibility:public"], |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1609 | device_supported: false, |
| 1610 | host_supported: true, |
Paul Duffin | e602918 | 2019-12-16 17:43:48 +0000 | [diff] [blame] | 1611 | native_static_libs: ["myexports_mynativelib@current"], |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1612 | target: { |
| 1613 | host: { |
| 1614 | enabled: false, |
| 1615 | }, |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 1616 | linux_glibc_x86_64: { |
| 1617 | enabled: true, |
| 1618 | }, |
| 1619 | linux_glibc_x86: { |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1620 | enabled: true, |
| 1621 | }, |
| 1622 | }, |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1623 | } |
| 1624 | `), |
| 1625 | checkAllCopyRules(` |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1626 | myinclude/Test.h -> include/myinclude/Test.h |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1627 | .intermediates/mynativelib/linux_glibc_x86_64_static/mynativelib.a -> x86_64/lib/mynativelib.a |
Paul Duffin | 42dd4e6 | 2021-02-22 11:35:24 +0000 | [diff] [blame] | 1628 | .intermediates/mynativelib/linux_glibc_x86_64_static/gen/aidl/aidl/foo/bar/Test.h -> x86_64/include_gen/mynativelib/linux_glibc_x86_64_static/gen/aidl/aidl/foo/bar/Test.h |
| 1629 | .intermediates/mynativelib/linux_glibc_x86_64_static/gen/aidl/aidl/foo/bar/BnTest.h -> x86_64/include_gen/mynativelib/linux_glibc_x86_64_static/gen/aidl/aidl/foo/bar/BnTest.h |
| 1630 | .intermediates/mynativelib/linux_glibc_x86_64_static/gen/aidl/aidl/foo/bar/BpTest.h -> x86_64/include_gen/mynativelib/linux_glibc_x86_64_static/gen/aidl/aidl/foo/bar/BpTest.h |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1631 | .intermediates/mynativelib/linux_glibc_x86_static/mynativelib.a -> x86/lib/mynativelib.a |
Paul Duffin | 42dd4e6 | 2021-02-22 11:35:24 +0000 | [diff] [blame] | 1632 | .intermediates/mynativelib/linux_glibc_x86_static/gen/aidl/aidl/foo/bar/Test.h -> x86/include_gen/mynativelib/linux_glibc_x86_static/gen/aidl/aidl/foo/bar/Test.h |
| 1633 | .intermediates/mynativelib/linux_glibc_x86_static/gen/aidl/aidl/foo/bar/BnTest.h -> x86/include_gen/mynativelib/linux_glibc_x86_static/gen/aidl/aidl/foo/bar/BnTest.h |
| 1634 | .intermediates/mynativelib/linux_glibc_x86_static/gen/aidl/aidl/foo/bar/BpTest.h -> x86/include_gen/mynativelib/linux_glibc_x86_static/gen/aidl/aidl/foo/bar/BpTest.h |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1635 | `), |
| 1636 | ) |
| 1637 | } |
Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1638 | |
Paul Duffin | 9b76c0b | 2020-03-12 10:24:35 +0000 | [diff] [blame] | 1639 | func TestSnapshotWithCcLibrary(t *testing.T) { |
| 1640 | result := testSdkWithCc(t, ` |
| 1641 | module_exports { |
| 1642 | name: "myexports", |
| 1643 | native_libs: ["mynativelib"], |
| 1644 | } |
| 1645 | |
| 1646 | cc_library { |
| 1647 | name: "mynativelib", |
| 1648 | srcs: [ |
| 1649 | "Test.cpp", |
| 1650 | ], |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1651 | export_include_dirs: ["myinclude"], |
Paul Duffin | 9b76c0b | 2020-03-12 10:24:35 +0000 | [diff] [blame] | 1652 | stl: "none", |
Paul Duffin | d6abaa7 | 2020-09-07 16:39:22 +0100 | [diff] [blame] | 1653 | recovery_available: true, |
Paul Duffin | d1edbd4 | 2020-08-13 19:45:31 +0100 | [diff] [blame] | 1654 | vendor_available: true, |
Paul Duffin | 9b76c0b | 2020-03-12 10:24:35 +0000 | [diff] [blame] | 1655 | } |
| 1656 | `) |
| 1657 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 1658 | CheckSnapshot(t, result, "myexports", "", |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1659 | checkUnversionedAndroidBpContents(` |
Paul Duffin | 9b76c0b | 2020-03-12 10:24:35 +0000 | [diff] [blame] | 1660 | // This is auto-generated. DO NOT EDIT. |
| 1661 | |
| 1662 | cc_prebuilt_library { |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1663 | name: "mynativelib", |
| 1664 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1665 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1666 | apex_available: ["//apex_available:platform"], |
Paul Duffin | d1edbd4 | 2020-08-13 19:45:31 +0100 | [diff] [blame] | 1667 | vendor_available: true, |
Paul Duffin | 9b76c0b | 2020-03-12 10:24:35 +0000 | [diff] [blame] | 1668 | stl: "none", |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 1669 | compile_multilib: "both", |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1670 | export_include_dirs: ["include/myinclude"], |
Paul Duffin | 9b76c0b | 2020-03-12 10:24:35 +0000 | [diff] [blame] | 1671 | arch: { |
| 1672 | arm64: { |
| 1673 | static: { |
| 1674 | srcs: ["arm64/lib/mynativelib.a"], |
| 1675 | }, |
| 1676 | shared: { |
| 1677 | srcs: ["arm64/lib/mynativelib.so"], |
| 1678 | }, |
| 1679 | }, |
| 1680 | arm: { |
| 1681 | static: { |
| 1682 | srcs: ["arm/lib/mynativelib.a"], |
| 1683 | }, |
| 1684 | shared: { |
| 1685 | srcs: ["arm/lib/mynativelib.so"], |
| 1686 | }, |
| 1687 | }, |
| 1688 | }, |
| 1689 | } |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1690 | `), |
| 1691 | // Make sure that the generated sdk_snapshot uses the native_libs property. |
| 1692 | checkVersionedAndroidBpContents(` |
| 1693 | // This is auto-generated. DO NOT EDIT. |
Paul Duffin | 9b76c0b | 2020-03-12 10:24:35 +0000 | [diff] [blame] | 1694 | |
| 1695 | cc_prebuilt_library { |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1696 | name: "myexports_mynativelib@current", |
| 1697 | sdk_member_name: "mynativelib", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1698 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1699 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1700 | installable: false, |
Paul Duffin | d1edbd4 | 2020-08-13 19:45:31 +0100 | [diff] [blame] | 1701 | vendor_available: true, |
Paul Duffin | 9b76c0b | 2020-03-12 10:24:35 +0000 | [diff] [blame] | 1702 | stl: "none", |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 1703 | compile_multilib: "both", |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1704 | export_include_dirs: ["include/myinclude"], |
Paul Duffin | 9b76c0b | 2020-03-12 10:24:35 +0000 | [diff] [blame] | 1705 | arch: { |
| 1706 | arm64: { |
| 1707 | static: { |
| 1708 | srcs: ["arm64/lib/mynativelib.a"], |
| 1709 | }, |
| 1710 | shared: { |
| 1711 | srcs: ["arm64/lib/mynativelib.so"], |
| 1712 | }, |
| 1713 | }, |
| 1714 | arm: { |
| 1715 | static: { |
| 1716 | srcs: ["arm/lib/mynativelib.a"], |
| 1717 | }, |
| 1718 | shared: { |
| 1719 | srcs: ["arm/lib/mynativelib.so"], |
| 1720 | }, |
| 1721 | }, |
| 1722 | }, |
| 1723 | } |
| 1724 | |
| 1725 | module_exports_snapshot { |
| 1726 | name: "myexports@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1727 | visibility: ["//visibility:public"], |
Paul Duffin | 9b76c0b | 2020-03-12 10:24:35 +0000 | [diff] [blame] | 1728 | native_libs: ["myexports_mynativelib@current"], |
| 1729 | } |
| 1730 | `), |
| 1731 | checkAllCopyRules(` |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1732 | myinclude/Test.h -> include/myinclude/Test.h |
Paul Duffin | 9b76c0b | 2020-03-12 10:24:35 +0000 | [diff] [blame] | 1733 | .intermediates/mynativelib/android_arm64_armv8-a_static/mynativelib.a -> arm64/lib/mynativelib.a |
| 1734 | .intermediates/mynativelib/android_arm64_armv8-a_shared/mynativelib.so -> arm64/lib/mynativelib.so |
| 1735 | .intermediates/mynativelib/android_arm_armv7-a-neon_static/mynativelib.a -> arm/lib/mynativelib.a |
Paul Duffin | 1822a0a | 2021-03-21 12:56:33 +0000 | [diff] [blame] | 1736 | .intermediates/mynativelib/android_arm_armv7-a-neon_shared/mynativelib.so -> arm/lib/mynativelib.so |
| 1737 | `), |
| 1738 | // TODO(b/183315522): Remove this and fix the issue. |
| 1739 | snapshotTestErrorHandler(checkSnapshotPreferredWithSource, android.FixtureExpectsAtLeastOneErrorMatchingPattern(`\Qunrecognized property "arch.arm.shared.export_include_dirs"\E`)), |
Paul Duffin | 9b76c0b | 2020-03-12 10:24:35 +0000 | [diff] [blame] | 1740 | ) |
| 1741 | } |
| 1742 | |
Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1743 | func TestHostSnapshotWithMultiLib64(t *testing.T) { |
Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1744 | result := testSdkWithCc(t, ` |
| 1745 | module_exports { |
| 1746 | name: "myexports", |
| 1747 | device_supported: false, |
| 1748 | host_supported: true, |
| 1749 | target: { |
| 1750 | host: { |
| 1751 | compile_multilib: "64", |
| 1752 | }, |
| 1753 | }, |
| 1754 | native_static_libs: ["mynativelib"], |
| 1755 | } |
| 1756 | |
| 1757 | cc_library_static { |
| 1758 | name: "mynativelib", |
| 1759 | device_supported: false, |
| 1760 | host_supported: true, |
| 1761 | srcs: [ |
| 1762 | "Test.cpp", |
| 1763 | "aidl/foo/bar/Test.aidl", |
| 1764 | ], |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1765 | export_include_dirs: ["myinclude"], |
Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1766 | aidl: { |
| 1767 | export_aidl_headers: true, |
| 1768 | }, |
Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1769 | stl: "none", |
| 1770 | } |
| 1771 | `) |
| 1772 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 1773 | CheckSnapshot(t, result, "myexports", "", |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1774 | checkUnversionedAndroidBpContents(` |
Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1775 | // This is auto-generated. DO NOT EDIT. |
| 1776 | |
| 1777 | cc_prebuilt_library_static { |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1778 | name: "mynativelib", |
| 1779 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1780 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1781 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1782 | device_supported: false, |
| 1783 | host_supported: true, |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 1784 | stl: "none", |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 1785 | compile_multilib: "64", |
Paul Duffin | 7a7d067 | 2021-02-17 12:17:40 +0000 | [diff] [blame] | 1786 | export_include_dirs: [ |
| 1787 | "include/myinclude", |
| 1788 | "include_gen/mynativelib/linux_glibc_x86_64_static/gen/aidl", |
| 1789 | ], |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1790 | target: { |
| 1791 | host: { |
| 1792 | enabled: false, |
| 1793 | }, |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1794 | linux_glibc_x86_64: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 1795 | enabled: true, |
Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1796 | srcs: ["x86_64/lib/mynativelib.a"], |
Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1797 | }, |
| 1798 | }, |
Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1799 | } |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1800 | `), |
| 1801 | checkVersionedAndroidBpContents(` |
| 1802 | // This is auto-generated. DO NOT EDIT. |
Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1803 | |
| 1804 | cc_prebuilt_library_static { |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1805 | name: "myexports_mynativelib@current", |
| 1806 | sdk_member_name: "mynativelib", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1807 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1808 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1809 | device_supported: false, |
| 1810 | host_supported: true, |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1811 | installable: false, |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 1812 | stl: "none", |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 1813 | compile_multilib: "64", |
Paul Duffin | 7a7d067 | 2021-02-17 12:17:40 +0000 | [diff] [blame] | 1814 | export_include_dirs: [ |
| 1815 | "include/myinclude", |
| 1816 | "include_gen/mynativelib/linux_glibc_x86_64_static/gen/aidl", |
| 1817 | ], |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1818 | target: { |
| 1819 | host: { |
| 1820 | enabled: false, |
| 1821 | }, |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1822 | linux_glibc_x86_64: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 1823 | enabled: true, |
Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1824 | srcs: ["x86_64/lib/mynativelib.a"], |
Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1825 | }, |
| 1826 | }, |
Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1827 | } |
| 1828 | |
| 1829 | module_exports_snapshot { |
| 1830 | name: "myexports@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1831 | visibility: ["//visibility:public"], |
Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1832 | device_supported: false, |
| 1833 | host_supported: true, |
Martin Stjernholm | 4cfa2c6 | 2020-07-10 19:55:36 +0100 | [diff] [blame] | 1834 | compile_multilib: "64", |
Paul Duffin | 7b0259f | 2021-04-24 11:34:46 +0100 | [diff] [blame] | 1835 | native_static_libs: ["myexports_mynativelib@current"], |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1836 | target: { |
| 1837 | host: { |
| 1838 | enabled: false, |
| 1839 | }, |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 1840 | linux_glibc_x86_64: { |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1841 | enabled: true, |
| 1842 | }, |
| 1843 | }, |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1844 | } |
| 1845 | `), |
Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1846 | checkAllCopyRules(` |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1847 | myinclude/Test.h -> include/myinclude/Test.h |
Paul Duffin | 7a7d067 | 2021-02-17 12:17:40 +0000 | [diff] [blame] | 1848 | .intermediates/mynativelib/linux_glibc_x86_64_static/gen/aidl/aidl/foo/bar/Test.h -> include_gen/mynativelib/linux_glibc_x86_64_static/gen/aidl/aidl/foo/bar/Test.h |
| 1849 | .intermediates/mynativelib/linux_glibc_x86_64_static/gen/aidl/aidl/foo/bar/BnTest.h -> include_gen/mynativelib/linux_glibc_x86_64_static/gen/aidl/aidl/foo/bar/BnTest.h |
| 1850 | .intermediates/mynativelib/linux_glibc_x86_64_static/gen/aidl/aidl/foo/bar/BpTest.h -> include_gen/mynativelib/linux_glibc_x86_64_static/gen/aidl/aidl/foo/bar/BpTest.h |
Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1851 | .intermediates/mynativelib/linux_glibc_x86_64_static/mynativelib.a -> x86_64/lib/mynativelib.a |
Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1852 | `), |
| 1853 | ) |
| 1854 | } |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1855 | |
| 1856 | func TestSnapshotWithCcHeadersLibrary(t *testing.T) { |
| 1857 | result := testSdkWithCc(t, ` |
| 1858 | sdk { |
| 1859 | name: "mysdk", |
| 1860 | native_header_libs: ["mynativeheaders"], |
| 1861 | } |
| 1862 | |
| 1863 | cc_library_headers { |
| 1864 | name: "mynativeheaders", |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1865 | export_include_dirs: ["myinclude"], |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1866 | stl: "none", |
| 1867 | } |
| 1868 | `) |
| 1869 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 1870 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1871 | checkUnversionedAndroidBpContents(` |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1872 | // This is auto-generated. DO NOT EDIT. |
| 1873 | |
| 1874 | cc_prebuilt_library_headers { |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1875 | name: "mynativeheaders", |
| 1876 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1877 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1878 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1879 | stl: "none", |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 1880 | compile_multilib: "both", |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1881 | export_include_dirs: ["include/myinclude"], |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1882 | } |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1883 | `), |
| 1884 | checkAllCopyRules(` |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1885 | myinclude/Test.h -> include/myinclude/Test.h |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1886 | `), |
| 1887 | ) |
| 1888 | } |
| 1889 | |
Paul Duffin | 93b750e | 2019-11-19 19:44:10 +0000 | [diff] [blame] | 1890 | func TestSnapshotWithCcHeadersLibraryAndNativeBridgeSupport(t *testing.T) { |
| 1891 | result := android.GroupFixturePreparers( |
| 1892 | cc.PrepareForTestWithCcDefaultModules, |
| 1893 | PrepareForTestWithSdkBuildComponents, |
| 1894 | ccTestFs.AddToFixture(), |
| 1895 | prepareForTestWithNativeBridgeTarget, |
| 1896 | ).RunTestWithBp(t, ` |
| 1897 | sdk { |
| 1898 | name: "mysdk", |
| 1899 | native_header_libs: ["mynativeheaders"], |
| 1900 | traits: { |
| 1901 | native_bridge_support: ["mynativeheaders"], |
| 1902 | }, |
| 1903 | } |
| 1904 | |
| 1905 | cc_library_headers { |
| 1906 | name: "mynativeheaders", |
| 1907 | export_include_dirs: ["myinclude"], |
| 1908 | stl: "none", |
| 1909 | system_shared_libs: [], |
| 1910 | native_bridge_supported: true, |
| 1911 | } |
| 1912 | `) |
| 1913 | |
| 1914 | CheckSnapshot(t, result, "mysdk", "", |
| 1915 | checkUnversionedAndroidBpContents(` |
| 1916 | // This is auto-generated. DO NOT EDIT. |
| 1917 | |
| 1918 | cc_prebuilt_library_headers { |
| 1919 | name: "mynativeheaders", |
| 1920 | prefer: false, |
| 1921 | visibility: ["//visibility:public"], |
| 1922 | apex_available: ["//apex_available:platform"], |
| 1923 | native_bridge_supported: true, |
| 1924 | stl: "none", |
| 1925 | compile_multilib: "both", |
| 1926 | system_shared_libs: [], |
| 1927 | export_include_dirs: ["include/myinclude"], |
| 1928 | } |
| 1929 | `), |
| 1930 | checkAllCopyRules(` |
| 1931 | myinclude/Test.h -> include/myinclude/Test.h |
| 1932 | `), |
| 1933 | ) |
| 1934 | } |
| 1935 | |
| 1936 | // TestSnapshotWithCcHeadersLibrary_DetectsNativeBridgeSpecificProperties verifies that when a |
| 1937 | // module that has different output files for a native bridge target requests the native bridge |
| 1938 | // variants are copied into the sdk snapshot that it reports an error. |
| 1939 | func TestSnapshotWithCcHeadersLibrary_DetectsNativeBridgeSpecificProperties(t *testing.T) { |
| 1940 | android.GroupFixturePreparers( |
| 1941 | cc.PrepareForTestWithCcDefaultModules, |
| 1942 | PrepareForTestWithSdkBuildComponents, |
| 1943 | ccTestFs.AddToFixture(), |
| 1944 | prepareForTestWithNativeBridgeTarget, |
| 1945 | ).ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern( |
| 1946 | `\QArchitecture variant "arm64_native_bridge" of sdk member "mynativeheaders" has properties distinct from other variants; this is not yet supported. The properties are: |
| 1947 | export_include_dirs: [ |
| 1948 | "arm64_native_bridge/include/myinclude_nativebridge", |
| 1949 | "arm64_native_bridge/include/myinclude", |
| 1950 | ],\E`)). |
| 1951 | RunTestWithBp(t, ` |
| 1952 | sdk { |
| 1953 | name: "mysdk", |
| 1954 | native_header_libs: ["mynativeheaders"], |
| 1955 | traits: { |
| 1956 | native_bridge_support: ["mynativeheaders"], |
| 1957 | }, |
| 1958 | } |
| 1959 | |
| 1960 | cc_library_headers { |
| 1961 | name: "mynativeheaders", |
| 1962 | export_include_dirs: ["myinclude"], |
| 1963 | stl: "none", |
| 1964 | system_shared_libs: [], |
| 1965 | native_bridge_supported: true, |
| 1966 | target: { |
| 1967 | native_bridge: { |
| 1968 | export_include_dirs: ["myinclude_nativebridge"], |
| 1969 | }, |
| 1970 | }, |
| 1971 | } |
| 1972 | `) |
| 1973 | } |
| 1974 | |
Paul Duffin | 6369622 | 2021-09-06 10:28:34 +0100 | [diff] [blame] | 1975 | func TestSnapshotWithCcHeadersLibraryAndImageVariants(t *testing.T) { |
| 1976 | testImageVariant := func(t *testing.T, property, trait string) { |
| 1977 | result := android.GroupFixturePreparers( |
| 1978 | cc.PrepareForTestWithCcDefaultModules, |
| 1979 | PrepareForTestWithSdkBuildComponents, |
| 1980 | ccTestFs.AddToFixture(), |
| 1981 | ).RunTestWithBp(t, fmt.Sprintf(` |
| 1982 | sdk { |
| 1983 | name: "mysdk", |
| 1984 | native_header_libs: ["mynativeheaders"], |
| 1985 | traits: { |
| 1986 | %s: ["mynativeheaders"], |
| 1987 | }, |
| 1988 | } |
| 1989 | |
| 1990 | cc_library_headers { |
| 1991 | name: "mynativeheaders", |
| 1992 | export_include_dirs: ["myinclude"], |
| 1993 | stl: "none", |
| 1994 | system_shared_libs: [], |
| 1995 | %s: true, |
| 1996 | } |
| 1997 | `, trait, property)) |
| 1998 | |
| 1999 | CheckSnapshot(t, result, "mysdk", "", |
| 2000 | checkUnversionedAndroidBpContents(fmt.Sprintf(` |
| 2001 | // This is auto-generated. DO NOT EDIT. |
| 2002 | |
| 2003 | cc_prebuilt_library_headers { |
| 2004 | name: "mynativeheaders", |
| 2005 | prefer: false, |
| 2006 | visibility: ["//visibility:public"], |
| 2007 | apex_available: ["//apex_available:platform"], |
| 2008 | %s: true, |
| 2009 | stl: "none", |
| 2010 | compile_multilib: "both", |
| 2011 | system_shared_libs: [], |
| 2012 | export_include_dirs: ["include/myinclude"], |
| 2013 | } |
| 2014 | `, property)), |
| 2015 | checkAllCopyRules(` |
| 2016 | myinclude/Test.h -> include/myinclude/Test.h |
| 2017 | `), |
| 2018 | ) |
| 2019 | } |
| 2020 | |
Paul Duffin | 12a0a31 | 2021-09-15 17:25:10 +0100 | [diff] [blame] | 2021 | t.Run("ramdisk", func(t *testing.T) { |
| 2022 | testImageVariant(t, "ramdisk_available", "ramdisk_image_required") |
| 2023 | }) |
| 2024 | |
Paul Duffin | 6369622 | 2021-09-06 10:28:34 +0100 | [diff] [blame] | 2025 | t.Run("recovery", func(t *testing.T) { |
| 2026 | testImageVariant(t, "recovery_available", "recovery_image_required") |
| 2027 | }) |
| 2028 | } |
| 2029 | |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 2030 | func TestHostSnapshotWithCcHeadersLibrary(t *testing.T) { |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 2031 | result := testSdkWithCc(t, ` |
| 2032 | sdk { |
| 2033 | name: "mysdk", |
| 2034 | device_supported: false, |
| 2035 | host_supported: true, |
| 2036 | native_header_libs: ["mynativeheaders"], |
| 2037 | } |
| 2038 | |
| 2039 | cc_library_headers { |
| 2040 | name: "mynativeheaders", |
| 2041 | device_supported: false, |
| 2042 | host_supported: true, |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 2043 | export_include_dirs: ["myinclude"], |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 2044 | stl: "none", |
| 2045 | } |
| 2046 | `) |
| 2047 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 2048 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 2049 | checkUnversionedAndroidBpContents(` |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 2050 | // This is auto-generated. DO NOT EDIT. |
| 2051 | |
| 2052 | cc_prebuilt_library_headers { |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 2053 | name: "mynativeheaders", |
| 2054 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 2055 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 2056 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 2057 | device_supported: false, |
| 2058 | host_supported: true, |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 2059 | stl: "none", |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 2060 | compile_multilib: "both", |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 2061 | export_include_dirs: ["include/myinclude"], |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 2062 | target: { |
| 2063 | host: { |
| 2064 | enabled: false, |
| 2065 | }, |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 2066 | linux_glibc_x86_64: { |
| 2067 | enabled: true, |
| 2068 | }, |
| 2069 | linux_glibc_x86: { |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 2070 | enabled: true, |
| 2071 | }, |
| 2072 | }, |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 2073 | } |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 2074 | `), |
| 2075 | checkVersionedAndroidBpContents(` |
| 2076 | // This is auto-generated. DO NOT EDIT. |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 2077 | |
| 2078 | cc_prebuilt_library_headers { |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 2079 | name: "mysdk_mynativeheaders@current", |
| 2080 | sdk_member_name: "mynativeheaders", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 2081 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 2082 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 2083 | device_supported: false, |
| 2084 | host_supported: true, |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 2085 | stl: "none", |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 2086 | compile_multilib: "both", |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 2087 | export_include_dirs: ["include/myinclude"], |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 2088 | target: { |
| 2089 | host: { |
| 2090 | enabled: false, |
| 2091 | }, |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 2092 | linux_glibc_x86_64: { |
| 2093 | enabled: true, |
| 2094 | }, |
| 2095 | linux_glibc_x86: { |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 2096 | enabled: true, |
| 2097 | }, |
| 2098 | }, |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 2099 | } |
| 2100 | |
| 2101 | sdk_snapshot { |
| 2102 | name: "mysdk@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 2103 | visibility: ["//visibility:public"], |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 2104 | device_supported: false, |
| 2105 | host_supported: true, |
| 2106 | native_header_libs: ["mysdk_mynativeheaders@current"], |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 2107 | target: { |
| 2108 | host: { |
| 2109 | enabled: false, |
| 2110 | }, |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 2111 | linux_glibc_x86_64: { |
| 2112 | enabled: true, |
| 2113 | }, |
| 2114 | linux_glibc_x86: { |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 2115 | enabled: true, |
| 2116 | }, |
| 2117 | }, |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 2118 | } |
| 2119 | `), |
| 2120 | checkAllCopyRules(` |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 2121 | myinclude/Test.h -> include/myinclude/Test.h |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 2122 | `), |
| 2123 | ) |
| 2124 | } |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 2125 | |
| 2126 | func TestDeviceAndHostSnapshotWithCcHeadersLibrary(t *testing.T) { |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 2127 | result := testSdkWithCc(t, ` |
| 2128 | sdk { |
| 2129 | name: "mysdk", |
| 2130 | host_supported: true, |
| 2131 | native_header_libs: ["mynativeheaders"], |
| 2132 | } |
| 2133 | |
| 2134 | cc_library_headers { |
| 2135 | name: "mynativeheaders", |
| 2136 | host_supported: true, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 2137 | stl: "none", |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 2138 | export_system_include_dirs: ["myinclude"], |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 2139 | target: { |
| 2140 | android: { |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 2141 | export_include_dirs: ["myinclude-android"], |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 2142 | }, |
| 2143 | host: { |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 2144 | export_include_dirs: ["myinclude-host"], |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 2145 | }, |
| 2146 | }, |
| 2147 | } |
| 2148 | `) |
| 2149 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 2150 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 2151 | checkUnversionedAndroidBpContents(` |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 2152 | // This is auto-generated. DO NOT EDIT. |
| 2153 | |
| 2154 | cc_prebuilt_library_headers { |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 2155 | name: "mynativeheaders", |
| 2156 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 2157 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 2158 | apex_available: ["//apex_available:platform"], |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 2159 | host_supported: true, |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 2160 | stl: "none", |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 2161 | compile_multilib: "both", |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 2162 | export_system_include_dirs: ["common_os/include/myinclude"], |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 2163 | target: { |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 2164 | host: { |
| 2165 | enabled: false, |
| 2166 | }, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 2167 | android: { |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 2168 | export_include_dirs: ["android/include/myinclude-android"], |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 2169 | }, |
| 2170 | linux_glibc: { |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 2171 | export_include_dirs: ["linux_glibc/include/myinclude-host"], |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 2172 | }, |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 2173 | linux_glibc_x86_64: { |
| 2174 | enabled: true, |
| 2175 | }, |
| 2176 | linux_glibc_x86: { |
| 2177 | enabled: true, |
| 2178 | }, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 2179 | }, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 2180 | } |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 2181 | `), |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 2182 | checkVersionedAndroidBpContents(` |
| 2183 | // This is auto-generated. DO NOT EDIT. |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 2184 | |
| 2185 | cc_prebuilt_library_headers { |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 2186 | name: "mysdk_mynativeheaders@current", |
| 2187 | sdk_member_name: "mynativeheaders", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 2188 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 2189 | apex_available: ["//apex_available:platform"], |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 2190 | host_supported: true, |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 2191 | stl: "none", |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 2192 | compile_multilib: "both", |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 2193 | export_system_include_dirs: ["common_os/include/myinclude"], |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 2194 | target: { |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 2195 | host: { |
| 2196 | enabled: false, |
| 2197 | }, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 2198 | android: { |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 2199 | export_include_dirs: ["android/include/myinclude-android"], |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 2200 | }, |
| 2201 | linux_glibc: { |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 2202 | export_include_dirs: ["linux_glibc/include/myinclude-host"], |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 2203 | }, |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 2204 | linux_glibc_x86_64: { |
| 2205 | enabled: true, |
| 2206 | }, |
| 2207 | linux_glibc_x86: { |
| 2208 | enabled: true, |
| 2209 | }, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 2210 | }, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 2211 | } |
| 2212 | |
| 2213 | sdk_snapshot { |
| 2214 | name: "mysdk@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 2215 | visibility: ["//visibility:public"], |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 2216 | host_supported: true, |
| 2217 | native_header_libs: ["mysdk_mynativeheaders@current"], |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 2218 | target: { |
| 2219 | host: { |
| 2220 | enabled: false, |
| 2221 | }, |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 2222 | linux_glibc_x86_64: { |
| 2223 | enabled: true, |
| 2224 | }, |
| 2225 | linux_glibc_x86: { |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 2226 | enabled: true, |
| 2227 | }, |
| 2228 | }, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 2229 | } |
| 2230 | `), |
| 2231 | checkAllCopyRules(` |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 2232 | myinclude/Test.h -> common_os/include/myinclude/Test.h |
| 2233 | myinclude-android/AndroidTest.h -> android/include/myinclude-android/AndroidTest.h |
| 2234 | myinclude-host/HostTest.h -> linux_glibc/include/myinclude-host/HostTest.h |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 2235 | `), |
| 2236 | ) |
| 2237 | } |
Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 2238 | |
| 2239 | func TestSystemSharedLibPropagation(t *testing.T) { |
| 2240 | result := testSdkWithCc(t, ` |
| 2241 | sdk { |
| 2242 | name: "mysdk", |
Colin Cross | 6b8f425 | 2021-07-22 11:39:44 -0700 | [diff] [blame] | 2243 | native_shared_libs: ["sslnil", "sslempty", "sslnonempty"], |
Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 2244 | } |
| 2245 | |
| 2246 | cc_library { |
| 2247 | name: "sslnil", |
| 2248 | host_supported: true, |
| 2249 | } |
| 2250 | |
| 2251 | cc_library { |
| 2252 | name: "sslempty", |
| 2253 | system_shared_libs: [], |
| 2254 | } |
| 2255 | |
| 2256 | cc_library { |
| 2257 | name: "sslnonempty", |
| 2258 | system_shared_libs: ["sslnil"], |
| 2259 | } |
| 2260 | `) |
| 2261 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 2262 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 2263 | checkUnversionedAndroidBpContents(` |
Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 2264 | // This is auto-generated. DO NOT EDIT. |
| 2265 | |
| 2266 | cc_prebuilt_library_shared { |
Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 2267 | name: "sslnil", |
| 2268 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 2269 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 2270 | apex_available: ["//apex_available:platform"], |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 2271 | compile_multilib: "both", |
Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 2272 | arch: { |
| 2273 | arm64: { |
| 2274 | srcs: ["arm64/lib/sslnil.so"], |
| 2275 | }, |
| 2276 | arm: { |
| 2277 | srcs: ["arm/lib/sslnil.so"], |
| 2278 | }, |
| 2279 | }, |
| 2280 | } |
| 2281 | |
| 2282 | cc_prebuilt_library_shared { |
Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 2283 | name: "sslempty", |
| 2284 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 2285 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 2286 | apex_available: ["//apex_available:platform"], |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 2287 | compile_multilib: "both", |
Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 2288 | system_shared_libs: [], |
| 2289 | arch: { |
| 2290 | arm64: { |
| 2291 | srcs: ["arm64/lib/sslempty.so"], |
| 2292 | }, |
| 2293 | arm: { |
| 2294 | srcs: ["arm/lib/sslempty.so"], |
| 2295 | }, |
| 2296 | }, |
| 2297 | } |
| 2298 | |
| 2299 | cc_prebuilt_library_shared { |
Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 2300 | name: "sslnonempty", |
| 2301 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 2302 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 2303 | apex_available: ["//apex_available:platform"], |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 2304 | compile_multilib: "both", |
Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 2305 | system_shared_libs: ["sslnil"], |
| 2306 | arch: { |
| 2307 | arm64: { |
| 2308 | srcs: ["arm64/lib/sslnonempty.so"], |
| 2309 | }, |
| 2310 | arm: { |
| 2311 | srcs: ["arm/lib/sslnonempty.so"], |
| 2312 | }, |
| 2313 | }, |
| 2314 | } |
Colin Cross | 6b8f425 | 2021-07-22 11:39:44 -0700 | [diff] [blame] | 2315 | `)) |
Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 2316 | |
| 2317 | result = testSdkWithCc(t, ` |
| 2318 | sdk { |
| 2319 | name: "mysdk", |
| 2320 | host_supported: true, |
Colin Cross | 6b8f425 | 2021-07-22 11:39:44 -0700 | [diff] [blame] | 2321 | native_shared_libs: ["sslvariants"], |
Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 2322 | } |
| 2323 | |
| 2324 | cc_library { |
| 2325 | name: "sslvariants", |
| 2326 | host_supported: true, |
| 2327 | target: { |
| 2328 | android: { |
| 2329 | system_shared_libs: [], |
| 2330 | }, |
| 2331 | }, |
| 2332 | } |
| 2333 | `) |
| 2334 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 2335 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 2336 | checkUnversionedAndroidBpContents(` |
Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 2337 | // This is auto-generated. DO NOT EDIT. |
| 2338 | |
| 2339 | cc_prebuilt_library_shared { |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 2340 | name: "sslvariants", |
| 2341 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 2342 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 2343 | apex_available: ["//apex_available:platform"], |
Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 2344 | host_supported: true, |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 2345 | compile_multilib: "both", |
Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 2346 | target: { |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 2347 | host: { |
| 2348 | enabled: false, |
| 2349 | }, |
Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 2350 | android: { |
| 2351 | system_shared_libs: [], |
| 2352 | }, |
| 2353 | android_arm64: { |
| 2354 | srcs: ["android/arm64/lib/sslvariants.so"], |
| 2355 | }, |
| 2356 | android_arm: { |
| 2357 | srcs: ["android/arm/lib/sslvariants.so"], |
| 2358 | }, |
| 2359 | linux_glibc_x86_64: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 2360 | enabled: true, |
Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 2361 | srcs: ["linux_glibc/x86_64/lib/sslvariants.so"], |
| 2362 | }, |
| 2363 | linux_glibc_x86: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 2364 | enabled: true, |
Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 2365 | srcs: ["linux_glibc/x86/lib/sslvariants.so"], |
| 2366 | }, |
| 2367 | }, |
| 2368 | } |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 2369 | `), |
| 2370 | checkVersionedAndroidBpContents(` |
| 2371 | // This is auto-generated. DO NOT EDIT. |
Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 2372 | |
| 2373 | cc_prebuilt_library_shared { |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 2374 | name: "mysdk_sslvariants@current", |
| 2375 | sdk_member_name: "sslvariants", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 2376 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 2377 | apex_available: ["//apex_available:platform"], |
Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 2378 | host_supported: true, |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 2379 | installable: false, |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 2380 | compile_multilib: "both", |
Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 2381 | target: { |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 2382 | host: { |
| 2383 | enabled: false, |
| 2384 | }, |
Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 2385 | android: { |
| 2386 | system_shared_libs: [], |
| 2387 | }, |
| 2388 | android_arm64: { |
| 2389 | srcs: ["android/arm64/lib/sslvariants.so"], |
| 2390 | }, |
| 2391 | android_arm: { |
| 2392 | srcs: ["android/arm/lib/sslvariants.so"], |
| 2393 | }, |
| 2394 | linux_glibc_x86_64: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 2395 | enabled: true, |
Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 2396 | srcs: ["linux_glibc/x86_64/lib/sslvariants.so"], |
| 2397 | }, |
| 2398 | linux_glibc_x86: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 2399 | enabled: true, |
Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 2400 | srcs: ["linux_glibc/x86/lib/sslvariants.so"], |
| 2401 | }, |
| 2402 | }, |
| 2403 | } |
| 2404 | |
| 2405 | sdk_snapshot { |
| 2406 | name: "mysdk@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 2407 | visibility: ["//visibility:public"], |
Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 2408 | host_supported: true, |
Colin Cross | 6b8f425 | 2021-07-22 11:39:44 -0700 | [diff] [blame] | 2409 | native_shared_libs: ["mysdk_sslvariants@current"], |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 2410 | target: { |
| 2411 | host: { |
| 2412 | enabled: false, |
| 2413 | }, |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 2414 | linux_glibc_x86_64: { |
| 2415 | enabled: true, |
| 2416 | }, |
| 2417 | linux_glibc_x86: { |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 2418 | enabled: true, |
| 2419 | }, |
| 2420 | }, |
Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 2421 | } |
| 2422 | `)) |
| 2423 | } |
Martin Stjernholm | c5dd4f7 | 2020-04-01 20:38:01 +0100 | [diff] [blame] | 2424 | |
| 2425 | func TestStubsLibrary(t *testing.T) { |
| 2426 | result := testSdkWithCc(t, ` |
| 2427 | sdk { |
| 2428 | name: "mysdk", |
| 2429 | native_shared_libs: ["stubslib"], |
| 2430 | } |
| 2431 | |
| 2432 | cc_library { |
Martin Stjernholm | cc330d6 | 2020-04-21 20:45:35 +0100 | [diff] [blame] | 2433 | name: "internaldep", |
| 2434 | } |
| 2435 | |
| 2436 | cc_library { |
Martin Stjernholm | c5dd4f7 | 2020-04-01 20:38:01 +0100 | [diff] [blame] | 2437 | name: "stubslib", |
Martin Stjernholm | cc330d6 | 2020-04-21 20:45:35 +0100 | [diff] [blame] | 2438 | shared_libs: ["internaldep"], |
Martin Stjernholm | c5dd4f7 | 2020-04-01 20:38:01 +0100 | [diff] [blame] | 2439 | stubs: { |
| 2440 | symbol_file: "some/where/stubslib.map.txt", |
| 2441 | versions: ["1", "2", "3"], |
| 2442 | }, |
| 2443 | } |
| 2444 | `) |
| 2445 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 2446 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 2447 | checkUnversionedAndroidBpContents(` |
Martin Stjernholm | c5dd4f7 | 2020-04-01 20:38:01 +0100 | [diff] [blame] | 2448 | // This is auto-generated. DO NOT EDIT. |
| 2449 | |
| 2450 | cc_prebuilt_library_shared { |
Martin Stjernholm | c5dd4f7 | 2020-04-01 20:38:01 +0100 | [diff] [blame] | 2451 | name: "stubslib", |
| 2452 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 2453 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 2454 | apex_available: ["//apex_available:platform"], |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 2455 | compile_multilib: "both", |
Martin Stjernholm | c5dd4f7 | 2020-04-01 20:38:01 +0100 | [diff] [blame] | 2456 | stubs: { |
Martin Stjernholm | 618b671 | 2020-09-24 16:53:04 +0100 | [diff] [blame] | 2457 | versions: [ |
| 2458 | "1", |
| 2459 | "2", |
| 2460 | "3", |
Jiyong Park | d4a3a13 | 2021-03-17 20:21:35 +0900 | [diff] [blame] | 2461 | "current", |
Martin Stjernholm | 618b671 | 2020-09-24 16:53:04 +0100 | [diff] [blame] | 2462 | ], |
Martin Stjernholm | c5dd4f7 | 2020-04-01 20:38:01 +0100 | [diff] [blame] | 2463 | }, |
| 2464 | arch: { |
| 2465 | arm64: { |
| 2466 | srcs: ["arm64/lib/stubslib.so"], |
| 2467 | }, |
| 2468 | arm: { |
| 2469 | srcs: ["arm/lib/stubslib.so"], |
| 2470 | }, |
| 2471 | }, |
| 2472 | } |
Martin Stjernholm | c5dd4f7 | 2020-04-01 20:38:01 +0100 | [diff] [blame] | 2473 | `)) |
| 2474 | } |
Paul Duffin | 7a1f7f3 | 2020-05-04 15:32:08 +0100 | [diff] [blame] | 2475 | |
| 2476 | func TestDeviceAndHostSnapshotWithStubsLibrary(t *testing.T) { |
Paul Duffin | 7a1f7f3 | 2020-05-04 15:32:08 +0100 | [diff] [blame] | 2477 | result := testSdkWithCc(t, ` |
| 2478 | sdk { |
| 2479 | name: "mysdk", |
| 2480 | host_supported: true, |
| 2481 | native_shared_libs: ["stubslib"], |
| 2482 | } |
| 2483 | |
| 2484 | cc_library { |
| 2485 | name: "internaldep", |
| 2486 | host_supported: true, |
| 2487 | } |
| 2488 | |
| 2489 | cc_library { |
| 2490 | name: "stubslib", |
| 2491 | host_supported: true, |
| 2492 | shared_libs: ["internaldep"], |
| 2493 | stubs: { |
| 2494 | symbol_file: "some/where/stubslib.map.txt", |
| 2495 | versions: ["1", "2", "3"], |
| 2496 | }, |
| 2497 | } |
| 2498 | `) |
| 2499 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 2500 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 2501 | checkUnversionedAndroidBpContents(` |
Paul Duffin | 7a1f7f3 | 2020-05-04 15:32:08 +0100 | [diff] [blame] | 2502 | // This is auto-generated. DO NOT EDIT. |
| 2503 | |
| 2504 | cc_prebuilt_library_shared { |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 2505 | name: "stubslib", |
| 2506 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 2507 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 2508 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 7a1f7f3 | 2020-05-04 15:32:08 +0100 | [diff] [blame] | 2509 | host_supported: true, |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 2510 | compile_multilib: "both", |
Paul Duffin | 7a1f7f3 | 2020-05-04 15:32:08 +0100 | [diff] [blame] | 2511 | stubs: { |
Martin Stjernholm | 618b671 | 2020-09-24 16:53:04 +0100 | [diff] [blame] | 2512 | versions: [ |
| 2513 | "1", |
| 2514 | "2", |
| 2515 | "3", |
Jiyong Park | d4a3a13 | 2021-03-17 20:21:35 +0900 | [diff] [blame] | 2516 | "current", |
Martin Stjernholm | 618b671 | 2020-09-24 16:53:04 +0100 | [diff] [blame] | 2517 | ], |
Paul Duffin | 7a1f7f3 | 2020-05-04 15:32:08 +0100 | [diff] [blame] | 2518 | }, |
| 2519 | target: { |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 2520 | host: { |
| 2521 | enabled: false, |
| 2522 | }, |
Paul Duffin | 7a1f7f3 | 2020-05-04 15:32:08 +0100 | [diff] [blame] | 2523 | android_arm64: { |
| 2524 | srcs: ["android/arm64/lib/stubslib.so"], |
| 2525 | }, |
| 2526 | android_arm: { |
| 2527 | srcs: ["android/arm/lib/stubslib.so"], |
| 2528 | }, |
| 2529 | linux_glibc_x86_64: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 2530 | enabled: true, |
Paul Duffin | 7a1f7f3 | 2020-05-04 15:32:08 +0100 | [diff] [blame] | 2531 | srcs: ["linux_glibc/x86_64/lib/stubslib.so"], |
| 2532 | }, |
| 2533 | linux_glibc_x86: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 2534 | enabled: true, |
Paul Duffin | 7a1f7f3 | 2020-05-04 15:32:08 +0100 | [diff] [blame] | 2535 | srcs: ["linux_glibc/x86/lib/stubslib.so"], |
| 2536 | }, |
| 2537 | }, |
| 2538 | } |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 2539 | `), |
| 2540 | checkVersionedAndroidBpContents(` |
| 2541 | // This is auto-generated. DO NOT EDIT. |
Paul Duffin | 7a1f7f3 | 2020-05-04 15:32:08 +0100 | [diff] [blame] | 2542 | |
| 2543 | cc_prebuilt_library_shared { |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 2544 | name: "mysdk_stubslib@current", |
| 2545 | sdk_member_name: "stubslib", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 2546 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 2547 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 7a1f7f3 | 2020-05-04 15:32:08 +0100 | [diff] [blame] | 2548 | host_supported: true, |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 2549 | installable: false, |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 2550 | compile_multilib: "both", |
Paul Duffin | 7a1f7f3 | 2020-05-04 15:32:08 +0100 | [diff] [blame] | 2551 | stubs: { |
Martin Stjernholm | 618b671 | 2020-09-24 16:53:04 +0100 | [diff] [blame] | 2552 | versions: [ |
| 2553 | "1", |
| 2554 | "2", |
| 2555 | "3", |
Jiyong Park | d4a3a13 | 2021-03-17 20:21:35 +0900 | [diff] [blame] | 2556 | "current", |
Martin Stjernholm | 618b671 | 2020-09-24 16:53:04 +0100 | [diff] [blame] | 2557 | ], |
Paul Duffin | 7a1f7f3 | 2020-05-04 15:32:08 +0100 | [diff] [blame] | 2558 | }, |
| 2559 | target: { |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 2560 | host: { |
| 2561 | enabled: false, |
| 2562 | }, |
Paul Duffin | 7a1f7f3 | 2020-05-04 15:32:08 +0100 | [diff] [blame] | 2563 | android_arm64: { |
| 2564 | srcs: ["android/arm64/lib/stubslib.so"], |
| 2565 | }, |
| 2566 | android_arm: { |
| 2567 | srcs: ["android/arm/lib/stubslib.so"], |
| 2568 | }, |
| 2569 | linux_glibc_x86_64: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 2570 | enabled: true, |
Paul Duffin | 7a1f7f3 | 2020-05-04 15:32:08 +0100 | [diff] [blame] | 2571 | srcs: ["linux_glibc/x86_64/lib/stubslib.so"], |
| 2572 | }, |
| 2573 | linux_glibc_x86: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 2574 | enabled: true, |
Paul Duffin | 7a1f7f3 | 2020-05-04 15:32:08 +0100 | [diff] [blame] | 2575 | srcs: ["linux_glibc/x86/lib/stubslib.so"], |
| 2576 | }, |
| 2577 | }, |
| 2578 | } |
| 2579 | |
| 2580 | sdk_snapshot { |
| 2581 | name: "mysdk@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 2582 | visibility: ["//visibility:public"], |
Paul Duffin | 7a1f7f3 | 2020-05-04 15:32:08 +0100 | [diff] [blame] | 2583 | host_supported: true, |
| 2584 | native_shared_libs: ["mysdk_stubslib@current"], |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 2585 | target: { |
| 2586 | host: { |
| 2587 | enabled: false, |
| 2588 | }, |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 2589 | linux_glibc_x86_64: { |
| 2590 | enabled: true, |
| 2591 | }, |
| 2592 | linux_glibc_x86: { |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 2593 | enabled: true, |
| 2594 | }, |
| 2595 | }, |
Paul Duffin | 7a1f7f3 | 2020-05-04 15:32:08 +0100 | [diff] [blame] | 2596 | } |
| 2597 | `)) |
| 2598 | } |
Martin Stjernholm | 47ed352 | 2020-06-17 22:52:25 +0100 | [diff] [blame] | 2599 | |
| 2600 | func TestUniqueHostSoname(t *testing.T) { |
Martin Stjernholm | 47ed352 | 2020-06-17 22:52:25 +0100 | [diff] [blame] | 2601 | result := testSdkWithCc(t, ` |
| 2602 | sdk { |
| 2603 | name: "mysdk", |
| 2604 | host_supported: true, |
| 2605 | native_shared_libs: ["mylib"], |
| 2606 | } |
| 2607 | |
| 2608 | cc_library { |
| 2609 | name: "mylib", |
| 2610 | host_supported: true, |
| 2611 | unique_host_soname: true, |
| 2612 | } |
| 2613 | `) |
| 2614 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 2615 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 2616 | checkUnversionedAndroidBpContents(` |
Martin Stjernholm | 47ed352 | 2020-06-17 22:52:25 +0100 | [diff] [blame] | 2617 | // This is auto-generated. DO NOT EDIT. |
| 2618 | |
| 2619 | cc_prebuilt_library_shared { |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 2620 | name: "mylib", |
| 2621 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 2622 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 2623 | apex_available: ["//apex_available:platform"], |
Martin Stjernholm | 47ed352 | 2020-06-17 22:52:25 +0100 | [diff] [blame] | 2624 | host_supported: true, |
Martin Stjernholm | 47ed352 | 2020-06-17 22:52:25 +0100 | [diff] [blame] | 2625 | unique_host_soname: true, |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 2626 | compile_multilib: "both", |
Martin Stjernholm | 47ed352 | 2020-06-17 22:52:25 +0100 | [diff] [blame] | 2627 | target: { |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 2628 | host: { |
| 2629 | enabled: false, |
| 2630 | }, |
Martin Stjernholm | 47ed352 | 2020-06-17 22:52:25 +0100 | [diff] [blame] | 2631 | android_arm64: { |
| 2632 | srcs: ["android/arm64/lib/mylib.so"], |
| 2633 | }, |
| 2634 | android_arm: { |
| 2635 | srcs: ["android/arm/lib/mylib.so"], |
| 2636 | }, |
| 2637 | linux_glibc_x86_64: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 2638 | enabled: true, |
Martin Stjernholm | 47ed352 | 2020-06-17 22:52:25 +0100 | [diff] [blame] | 2639 | srcs: ["linux_glibc/x86_64/lib/mylib-host.so"], |
| 2640 | }, |
| 2641 | linux_glibc_x86: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 2642 | enabled: true, |
Martin Stjernholm | 47ed352 | 2020-06-17 22:52:25 +0100 | [diff] [blame] | 2643 | srcs: ["linux_glibc/x86/lib/mylib-host.so"], |
| 2644 | }, |
| 2645 | }, |
| 2646 | } |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 2647 | `), |
| 2648 | checkVersionedAndroidBpContents(` |
| 2649 | // This is auto-generated. DO NOT EDIT. |
Martin Stjernholm | 47ed352 | 2020-06-17 22:52:25 +0100 | [diff] [blame] | 2650 | |
| 2651 | cc_prebuilt_library_shared { |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 2652 | name: "mysdk_mylib@current", |
| 2653 | sdk_member_name: "mylib", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 2654 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 2655 | apex_available: ["//apex_available:platform"], |
Martin Stjernholm | 47ed352 | 2020-06-17 22:52:25 +0100 | [diff] [blame] | 2656 | host_supported: true, |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 2657 | installable: false, |
Martin Stjernholm | 47ed352 | 2020-06-17 22:52:25 +0100 | [diff] [blame] | 2658 | unique_host_soname: true, |
Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 2659 | compile_multilib: "both", |
Martin Stjernholm | 47ed352 | 2020-06-17 22:52:25 +0100 | [diff] [blame] | 2660 | target: { |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 2661 | host: { |
| 2662 | enabled: false, |
| 2663 | }, |
Martin Stjernholm | 47ed352 | 2020-06-17 22:52:25 +0100 | [diff] [blame] | 2664 | android_arm64: { |
| 2665 | srcs: ["android/arm64/lib/mylib.so"], |
| 2666 | }, |
| 2667 | android_arm: { |
| 2668 | srcs: ["android/arm/lib/mylib.so"], |
| 2669 | }, |
| 2670 | linux_glibc_x86_64: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 2671 | enabled: true, |
Martin Stjernholm | 47ed352 | 2020-06-17 22:52:25 +0100 | [diff] [blame] | 2672 | srcs: ["linux_glibc/x86_64/lib/mylib-host.so"], |
| 2673 | }, |
| 2674 | linux_glibc_x86: { |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 2675 | enabled: true, |
Martin Stjernholm | 47ed352 | 2020-06-17 22:52:25 +0100 | [diff] [blame] | 2676 | srcs: ["linux_glibc/x86/lib/mylib-host.so"], |
| 2677 | }, |
| 2678 | }, |
| 2679 | } |
| 2680 | |
| 2681 | sdk_snapshot { |
| 2682 | name: "mysdk@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 2683 | visibility: ["//visibility:public"], |
Martin Stjernholm | 47ed352 | 2020-06-17 22:52:25 +0100 | [diff] [blame] | 2684 | host_supported: true, |
| 2685 | native_shared_libs: ["mysdk_mylib@current"], |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 2686 | target: { |
| 2687 | host: { |
| 2688 | enabled: false, |
| 2689 | }, |
Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 2690 | linux_glibc_x86_64: { |
| 2691 | enabled: true, |
| 2692 | }, |
| 2693 | linux_glibc_x86: { |
Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 2694 | enabled: true, |
| 2695 | }, |
| 2696 | }, |
Martin Stjernholm | 47ed352 | 2020-06-17 22:52:25 +0100 | [diff] [blame] | 2697 | } |
| 2698 | `), |
| 2699 | checkAllCopyRules(` |
| 2700 | .intermediates/mylib/android_arm64_armv8-a_shared/mylib.so -> android/arm64/lib/mylib.so |
| 2701 | .intermediates/mylib/android_arm_armv7-a-neon_shared/mylib.so -> android/arm/lib/mylib.so |
| 2702 | .intermediates/mylib/linux_glibc_x86_64_shared/mylib-host.so -> linux_glibc/x86_64/lib/mylib-host.so |
| 2703 | .intermediates/mylib/linux_glibc_x86_shared/mylib-host.so -> linux_glibc/x86/lib/mylib-host.so |
| 2704 | `), |
| 2705 | ) |
| 2706 | } |
Martin Stjernholm | 59e0c7a | 2020-10-28 23:38:33 +0000 | [diff] [blame] | 2707 | |
| 2708 | func TestNoSanitizerMembers(t *testing.T) { |
| 2709 | result := testSdkWithCc(t, ` |
| 2710 | sdk { |
| 2711 | name: "mysdk", |
| 2712 | native_shared_libs: ["mynativelib"], |
| 2713 | } |
| 2714 | |
| 2715 | cc_library_shared { |
| 2716 | name: "mynativelib", |
| 2717 | srcs: ["Test.cpp"], |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 2718 | export_include_dirs: ["myinclude"], |
Martin Stjernholm | 59e0c7a | 2020-10-28 23:38:33 +0000 | [diff] [blame] | 2719 | arch: { |
| 2720 | arm64: { |
| 2721 | export_system_include_dirs: ["arm64/include"], |
| 2722 | sanitize: { |
| 2723 | hwaddress: true, |
| 2724 | }, |
| 2725 | }, |
| 2726 | }, |
| 2727 | } |
| 2728 | `) |
| 2729 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 2730 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 2731 | checkUnversionedAndroidBpContents(` |
Martin Stjernholm | 59e0c7a | 2020-10-28 23:38:33 +0000 | [diff] [blame] | 2732 | // This is auto-generated. DO NOT EDIT. |
| 2733 | |
| 2734 | cc_prebuilt_library_shared { |
Martin Stjernholm | 59e0c7a | 2020-10-28 23:38:33 +0000 | [diff] [blame] | 2735 | name: "mynativelib", |
| 2736 | prefer: false, |
| 2737 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 2738 | apex_available: ["//apex_available:platform"], |
Martin Stjernholm | 59e0c7a | 2020-10-28 23:38:33 +0000 | [diff] [blame] | 2739 | compile_multilib: "both", |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 2740 | export_include_dirs: ["include/myinclude"], |
Martin Stjernholm | 59e0c7a | 2020-10-28 23:38:33 +0000 | [diff] [blame] | 2741 | arch: { |
| 2742 | arm64: { |
| 2743 | export_system_include_dirs: ["arm64/include/arm64/include"], |
| 2744 | }, |
| 2745 | arm: { |
| 2746 | srcs: ["arm/lib/mynativelib.so"], |
| 2747 | }, |
| 2748 | }, |
| 2749 | } |
Martin Stjernholm | 59e0c7a | 2020-10-28 23:38:33 +0000 | [diff] [blame] | 2750 | `), |
| 2751 | checkAllCopyRules(` |
Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 2752 | myinclude/Test.h -> include/myinclude/Test.h |
Martin Stjernholm | 59e0c7a | 2020-10-28 23:38:33 +0000 | [diff] [blame] | 2753 | arm64/include/Arm64Test.h -> arm64/include/arm64/include/Arm64Test.h |
Paul Duffin | 1822a0a | 2021-03-21 12:56:33 +0000 | [diff] [blame] | 2754 | .intermediates/mynativelib/android_arm_armv7-a-neon_shared/mynativelib.so -> arm/lib/mynativelib.so |
| 2755 | `), |
Martin Stjernholm | 59e0c7a | 2020-10-28 23:38:33 +0000 | [diff] [blame] | 2756 | ) |
| 2757 | } |