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 ( |
| 18 | "testing" |
| 19 | |
Paul Duffin | 1356d8c | 2020-02-25 19:26:33 +0000 | [diff] [blame] | 20 | "android/soong/android" |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 21 | "android/soong/cc" |
| 22 | ) |
| 23 | |
Paul Duffin | d835daa | 2019-11-30 17:49:09 +0000 | [diff] [blame] | 24 | func testSdkWithCc(t *testing.T, bp string) *testSdkResult { |
| 25 | t.Helper() |
| 26 | |
| 27 | fs := map[string][]byte{ |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 28 | "Test.cpp": nil, |
| 29 | "include/Test.h": nil, |
| 30 | "include-android/AndroidTest.h": nil, |
| 31 | "include-host/HostTest.h": nil, |
| 32 | "arm64/include/Arm64Test.h": nil, |
| 33 | "libfoo.so": nil, |
| 34 | "aidl/foo/bar/Test.aidl": nil, |
Paul Duffin | d835daa | 2019-11-30 17:49:09 +0000 | [diff] [blame] | 35 | } |
| 36 | return testSdkWithFs(t, bp, fs) |
| 37 | } |
| 38 | |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 39 | // Contains tests for SDK members provided by the cc package. |
| 40 | |
| 41 | func TestSdkIsCompileMultilibBoth(t *testing.T) { |
Paul Duffin | d835daa | 2019-11-30 17:49:09 +0000 | [diff] [blame] | 42 | result := testSdkWithCc(t, ` |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 43 | sdk { |
| 44 | name: "mysdk", |
| 45 | native_shared_libs: ["sdkmember"], |
| 46 | } |
| 47 | |
| 48 | cc_library_shared { |
| 49 | name: "sdkmember", |
| 50 | srcs: ["Test.cpp"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 51 | stl: "none", |
| 52 | } |
| 53 | `) |
| 54 | |
Colin Cross | 7113d20 | 2019-11-20 16:39:12 -0800 | [diff] [blame] | 55 | armOutput := result.Module("sdkmember", "android_arm_armv7-a-neon_shared").(*cc.Module).OutputFile() |
| 56 | arm64Output := result.Module("sdkmember", "android_arm64_armv8-a_shared").(*cc.Module).OutputFile() |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 57 | |
| 58 | var inputs []string |
Paul Duffin | 1356d8c | 2020-02-25 19:26:33 +0000 | [diff] [blame] | 59 | buildParams := result.Module("mysdk", android.CommonOS.Name).BuildParamsForTests() |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 60 | for _, bp := range buildParams { |
| 61 | if bp.Input != nil { |
| 62 | inputs = append(inputs, bp.Input.String()) |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | // ensure that both 32/64 outputs are inputs of the sdk snapshot |
| 67 | ensureListContains(t, inputs, armOutput.String()) |
| 68 | ensureListContains(t, inputs, arm64Output.String()) |
| 69 | } |
| 70 | |
| 71 | func TestBasicSdkWithCc(t *testing.T) { |
Paul Duffin | d835daa | 2019-11-30 17:49:09 +0000 | [diff] [blame] | 72 | result := testSdkWithCc(t, ` |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 73 | sdk { |
| 74 | name: "mysdk", |
| 75 | native_shared_libs: ["sdkmember"], |
| 76 | } |
| 77 | |
Paul Duffin | a0843f6 | 2019-12-13 19:50:38 +0000 | [diff] [blame] | 78 | cc_library_shared { |
| 79 | name: "sdkmember", |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 80 | system_shared_libs: [], |
Paul Duffin | a0843f6 | 2019-12-13 19:50:38 +0000 | [diff] [blame] | 81 | } |
| 82 | |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 83 | sdk_snapshot { |
| 84 | name: "mysdk@1", |
| 85 | native_shared_libs: ["sdkmember_mysdk_1"], |
| 86 | } |
| 87 | |
| 88 | sdk_snapshot { |
| 89 | name: "mysdk@2", |
| 90 | native_shared_libs: ["sdkmember_mysdk_2"], |
| 91 | } |
| 92 | |
| 93 | cc_prebuilt_library_shared { |
| 94 | name: "sdkmember", |
| 95 | srcs: ["libfoo.so"], |
| 96 | prefer: false, |
| 97 | system_shared_libs: [], |
| 98 | stl: "none", |
| 99 | } |
| 100 | |
| 101 | cc_prebuilt_library_shared { |
| 102 | name: "sdkmember_mysdk_1", |
| 103 | sdk_member_name: "sdkmember", |
| 104 | srcs: ["libfoo.so"], |
| 105 | system_shared_libs: [], |
| 106 | stl: "none", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 107 | // TODO: remove //apex_available:platform |
| 108 | apex_available: [ |
| 109 | "//apex_available:platform", |
| 110 | "myapex", |
| 111 | ], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 112 | } |
| 113 | |
| 114 | cc_prebuilt_library_shared { |
| 115 | name: "sdkmember_mysdk_2", |
| 116 | sdk_member_name: "sdkmember", |
| 117 | srcs: ["libfoo.so"], |
| 118 | system_shared_libs: [], |
| 119 | stl: "none", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 120 | // TODO: remove //apex_available:platform |
| 121 | apex_available: [ |
| 122 | "//apex_available:platform", |
| 123 | "myapex2", |
| 124 | ], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 125 | } |
| 126 | |
| 127 | cc_library_shared { |
| 128 | name: "mycpplib", |
| 129 | srcs: ["Test.cpp"], |
| 130 | shared_libs: ["sdkmember"], |
| 131 | system_shared_libs: [], |
| 132 | stl: "none", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 133 | apex_available: [ |
| 134 | "myapex", |
| 135 | "myapex2", |
| 136 | ], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 137 | } |
| 138 | |
| 139 | apex { |
| 140 | name: "myapex", |
| 141 | native_shared_libs: ["mycpplib"], |
| 142 | uses_sdks: ["mysdk@1"], |
| 143 | key: "myapex.key", |
| 144 | certificate: ":myapex.cert", |
| 145 | } |
| 146 | |
| 147 | apex { |
| 148 | name: "myapex2", |
| 149 | native_shared_libs: ["mycpplib"], |
| 150 | uses_sdks: ["mysdk@2"], |
| 151 | key: "myapex.key", |
| 152 | certificate: ":myapex.cert", |
| 153 | } |
| 154 | `) |
| 155 | |
Colin Cross | 7113d20 | 2019-11-20 16:39:12 -0800 | [diff] [blame] | 156 | sdkMemberV1 := result.ModuleForTests("sdkmember_mysdk_1", "android_arm64_armv8-a_shared_myapex").Rule("toc").Output |
| 157 | sdkMemberV2 := result.ModuleForTests("sdkmember_mysdk_2", "android_arm64_armv8-a_shared_myapex2").Rule("toc").Output |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 158 | |
Colin Cross | 7113d20 | 2019-11-20 16:39:12 -0800 | [diff] [blame] | 159 | cpplibForMyApex := result.ModuleForTests("mycpplib", "android_arm64_armv8-a_shared_myapex") |
| 160 | cpplibForMyApex2 := result.ModuleForTests("mycpplib", "android_arm64_armv8-a_shared_myapex2") |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 161 | |
| 162 | // Depending on the uses_sdks value, different libs are linked |
| 163 | ensureListContains(t, pathsToStrings(cpplibForMyApex.Rule("ld").Implicits), sdkMemberV1.String()) |
| 164 | ensureListContains(t, pathsToStrings(cpplibForMyApex2.Rule("ld").Implicits), sdkMemberV2.String()) |
| 165 | } |
| 166 | |
Paul Duffin | a0843f6 | 2019-12-13 19:50:38 +0000 | [diff] [blame] | 167 | // Make sure the sdk can use host specific cc libraries static/shared and both. |
| 168 | func TestHostSdkWithCc(t *testing.T) { |
| 169 | testSdkWithCc(t, ` |
| 170 | sdk { |
| 171 | name: "mysdk", |
| 172 | device_supported: false, |
| 173 | host_supported: true, |
| 174 | native_shared_libs: ["sdkshared"], |
| 175 | native_static_libs: ["sdkstatic"], |
| 176 | } |
| 177 | |
| 178 | cc_library_host_shared { |
| 179 | name: "sdkshared", |
Paul Duffin | a0843f6 | 2019-12-13 19:50:38 +0000 | [diff] [blame] | 180 | stl: "none", |
| 181 | } |
| 182 | |
| 183 | cc_library_host_static { |
| 184 | name: "sdkstatic", |
Paul Duffin | a0843f6 | 2019-12-13 19:50:38 +0000 | [diff] [blame] | 185 | stl: "none", |
| 186 | } |
| 187 | `) |
| 188 | } |
| 189 | |
| 190 | // Make sure the sdk can use cc libraries static/shared and both. |
| 191 | func TestSdkWithCc(t *testing.T) { |
| 192 | testSdkWithCc(t, ` |
| 193 | sdk { |
| 194 | name: "mysdk", |
| 195 | native_shared_libs: ["sdkshared", "sdkboth1"], |
| 196 | native_static_libs: ["sdkstatic", "sdkboth2"], |
| 197 | } |
| 198 | |
| 199 | cc_library_shared { |
| 200 | name: "sdkshared", |
Paul Duffin | a0843f6 | 2019-12-13 19:50:38 +0000 | [diff] [blame] | 201 | stl: "none", |
| 202 | } |
| 203 | |
| 204 | cc_library_static { |
| 205 | name: "sdkstatic", |
Paul Duffin | a0843f6 | 2019-12-13 19:50:38 +0000 | [diff] [blame] | 206 | stl: "none", |
| 207 | } |
| 208 | |
| 209 | cc_library { |
| 210 | name: "sdkboth1", |
Paul Duffin | a0843f6 | 2019-12-13 19:50:38 +0000 | [diff] [blame] | 211 | stl: "none", |
| 212 | } |
| 213 | |
| 214 | cc_library { |
| 215 | name: "sdkboth2", |
Paul Duffin | a0843f6 | 2019-12-13 19:50:38 +0000 | [diff] [blame] | 216 | stl: "none", |
| 217 | } |
| 218 | `) |
| 219 | } |
| 220 | |
Martin Stjernholm | cd07bce | 2020-03-10 22:37:59 +0000 | [diff] [blame] | 221 | func TestSnapshotWithObject(t *testing.T) { |
| 222 | result := testSdkWithCc(t, ` |
| 223 | sdk { |
| 224 | name: "mysdk", |
| 225 | native_objects: ["crtobj"], |
| 226 | } |
| 227 | |
| 228 | cc_object { |
| 229 | name: "crtobj", |
| 230 | stl: "none", |
| 231 | } |
| 232 | `) |
| 233 | |
| 234 | result.CheckSnapshot("mysdk", "", |
| 235 | checkAndroidBpContents(` |
| 236 | // This is auto-generated. DO NOT EDIT. |
| 237 | |
| 238 | cc_prebuilt_object { |
| 239 | name: "mysdk_crtobj@current", |
| 240 | sdk_member_name: "crtobj", |
| 241 | stl: "none", |
| 242 | arch: { |
| 243 | arm64: { |
| 244 | srcs: ["arm64/lib/crtobj.o"], |
| 245 | }, |
| 246 | arm: { |
| 247 | srcs: ["arm/lib/crtobj.o"], |
| 248 | }, |
| 249 | }, |
| 250 | } |
| 251 | |
| 252 | cc_prebuilt_object { |
| 253 | name: "crtobj", |
| 254 | prefer: false, |
| 255 | stl: "none", |
| 256 | arch: { |
| 257 | arm64: { |
| 258 | srcs: ["arm64/lib/crtobj.o"], |
| 259 | }, |
| 260 | arm: { |
| 261 | srcs: ["arm/lib/crtobj.o"], |
| 262 | }, |
| 263 | }, |
| 264 | } |
| 265 | |
| 266 | sdk_snapshot { |
| 267 | name: "mysdk@current", |
| 268 | native_objects: ["mysdk_crtobj@current"], |
| 269 | } |
| 270 | `), |
| 271 | checkAllCopyRules(` |
| 272 | .intermediates/crtobj/android_arm64_armv8-a/crtobj.o -> arm64/lib/crtobj.o |
| 273 | .intermediates/crtobj/android_arm_armv7-a-neon/crtobj.o -> arm/lib/crtobj.o |
| 274 | `), |
| 275 | ) |
| 276 | } |
| 277 | |
Paul Duffin | c62a510 | 2019-12-11 18:34:15 +0000 | [diff] [blame] | 278 | func TestSnapshotWithCcDuplicateHeaders(t *testing.T) { |
| 279 | result := testSdkWithCc(t, ` |
| 280 | sdk { |
| 281 | name: "mysdk", |
| 282 | native_shared_libs: ["mynativelib1", "mynativelib2"], |
| 283 | } |
| 284 | |
| 285 | cc_library_shared { |
| 286 | name: "mynativelib1", |
| 287 | srcs: [ |
| 288 | "Test.cpp", |
| 289 | ], |
| 290 | export_include_dirs: ["include"], |
Paul Duffin | c62a510 | 2019-12-11 18:34:15 +0000 | [diff] [blame] | 291 | stl: "none", |
| 292 | } |
| 293 | |
| 294 | cc_library_shared { |
| 295 | name: "mynativelib2", |
| 296 | srcs: [ |
| 297 | "Test.cpp", |
| 298 | ], |
| 299 | export_include_dirs: ["include"], |
Paul Duffin | c62a510 | 2019-12-11 18:34:15 +0000 | [diff] [blame] | 300 | stl: "none", |
| 301 | } |
| 302 | `) |
| 303 | |
Paul Duffin | 1356d8c | 2020-02-25 19:26:33 +0000 | [diff] [blame] | 304 | result.CheckSnapshot("mysdk", "", |
Paul Duffin | c62a510 | 2019-12-11 18:34:15 +0000 | [diff] [blame] | 305 | checkAllCopyRules(` |
| 306 | include/Test.h -> include/include/Test.h |
Colin Cross | 7113d20 | 2019-11-20 16:39:12 -0800 | [diff] [blame] | 307 | .intermediates/mynativelib1/android_arm64_armv8-a_shared/mynativelib1.so -> arm64/lib/mynativelib1.so |
| 308 | .intermediates/mynativelib1/android_arm_armv7-a-neon_shared/mynativelib1.so -> arm/lib/mynativelib1.so |
| 309 | .intermediates/mynativelib2/android_arm64_armv8-a_shared/mynativelib2.so -> arm64/lib/mynativelib2.so |
| 310 | .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] | 311 | `), |
| 312 | ) |
| 313 | } |
| 314 | |
Paul Duffin | a7cd8c8 | 2019-12-11 20:00:57 +0000 | [diff] [blame] | 315 | // Verify that when the shared library has some common and some arch specific properties that the generated |
| 316 | // snapshot is optimized properly. |
| 317 | func TestSnapshotWithCcSharedLibraryCommonProperties(t *testing.T) { |
| 318 | result := testSdkWithCc(t, ` |
| 319 | sdk { |
| 320 | name: "mysdk", |
| 321 | native_shared_libs: ["mynativelib"], |
| 322 | } |
| 323 | |
| 324 | cc_library_shared { |
| 325 | name: "mynativelib", |
| 326 | srcs: [ |
| 327 | "Test.cpp", |
| 328 | "aidl/foo/bar/Test.aidl", |
| 329 | ], |
| 330 | export_include_dirs: ["include"], |
| 331 | arch: { |
| 332 | arm64: { |
| 333 | export_system_include_dirs: ["arm64/include"], |
| 334 | }, |
| 335 | }, |
Paul Duffin | a7cd8c8 | 2019-12-11 20:00:57 +0000 | [diff] [blame] | 336 | stl: "none", |
| 337 | } |
| 338 | `) |
| 339 | |
Paul Duffin | 1356d8c | 2020-02-25 19:26:33 +0000 | [diff] [blame] | 340 | result.CheckSnapshot("mysdk", "", |
Paul Duffin | a7cd8c8 | 2019-12-11 20:00:57 +0000 | [diff] [blame] | 341 | checkAndroidBpContents(` |
| 342 | // This is auto-generated. DO NOT EDIT. |
| 343 | |
| 344 | cc_prebuilt_library_shared { |
| 345 | name: "mysdk_mynativelib@current", |
| 346 | sdk_member_name: "mynativelib", |
Paul Duffin | 0cb37b9 | 2020-03-04 14:52:46 +0000 | [diff] [blame] | 347 | installable: false, |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 348 | stl: "none", |
Paul Duffin | a7cd8c8 | 2019-12-11 20:00:57 +0000 | [diff] [blame] | 349 | export_include_dirs: ["include/include"], |
| 350 | arch: { |
| 351 | arm64: { |
| 352 | srcs: ["arm64/lib/mynativelib.so"], |
| 353 | export_system_include_dirs: ["arm64/include/arm64/include"], |
| 354 | }, |
| 355 | arm: { |
| 356 | srcs: ["arm/lib/mynativelib.so"], |
| 357 | }, |
| 358 | }, |
Paul Duffin | a7cd8c8 | 2019-12-11 20:00:57 +0000 | [diff] [blame] | 359 | } |
| 360 | |
| 361 | cc_prebuilt_library_shared { |
| 362 | name: "mynativelib", |
| 363 | prefer: false, |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 364 | stl: "none", |
Paul Duffin | a7cd8c8 | 2019-12-11 20:00:57 +0000 | [diff] [blame] | 365 | export_include_dirs: ["include/include"], |
| 366 | arch: { |
| 367 | arm64: { |
| 368 | srcs: ["arm64/lib/mynativelib.so"], |
| 369 | export_system_include_dirs: ["arm64/include/arm64/include"], |
| 370 | }, |
| 371 | arm: { |
| 372 | srcs: ["arm/lib/mynativelib.so"], |
| 373 | }, |
| 374 | }, |
Paul Duffin | a7cd8c8 | 2019-12-11 20:00:57 +0000 | [diff] [blame] | 375 | } |
| 376 | |
| 377 | sdk_snapshot { |
| 378 | name: "mysdk@current", |
| 379 | native_shared_libs: ["mysdk_mynativelib@current"], |
| 380 | } |
| 381 | `), |
| 382 | checkAllCopyRules(` |
| 383 | include/Test.h -> include/include/Test.h |
Colin Cross | 7113d20 | 2019-11-20 16:39:12 -0800 | [diff] [blame] | 384 | .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] | 385 | arm64/include/Arm64Test.h -> arm64/include/arm64/include/Arm64Test.h |
Colin Cross | 7113d20 | 2019-11-20 16:39:12 -0800 | [diff] [blame] | 386 | .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] | 387 | ) |
| 388 | } |
| 389 | |
Paul Duffin | 25ce04b | 2020-01-16 11:47:25 +0000 | [diff] [blame] | 390 | func TestSnapshotWithCcBinary(t *testing.T) { |
| 391 | result := testSdkWithCc(t, ` |
| 392 | module_exports { |
| 393 | name: "mymodule_exports", |
| 394 | native_binaries: ["mynativebinary"], |
| 395 | } |
| 396 | |
| 397 | cc_binary { |
| 398 | name: "mynativebinary", |
| 399 | srcs: [ |
| 400 | "Test.cpp", |
| 401 | ], |
| 402 | compile_multilib: "both", |
Paul Duffin | 25ce04b | 2020-01-16 11:47:25 +0000 | [diff] [blame] | 403 | stl: "none", |
| 404 | } |
| 405 | `) |
| 406 | |
Paul Duffin | 1356d8c | 2020-02-25 19:26:33 +0000 | [diff] [blame] | 407 | result.CheckSnapshot("mymodule_exports", "", |
Paul Duffin | 25ce04b | 2020-01-16 11:47:25 +0000 | [diff] [blame] | 408 | checkAndroidBpContents(` |
| 409 | // This is auto-generated. DO NOT EDIT. |
| 410 | |
| 411 | cc_prebuilt_binary { |
| 412 | name: "mymodule_exports_mynativebinary@current", |
| 413 | sdk_member_name: "mynativebinary", |
Paul Duffin | 0cb37b9 | 2020-03-04 14:52:46 +0000 | [diff] [blame] | 414 | installable: false, |
Paul Duffin | 25ce04b | 2020-01-16 11:47:25 +0000 | [diff] [blame] | 415 | compile_multilib: "both", |
| 416 | arch: { |
| 417 | arm64: { |
| 418 | srcs: ["arm64/bin/mynativebinary"], |
| 419 | }, |
| 420 | arm: { |
| 421 | srcs: ["arm/bin/mynativebinary"], |
| 422 | }, |
| 423 | }, |
| 424 | } |
| 425 | |
| 426 | cc_prebuilt_binary { |
| 427 | name: "mynativebinary", |
| 428 | prefer: false, |
| 429 | compile_multilib: "both", |
| 430 | arch: { |
| 431 | arm64: { |
| 432 | srcs: ["arm64/bin/mynativebinary"], |
| 433 | }, |
| 434 | arm: { |
| 435 | srcs: ["arm/bin/mynativebinary"], |
| 436 | }, |
| 437 | }, |
| 438 | } |
| 439 | |
| 440 | module_exports_snapshot { |
| 441 | name: "mymodule_exports@current", |
| 442 | native_binaries: ["mymodule_exports_mynativebinary@current"], |
| 443 | } |
| 444 | `), |
| 445 | checkAllCopyRules(` |
| 446 | .intermediates/mynativebinary/android_arm64_armv8-a/mynativebinary -> arm64/bin/mynativebinary |
| 447 | .intermediates/mynativebinary/android_arm_armv7-a-neon/mynativebinary -> arm/bin/mynativebinary |
| 448 | `), |
| 449 | ) |
| 450 | } |
| 451 | |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 452 | func TestMultipleHostOsTypesSnapshotWithCcBinary(t *testing.T) { |
| 453 | // b/145598135 - Generating host snapshots for anything other than linux is not supported. |
| 454 | SkipIfNotLinux(t) |
| 455 | |
| 456 | result := testSdkWithCc(t, ` |
| 457 | module_exports { |
| 458 | name: "myexports", |
| 459 | device_supported: false, |
| 460 | host_supported: true, |
| 461 | native_binaries: ["mynativebinary"], |
| 462 | target: { |
| 463 | windows: { |
| 464 | enabled: true, |
| 465 | }, |
| 466 | }, |
| 467 | } |
| 468 | |
| 469 | cc_binary { |
| 470 | name: "mynativebinary", |
| 471 | device_supported: false, |
| 472 | host_supported: true, |
| 473 | srcs: [ |
| 474 | "Test.cpp", |
| 475 | ], |
| 476 | compile_multilib: "both", |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 477 | stl: "none", |
| 478 | target: { |
| 479 | windows: { |
| 480 | enabled: true, |
| 481 | }, |
| 482 | }, |
| 483 | } |
| 484 | `) |
| 485 | |
| 486 | result.CheckSnapshot("myexports", "", |
| 487 | checkAndroidBpContents(` |
| 488 | // This is auto-generated. DO NOT EDIT. |
| 489 | |
| 490 | cc_prebuilt_binary { |
| 491 | name: "myexports_mynativebinary@current", |
| 492 | sdk_member_name: "mynativebinary", |
| 493 | device_supported: false, |
| 494 | host_supported: true, |
Paul Duffin | 0cb37b9 | 2020-03-04 14:52:46 +0000 | [diff] [blame] | 495 | installable: false, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 496 | target: { |
| 497 | linux_glibc: { |
| 498 | compile_multilib: "both", |
| 499 | }, |
| 500 | linux_glibc_x86_64: { |
| 501 | srcs: ["linux_glibc/x86_64/bin/mynativebinary"], |
| 502 | }, |
| 503 | linux_glibc_x86: { |
| 504 | srcs: ["linux_glibc/x86/bin/mynativebinary"], |
| 505 | }, |
| 506 | windows: { |
| 507 | compile_multilib: "64", |
| 508 | }, |
| 509 | windows_x86_64: { |
| 510 | srcs: ["windows/x86_64/bin/mynativebinary.exe"], |
| 511 | }, |
| 512 | }, |
| 513 | } |
| 514 | |
| 515 | cc_prebuilt_binary { |
| 516 | name: "mynativebinary", |
| 517 | prefer: false, |
| 518 | device_supported: false, |
| 519 | host_supported: true, |
| 520 | target: { |
| 521 | linux_glibc: { |
| 522 | compile_multilib: "both", |
| 523 | }, |
| 524 | linux_glibc_x86_64: { |
| 525 | srcs: ["linux_glibc/x86_64/bin/mynativebinary"], |
| 526 | }, |
| 527 | linux_glibc_x86: { |
| 528 | srcs: ["linux_glibc/x86/bin/mynativebinary"], |
| 529 | }, |
| 530 | windows: { |
| 531 | compile_multilib: "64", |
| 532 | }, |
| 533 | windows_x86_64: { |
| 534 | srcs: ["windows/x86_64/bin/mynativebinary.exe"], |
| 535 | }, |
| 536 | }, |
| 537 | } |
| 538 | |
| 539 | module_exports_snapshot { |
| 540 | name: "myexports@current", |
| 541 | device_supported: false, |
| 542 | host_supported: true, |
| 543 | native_binaries: ["myexports_mynativebinary@current"], |
Paul Duffin | 6a7e953 | 2020-03-20 17:50:07 +0000 | [diff] [blame] | 544 | target: { |
| 545 | windows: { |
| 546 | compile_multilib: "64", |
| 547 | }, |
| 548 | }, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 549 | } |
| 550 | `), |
| 551 | checkAllCopyRules(` |
| 552 | .intermediates/mynativebinary/linux_glibc_x86_64/mynativebinary -> linux_glibc/x86_64/bin/mynativebinary |
| 553 | .intermediates/mynativebinary/linux_glibc_x86/mynativebinary -> linux_glibc/x86/bin/mynativebinary |
| 554 | .intermediates/mynativebinary/windows_x86_64/mynativebinary.exe -> windows/x86_64/bin/mynativebinary.exe |
| 555 | `), |
| 556 | ) |
| 557 | } |
| 558 | |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 559 | func TestSnapshotWithCcSharedLibrary(t *testing.T) { |
Paul Duffin | d835daa | 2019-11-30 17:49:09 +0000 | [diff] [blame] | 560 | result := testSdkWithCc(t, ` |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 561 | sdk { |
| 562 | name: "mysdk", |
| 563 | native_shared_libs: ["mynativelib"], |
| 564 | } |
| 565 | |
| 566 | cc_library_shared { |
| 567 | name: "mynativelib", |
| 568 | srcs: [ |
| 569 | "Test.cpp", |
| 570 | "aidl/foo/bar/Test.aidl", |
| 571 | ], |
Paul Duffin | befa4b9 | 2020-03-04 14:22:45 +0000 | [diff] [blame] | 572 | apex_available: ["apex1", "apex2"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 573 | export_include_dirs: ["include"], |
| 574 | aidl: { |
| 575 | export_aidl_headers: true, |
| 576 | }, |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 577 | stl: "none", |
| 578 | } |
| 579 | `) |
| 580 | |
Paul Duffin | 1356d8c | 2020-02-25 19:26:33 +0000 | [diff] [blame] | 581 | result.CheckSnapshot("mysdk", "", |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 582 | checkAndroidBpContents(` |
| 583 | // This is auto-generated. DO NOT EDIT. |
| 584 | |
| 585 | cc_prebuilt_library_shared { |
| 586 | name: "mysdk_mynativelib@current", |
| 587 | sdk_member_name: "mynativelib", |
Paul Duffin | befa4b9 | 2020-03-04 14:22:45 +0000 | [diff] [blame] | 588 | apex_available: [ |
| 589 | "apex1", |
| 590 | "apex2", |
| 591 | ], |
Paul Duffin | 0cb37b9 | 2020-03-04 14:52:46 +0000 | [diff] [blame] | 592 | installable: false, |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 593 | stl: "none", |
Paul Duffin | 57b9e1d | 2019-12-13 00:03:35 +0000 | [diff] [blame] | 594 | export_include_dirs: ["include/include"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 595 | arch: { |
| 596 | arm64: { |
| 597 | srcs: ["arm64/lib/mynativelib.so"], |
Paul Duffin | 57b9e1d | 2019-12-13 00:03:35 +0000 | [diff] [blame] | 598 | export_include_dirs: ["arm64/include_gen/mynativelib"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 599 | }, |
| 600 | arm: { |
| 601 | srcs: ["arm/lib/mynativelib.so"], |
Paul Duffin | 57b9e1d | 2019-12-13 00:03:35 +0000 | [diff] [blame] | 602 | export_include_dirs: ["arm/include_gen/mynativelib"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 603 | }, |
| 604 | }, |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 605 | } |
| 606 | |
| 607 | cc_prebuilt_library_shared { |
| 608 | name: "mynativelib", |
| 609 | prefer: false, |
Paul Duffin | befa4b9 | 2020-03-04 14:22:45 +0000 | [diff] [blame] | 610 | apex_available: [ |
| 611 | "apex1", |
| 612 | "apex2", |
| 613 | ], |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 614 | stl: "none", |
Paul Duffin | 57b9e1d | 2019-12-13 00:03:35 +0000 | [diff] [blame] | 615 | export_include_dirs: ["include/include"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 616 | arch: { |
| 617 | arm64: { |
| 618 | srcs: ["arm64/lib/mynativelib.so"], |
Paul Duffin | 57b9e1d | 2019-12-13 00:03:35 +0000 | [diff] [blame] | 619 | export_include_dirs: ["arm64/include_gen/mynativelib"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 620 | }, |
| 621 | arm: { |
| 622 | srcs: ["arm/lib/mynativelib.so"], |
Paul Duffin | 57b9e1d | 2019-12-13 00:03:35 +0000 | [diff] [blame] | 623 | export_include_dirs: ["arm/include_gen/mynativelib"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 624 | }, |
| 625 | }, |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 626 | } |
| 627 | |
| 628 | sdk_snapshot { |
| 629 | name: "mysdk@current", |
| 630 | native_shared_libs: ["mysdk_mynativelib@current"], |
| 631 | } |
| 632 | `), |
| 633 | checkAllCopyRules(` |
Paul Duffin | 57b9e1d | 2019-12-13 00:03:35 +0000 | [diff] [blame] | 634 | include/Test.h -> include/include/Test.h |
Colin Cross | 7113d20 | 2019-11-20 16:39:12 -0800 | [diff] [blame] | 635 | .intermediates/mynativelib/android_arm64_armv8-a_shared/mynativelib.so -> arm64/lib/mynativelib.so |
| 636 | .intermediates/mynativelib/android_arm64_armv8-a_shared/gen/aidl/aidl/foo/bar/Test.h -> arm64/include_gen/mynativelib/aidl/foo/bar/Test.h |
| 637 | .intermediates/mynativelib/android_arm64_armv8-a_shared/gen/aidl/aidl/foo/bar/BnTest.h -> arm64/include_gen/mynativelib/aidl/foo/bar/BnTest.h |
| 638 | .intermediates/mynativelib/android_arm64_armv8-a_shared/gen/aidl/aidl/foo/bar/BpTest.h -> arm64/include_gen/mynativelib/aidl/foo/bar/BpTest.h |
| 639 | .intermediates/mynativelib/android_arm_armv7-a-neon_shared/mynativelib.so -> arm/lib/mynativelib.so |
| 640 | .intermediates/mynativelib/android_arm_armv7-a-neon_shared/gen/aidl/aidl/foo/bar/Test.h -> arm/include_gen/mynativelib/aidl/foo/bar/Test.h |
| 641 | .intermediates/mynativelib/android_arm_armv7-a-neon_shared/gen/aidl/aidl/foo/bar/BnTest.h -> arm/include_gen/mynativelib/aidl/foo/bar/BnTest.h |
| 642 | .intermediates/mynativelib/android_arm_armv7-a-neon_shared/gen/aidl/aidl/foo/bar/BpTest.h -> arm/include_gen/mynativelib/aidl/foo/bar/BpTest.h |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 643 | `), |
| 644 | ) |
| 645 | } |
| 646 | |
Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 647 | func TestSnapshotWithCcSharedLibrarySharedLibs(t *testing.T) { |
| 648 | result := testSdkWithCc(t, ` |
| 649 | sdk { |
| 650 | name: "mysdk", |
| 651 | native_shared_libs: [ |
| 652 | "mynativelib", |
| 653 | "myothernativelib", |
| 654 | "mysystemnativelib", |
| 655 | ], |
| 656 | } |
| 657 | |
| 658 | cc_library { |
| 659 | name: "mysystemnativelib", |
| 660 | srcs: [ |
| 661 | "Test.cpp", |
| 662 | ], |
Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 663 | stl: "none", |
| 664 | } |
| 665 | |
| 666 | cc_library_shared { |
| 667 | name: "myothernativelib", |
| 668 | srcs: [ |
| 669 | "Test.cpp", |
| 670 | ], |
| 671 | system_shared_libs: [ |
| 672 | // A reference to a library that is not an sdk member. Uses libm as that |
| 673 | // is in the default set of modules available to this test and so is available |
| 674 | // both here and also when the generated Android.bp file is tested in |
| 675 | // CheckSnapshot(). This ensures that the system_shared_libs property correctly |
| 676 | // handles references to modules that are not sdk members. |
| 677 | "libm", |
| 678 | ], |
| 679 | stl: "none", |
| 680 | } |
| 681 | |
| 682 | cc_library { |
| 683 | name: "mynativelib", |
| 684 | srcs: [ |
| 685 | "Test.cpp", |
| 686 | ], |
| 687 | shared_libs: [ |
| 688 | // A reference to another sdk member. |
| 689 | "myothernativelib", |
| 690 | ], |
| 691 | target: { |
| 692 | android: { |
| 693 | shared: { |
| 694 | shared_libs: [ |
| 695 | // A reference to a library that is not an sdk member. The libc library |
| 696 | // is used here to check that the shared_libs property is handled correctly |
| 697 | // in a similar way to how libm is used to check system_shared_libs above. |
| 698 | "libc", |
| 699 | ], |
| 700 | }, |
| 701 | }, |
| 702 | }, |
Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 703 | stl: "none", |
| 704 | } |
| 705 | `) |
| 706 | |
| 707 | result.CheckSnapshot("mysdk", "", |
| 708 | checkAndroidBpContents(` |
| 709 | // This is auto-generated. DO NOT EDIT. |
| 710 | |
| 711 | cc_prebuilt_library_shared { |
| 712 | name: "mysdk_mynativelib@current", |
| 713 | sdk_member_name: "mynativelib", |
| 714 | installable: false, |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 715 | stl: "none", |
Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 716 | shared_libs: [ |
| 717 | "mysdk_myothernativelib@current", |
| 718 | "libc", |
| 719 | ], |
| 720 | arch: { |
| 721 | arm64: { |
| 722 | srcs: ["arm64/lib/mynativelib.so"], |
| 723 | }, |
| 724 | arm: { |
| 725 | srcs: ["arm/lib/mynativelib.so"], |
| 726 | }, |
| 727 | }, |
Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 728 | } |
| 729 | |
| 730 | cc_prebuilt_library_shared { |
| 731 | name: "mynativelib", |
| 732 | prefer: false, |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 733 | stl: "none", |
Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 734 | shared_libs: [ |
| 735 | "myothernativelib", |
| 736 | "libc", |
| 737 | ], |
| 738 | arch: { |
| 739 | arm64: { |
| 740 | srcs: ["arm64/lib/mynativelib.so"], |
| 741 | }, |
| 742 | arm: { |
| 743 | srcs: ["arm/lib/mynativelib.so"], |
| 744 | }, |
| 745 | }, |
Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 746 | } |
| 747 | |
| 748 | cc_prebuilt_library_shared { |
| 749 | name: "mysdk_myothernativelib@current", |
| 750 | sdk_member_name: "myothernativelib", |
| 751 | installable: false, |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 752 | stl: "none", |
Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 753 | system_shared_libs: ["libm"], |
| 754 | arch: { |
| 755 | arm64: { |
| 756 | srcs: ["arm64/lib/myothernativelib.so"], |
| 757 | }, |
| 758 | arm: { |
| 759 | srcs: ["arm/lib/myothernativelib.so"], |
| 760 | }, |
| 761 | }, |
Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 762 | } |
| 763 | |
| 764 | cc_prebuilt_library_shared { |
| 765 | name: "myothernativelib", |
| 766 | prefer: false, |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 767 | stl: "none", |
Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 768 | system_shared_libs: ["libm"], |
| 769 | arch: { |
| 770 | arm64: { |
| 771 | srcs: ["arm64/lib/myothernativelib.so"], |
| 772 | }, |
| 773 | arm: { |
| 774 | srcs: ["arm/lib/myothernativelib.so"], |
| 775 | }, |
| 776 | }, |
Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 777 | } |
| 778 | |
| 779 | cc_prebuilt_library_shared { |
| 780 | name: "mysdk_mysystemnativelib@current", |
| 781 | sdk_member_name: "mysystemnativelib", |
| 782 | installable: false, |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 783 | stl: "none", |
Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 784 | arch: { |
| 785 | arm64: { |
| 786 | srcs: ["arm64/lib/mysystemnativelib.so"], |
| 787 | }, |
| 788 | arm: { |
| 789 | srcs: ["arm/lib/mysystemnativelib.so"], |
| 790 | }, |
| 791 | }, |
Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 792 | } |
| 793 | |
| 794 | cc_prebuilt_library_shared { |
| 795 | name: "mysystemnativelib", |
| 796 | prefer: false, |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 797 | stl: "none", |
Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 798 | arch: { |
| 799 | arm64: { |
| 800 | srcs: ["arm64/lib/mysystemnativelib.so"], |
| 801 | }, |
| 802 | arm: { |
| 803 | srcs: ["arm/lib/mysystemnativelib.so"], |
| 804 | }, |
| 805 | }, |
Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 806 | } |
| 807 | |
| 808 | sdk_snapshot { |
| 809 | name: "mysdk@current", |
| 810 | native_shared_libs: [ |
| 811 | "mysdk_mynativelib@current", |
| 812 | "mysdk_myothernativelib@current", |
| 813 | "mysdk_mysystemnativelib@current", |
| 814 | ], |
| 815 | } |
| 816 | `), |
| 817 | checkAllCopyRules(` |
| 818 | .intermediates/mynativelib/android_arm64_armv8-a_shared/mynativelib.so -> arm64/lib/mynativelib.so |
| 819 | .intermediates/mynativelib/android_arm_armv7-a-neon_shared/mynativelib.so -> arm/lib/mynativelib.so |
| 820 | .intermediates/myothernativelib/android_arm64_armv8-a_shared/myothernativelib.so -> arm64/lib/myothernativelib.so |
| 821 | .intermediates/myothernativelib/android_arm_armv7-a-neon_shared/myothernativelib.so -> arm/lib/myothernativelib.so |
| 822 | .intermediates/mysystemnativelib/android_arm64_armv8-a_shared/mysystemnativelib.so -> arm64/lib/mysystemnativelib.so |
| 823 | .intermediates/mysystemnativelib/android_arm_armv7-a-neon_shared/mysystemnativelib.so -> arm/lib/mysystemnativelib.so |
| 824 | `), |
| 825 | ) |
| 826 | } |
| 827 | |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 828 | func TestHostSnapshotWithCcSharedLibrary(t *testing.T) { |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 829 | // b/145598135 - Generating host snapshots for anything other than linux is not supported. |
| 830 | SkipIfNotLinux(t) |
| 831 | |
Paul Duffin | d835daa | 2019-11-30 17:49:09 +0000 | [diff] [blame] | 832 | result := testSdkWithCc(t, ` |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 833 | sdk { |
| 834 | name: "mysdk", |
| 835 | device_supported: false, |
| 836 | host_supported: true, |
| 837 | native_shared_libs: ["mynativelib"], |
| 838 | } |
| 839 | |
| 840 | cc_library_shared { |
| 841 | name: "mynativelib", |
| 842 | device_supported: false, |
| 843 | host_supported: true, |
| 844 | srcs: [ |
| 845 | "Test.cpp", |
| 846 | "aidl/foo/bar/Test.aidl", |
| 847 | ], |
| 848 | export_include_dirs: ["include"], |
| 849 | aidl: { |
| 850 | export_aidl_headers: true, |
| 851 | }, |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 852 | stl: "none", |
Paul Duffin | 0c394f3 | 2020-03-05 14:09:58 +0000 | [diff] [blame] | 853 | sdk_version: "minimum", |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 854 | } |
| 855 | `) |
| 856 | |
Paul Duffin | 1356d8c | 2020-02-25 19:26:33 +0000 | [diff] [blame] | 857 | result.CheckSnapshot("mysdk", "", |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 858 | checkAndroidBpContents(` |
| 859 | // This is auto-generated. DO NOT EDIT. |
| 860 | |
| 861 | cc_prebuilt_library_shared { |
| 862 | name: "mysdk_mynativelib@current", |
| 863 | sdk_member_name: "mynativelib", |
| 864 | device_supported: false, |
| 865 | host_supported: true, |
Paul Duffin | 0cb37b9 | 2020-03-04 14:52:46 +0000 | [diff] [blame] | 866 | installable: false, |
Paul Duffin | 0c394f3 | 2020-03-05 14:09:58 +0000 | [diff] [blame] | 867 | sdk_version: "minimum", |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 868 | stl: "none", |
Paul Duffin | 57b9e1d | 2019-12-13 00:03:35 +0000 | [diff] [blame] | 869 | export_include_dirs: ["include/include"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 870 | arch: { |
| 871 | x86_64: { |
| 872 | srcs: ["x86_64/lib/mynativelib.so"], |
Paul Duffin | 57b9e1d | 2019-12-13 00:03:35 +0000 | [diff] [blame] | 873 | export_include_dirs: ["x86_64/include_gen/mynativelib"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 874 | }, |
| 875 | x86: { |
| 876 | srcs: ["x86/lib/mynativelib.so"], |
Paul Duffin | 57b9e1d | 2019-12-13 00:03:35 +0000 | [diff] [blame] | 877 | export_include_dirs: ["x86/include_gen/mynativelib"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 878 | }, |
| 879 | }, |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 880 | } |
| 881 | |
| 882 | cc_prebuilt_library_shared { |
| 883 | name: "mynativelib", |
| 884 | prefer: false, |
| 885 | device_supported: false, |
| 886 | host_supported: true, |
Paul Duffin | 0c394f3 | 2020-03-05 14:09:58 +0000 | [diff] [blame] | 887 | sdk_version: "minimum", |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 888 | stl: "none", |
Paul Duffin | 57b9e1d | 2019-12-13 00:03:35 +0000 | [diff] [blame] | 889 | export_include_dirs: ["include/include"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 890 | arch: { |
| 891 | x86_64: { |
| 892 | srcs: ["x86_64/lib/mynativelib.so"], |
Paul Duffin | 57b9e1d | 2019-12-13 00:03:35 +0000 | [diff] [blame] | 893 | export_include_dirs: ["x86_64/include_gen/mynativelib"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 894 | }, |
| 895 | x86: { |
| 896 | srcs: ["x86/lib/mynativelib.so"], |
Paul Duffin | 57b9e1d | 2019-12-13 00:03:35 +0000 | [diff] [blame] | 897 | export_include_dirs: ["x86/include_gen/mynativelib"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 898 | }, |
| 899 | }, |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 900 | } |
| 901 | |
| 902 | sdk_snapshot { |
| 903 | name: "mysdk@current", |
| 904 | device_supported: false, |
| 905 | host_supported: true, |
| 906 | native_shared_libs: ["mysdk_mynativelib@current"], |
| 907 | } |
| 908 | `), |
| 909 | checkAllCopyRules(` |
Paul Duffin | 57b9e1d | 2019-12-13 00:03:35 +0000 | [diff] [blame] | 910 | include/Test.h -> include/include/Test.h |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 911 | .intermediates/mynativelib/linux_glibc_x86_64_shared/mynativelib.so -> x86_64/lib/mynativelib.so |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 912 | .intermediates/mynativelib/linux_glibc_x86_64_shared/gen/aidl/aidl/foo/bar/Test.h -> x86_64/include_gen/mynativelib/aidl/foo/bar/Test.h |
| 913 | .intermediates/mynativelib/linux_glibc_x86_64_shared/gen/aidl/aidl/foo/bar/BnTest.h -> x86_64/include_gen/mynativelib/aidl/foo/bar/BnTest.h |
| 914 | .intermediates/mynativelib/linux_glibc_x86_64_shared/gen/aidl/aidl/foo/bar/BpTest.h -> x86_64/include_gen/mynativelib/aidl/foo/bar/BpTest.h |
| 915 | .intermediates/mynativelib/linux_glibc_x86_shared/mynativelib.so -> x86/lib/mynativelib.so |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 916 | .intermediates/mynativelib/linux_glibc_x86_shared/gen/aidl/aidl/foo/bar/Test.h -> x86/include_gen/mynativelib/aidl/foo/bar/Test.h |
| 917 | .intermediates/mynativelib/linux_glibc_x86_shared/gen/aidl/aidl/foo/bar/BnTest.h -> x86/include_gen/mynativelib/aidl/foo/bar/BnTest.h |
| 918 | .intermediates/mynativelib/linux_glibc_x86_shared/gen/aidl/aidl/foo/bar/BpTest.h -> x86/include_gen/mynativelib/aidl/foo/bar/BpTest.h |
| 919 | `), |
| 920 | ) |
| 921 | } |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 922 | |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 923 | func TestMultipleHostOsTypesSnapshotWithCcSharedLibrary(t *testing.T) { |
| 924 | // b/145598135 - Generating host snapshots for anything other than linux is not supported. |
| 925 | SkipIfNotLinux(t) |
| 926 | |
| 927 | result := testSdkWithCc(t, ` |
| 928 | sdk { |
| 929 | name: "mysdk", |
| 930 | device_supported: false, |
| 931 | host_supported: true, |
| 932 | native_shared_libs: ["mynativelib"], |
| 933 | target: { |
| 934 | windows: { |
| 935 | enabled: true, |
| 936 | }, |
| 937 | }, |
| 938 | } |
| 939 | |
| 940 | cc_library_shared { |
| 941 | name: "mynativelib", |
| 942 | device_supported: false, |
| 943 | host_supported: true, |
| 944 | srcs: [ |
| 945 | "Test.cpp", |
| 946 | ], |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 947 | stl: "none", |
| 948 | target: { |
| 949 | windows: { |
| 950 | enabled: true, |
| 951 | }, |
| 952 | }, |
| 953 | } |
| 954 | `) |
| 955 | |
| 956 | result.CheckSnapshot("mysdk", "", |
| 957 | checkAndroidBpContents(` |
| 958 | // This is auto-generated. DO NOT EDIT. |
| 959 | |
| 960 | cc_prebuilt_library_shared { |
| 961 | name: "mysdk_mynativelib@current", |
| 962 | sdk_member_name: "mynativelib", |
| 963 | device_supported: false, |
| 964 | host_supported: true, |
Paul Duffin | 0cb37b9 | 2020-03-04 14:52:46 +0000 | [diff] [blame] | 965 | installable: false, |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 966 | stl: "none", |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 967 | target: { |
| 968 | linux_glibc_x86_64: { |
| 969 | srcs: ["linux_glibc/x86_64/lib/mynativelib.so"], |
| 970 | }, |
| 971 | linux_glibc_x86: { |
| 972 | srcs: ["linux_glibc/x86/lib/mynativelib.so"], |
| 973 | }, |
| 974 | windows_x86_64: { |
| 975 | srcs: ["windows/x86_64/lib/mynativelib.dll"], |
| 976 | }, |
| 977 | }, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 978 | } |
| 979 | |
| 980 | cc_prebuilt_library_shared { |
| 981 | name: "mynativelib", |
| 982 | prefer: false, |
| 983 | device_supported: false, |
| 984 | host_supported: true, |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 985 | stl: "none", |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 986 | target: { |
| 987 | linux_glibc_x86_64: { |
| 988 | srcs: ["linux_glibc/x86_64/lib/mynativelib.so"], |
| 989 | }, |
| 990 | linux_glibc_x86: { |
| 991 | srcs: ["linux_glibc/x86/lib/mynativelib.so"], |
| 992 | }, |
| 993 | windows_x86_64: { |
| 994 | srcs: ["windows/x86_64/lib/mynativelib.dll"], |
| 995 | }, |
| 996 | }, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 997 | } |
| 998 | |
| 999 | sdk_snapshot { |
| 1000 | name: "mysdk@current", |
| 1001 | device_supported: false, |
| 1002 | host_supported: true, |
| 1003 | native_shared_libs: ["mysdk_mynativelib@current"], |
Paul Duffin | 6a7e953 | 2020-03-20 17:50:07 +0000 | [diff] [blame] | 1004 | target: { |
| 1005 | windows: { |
| 1006 | compile_multilib: "64", |
| 1007 | }, |
| 1008 | }, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1009 | } |
| 1010 | `), |
| 1011 | checkAllCopyRules(` |
| 1012 | .intermediates/mynativelib/linux_glibc_x86_64_shared/mynativelib.so -> linux_glibc/x86_64/lib/mynativelib.so |
| 1013 | .intermediates/mynativelib/linux_glibc_x86_shared/mynativelib.so -> linux_glibc/x86/lib/mynativelib.so |
| 1014 | .intermediates/mynativelib/windows_x86_64_shared/mynativelib.dll -> windows/x86_64/lib/mynativelib.dll |
| 1015 | `), |
| 1016 | ) |
| 1017 | } |
| 1018 | |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1019 | func TestSnapshotWithCcStaticLibrary(t *testing.T) { |
| 1020 | result := testSdkWithCc(t, ` |
Paul Duffin | e602918 | 2019-12-16 17:43:48 +0000 | [diff] [blame] | 1021 | module_exports { |
| 1022 | name: "myexports", |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1023 | native_static_libs: ["mynativelib"], |
| 1024 | } |
| 1025 | |
| 1026 | cc_library_static { |
| 1027 | name: "mynativelib", |
| 1028 | srcs: [ |
| 1029 | "Test.cpp", |
| 1030 | "aidl/foo/bar/Test.aidl", |
| 1031 | ], |
| 1032 | export_include_dirs: ["include"], |
| 1033 | aidl: { |
| 1034 | export_aidl_headers: true, |
| 1035 | }, |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1036 | stl: "none", |
| 1037 | } |
| 1038 | `) |
| 1039 | |
Paul Duffin | 1356d8c | 2020-02-25 19:26:33 +0000 | [diff] [blame] | 1040 | result.CheckSnapshot("myexports", "", |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1041 | checkAndroidBpContents(` |
| 1042 | // This is auto-generated. DO NOT EDIT. |
| 1043 | |
| 1044 | cc_prebuilt_library_static { |
Paul Duffin | e602918 | 2019-12-16 17:43:48 +0000 | [diff] [blame] | 1045 | name: "myexports_mynativelib@current", |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1046 | sdk_member_name: "mynativelib", |
Paul Duffin | 0cb37b9 | 2020-03-04 14:52:46 +0000 | [diff] [blame] | 1047 | installable: false, |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 1048 | stl: "none", |
Paul Duffin | 57b9e1d | 2019-12-13 00:03:35 +0000 | [diff] [blame] | 1049 | export_include_dirs: ["include/include"], |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1050 | arch: { |
| 1051 | arm64: { |
| 1052 | srcs: ["arm64/lib/mynativelib.a"], |
Paul Duffin | 57b9e1d | 2019-12-13 00:03:35 +0000 | [diff] [blame] | 1053 | export_include_dirs: ["arm64/include_gen/mynativelib"], |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1054 | }, |
| 1055 | arm: { |
| 1056 | srcs: ["arm/lib/mynativelib.a"], |
Paul Duffin | 57b9e1d | 2019-12-13 00:03:35 +0000 | [diff] [blame] | 1057 | export_include_dirs: ["arm/include_gen/mynativelib"], |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1058 | }, |
| 1059 | }, |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1060 | } |
| 1061 | |
| 1062 | cc_prebuilt_library_static { |
| 1063 | name: "mynativelib", |
| 1064 | prefer: false, |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 1065 | stl: "none", |
Paul Duffin | 57b9e1d | 2019-12-13 00:03:35 +0000 | [diff] [blame] | 1066 | export_include_dirs: ["include/include"], |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1067 | arch: { |
| 1068 | arm64: { |
| 1069 | srcs: ["arm64/lib/mynativelib.a"], |
Paul Duffin | 57b9e1d | 2019-12-13 00:03:35 +0000 | [diff] [blame] | 1070 | export_include_dirs: ["arm64/include_gen/mynativelib"], |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1071 | }, |
| 1072 | arm: { |
| 1073 | srcs: ["arm/lib/mynativelib.a"], |
Paul Duffin | 57b9e1d | 2019-12-13 00:03:35 +0000 | [diff] [blame] | 1074 | export_include_dirs: ["arm/include_gen/mynativelib"], |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1075 | }, |
| 1076 | }, |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1077 | } |
| 1078 | |
Paul Duffin | e602918 | 2019-12-16 17:43:48 +0000 | [diff] [blame] | 1079 | module_exports_snapshot { |
| 1080 | name: "myexports@current", |
| 1081 | native_static_libs: ["myexports_mynativelib@current"], |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1082 | } |
| 1083 | `), |
| 1084 | checkAllCopyRules(` |
Paul Duffin | 57b9e1d | 2019-12-13 00:03:35 +0000 | [diff] [blame] | 1085 | include/Test.h -> include/include/Test.h |
Colin Cross | 7113d20 | 2019-11-20 16:39:12 -0800 | [diff] [blame] | 1086 | .intermediates/mynativelib/android_arm64_armv8-a_static/mynativelib.a -> arm64/lib/mynativelib.a |
| 1087 | .intermediates/mynativelib/android_arm64_armv8-a_static/gen/aidl/aidl/foo/bar/Test.h -> arm64/include_gen/mynativelib/aidl/foo/bar/Test.h |
| 1088 | .intermediates/mynativelib/android_arm64_armv8-a_static/gen/aidl/aidl/foo/bar/BnTest.h -> arm64/include_gen/mynativelib/aidl/foo/bar/BnTest.h |
| 1089 | .intermediates/mynativelib/android_arm64_armv8-a_static/gen/aidl/aidl/foo/bar/BpTest.h -> arm64/include_gen/mynativelib/aidl/foo/bar/BpTest.h |
| 1090 | .intermediates/mynativelib/android_arm_armv7-a-neon_static/mynativelib.a -> arm/lib/mynativelib.a |
| 1091 | .intermediates/mynativelib/android_arm_armv7-a-neon_static/gen/aidl/aidl/foo/bar/Test.h -> arm/include_gen/mynativelib/aidl/foo/bar/Test.h |
| 1092 | .intermediates/mynativelib/android_arm_armv7-a-neon_static/gen/aidl/aidl/foo/bar/BnTest.h -> arm/include_gen/mynativelib/aidl/foo/bar/BnTest.h |
| 1093 | .intermediates/mynativelib/android_arm_armv7-a-neon_static/gen/aidl/aidl/foo/bar/BpTest.h -> arm/include_gen/mynativelib/aidl/foo/bar/BpTest.h |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1094 | `), |
| 1095 | ) |
| 1096 | } |
| 1097 | |
| 1098 | func TestHostSnapshotWithCcStaticLibrary(t *testing.T) { |
| 1099 | // b/145598135 - Generating host snapshots for anything other than linux is not supported. |
| 1100 | SkipIfNotLinux(t) |
| 1101 | |
| 1102 | result := testSdkWithCc(t, ` |
Paul Duffin | e602918 | 2019-12-16 17:43:48 +0000 | [diff] [blame] | 1103 | module_exports { |
| 1104 | name: "myexports", |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1105 | device_supported: false, |
| 1106 | host_supported: true, |
| 1107 | native_static_libs: ["mynativelib"], |
| 1108 | } |
| 1109 | |
| 1110 | cc_library_static { |
| 1111 | name: "mynativelib", |
| 1112 | device_supported: false, |
| 1113 | host_supported: true, |
| 1114 | srcs: [ |
| 1115 | "Test.cpp", |
| 1116 | "aidl/foo/bar/Test.aidl", |
| 1117 | ], |
| 1118 | export_include_dirs: ["include"], |
| 1119 | aidl: { |
| 1120 | export_aidl_headers: true, |
| 1121 | }, |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1122 | stl: "none", |
| 1123 | } |
| 1124 | `) |
| 1125 | |
Paul Duffin | 1356d8c | 2020-02-25 19:26:33 +0000 | [diff] [blame] | 1126 | result.CheckSnapshot("myexports", "", |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1127 | checkAndroidBpContents(` |
| 1128 | // This is auto-generated. DO NOT EDIT. |
| 1129 | |
| 1130 | cc_prebuilt_library_static { |
Paul Duffin | e602918 | 2019-12-16 17:43:48 +0000 | [diff] [blame] | 1131 | name: "myexports_mynativelib@current", |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1132 | sdk_member_name: "mynativelib", |
| 1133 | device_supported: false, |
| 1134 | host_supported: true, |
Paul Duffin | 0cb37b9 | 2020-03-04 14:52:46 +0000 | [diff] [blame] | 1135 | installable: false, |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 1136 | stl: "none", |
Paul Duffin | 57b9e1d | 2019-12-13 00:03:35 +0000 | [diff] [blame] | 1137 | export_include_dirs: ["include/include"], |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1138 | arch: { |
| 1139 | x86_64: { |
| 1140 | srcs: ["x86_64/lib/mynativelib.a"], |
Paul Duffin | 57b9e1d | 2019-12-13 00:03:35 +0000 | [diff] [blame] | 1141 | export_include_dirs: ["x86_64/include_gen/mynativelib"], |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1142 | }, |
| 1143 | x86: { |
| 1144 | srcs: ["x86/lib/mynativelib.a"], |
Paul Duffin | 57b9e1d | 2019-12-13 00:03:35 +0000 | [diff] [blame] | 1145 | export_include_dirs: ["x86/include_gen/mynativelib"], |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1146 | }, |
| 1147 | }, |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1148 | } |
| 1149 | |
| 1150 | cc_prebuilt_library_static { |
| 1151 | name: "mynativelib", |
| 1152 | prefer: false, |
| 1153 | device_supported: false, |
| 1154 | host_supported: true, |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 1155 | stl: "none", |
Paul Duffin | 57b9e1d | 2019-12-13 00:03:35 +0000 | [diff] [blame] | 1156 | export_include_dirs: ["include/include"], |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1157 | arch: { |
| 1158 | x86_64: { |
| 1159 | srcs: ["x86_64/lib/mynativelib.a"], |
Paul Duffin | 57b9e1d | 2019-12-13 00:03:35 +0000 | [diff] [blame] | 1160 | export_include_dirs: ["x86_64/include_gen/mynativelib"], |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1161 | }, |
| 1162 | x86: { |
| 1163 | srcs: ["x86/lib/mynativelib.a"], |
Paul Duffin | 57b9e1d | 2019-12-13 00:03:35 +0000 | [diff] [blame] | 1164 | export_include_dirs: ["x86/include_gen/mynativelib"], |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1165 | }, |
| 1166 | }, |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1167 | } |
| 1168 | |
Paul Duffin | e602918 | 2019-12-16 17:43:48 +0000 | [diff] [blame] | 1169 | module_exports_snapshot { |
| 1170 | name: "myexports@current", |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1171 | device_supported: false, |
| 1172 | host_supported: true, |
Paul Duffin | e602918 | 2019-12-16 17:43:48 +0000 | [diff] [blame] | 1173 | native_static_libs: ["myexports_mynativelib@current"], |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1174 | } |
| 1175 | `), |
| 1176 | checkAllCopyRules(` |
Paul Duffin | 57b9e1d | 2019-12-13 00:03:35 +0000 | [diff] [blame] | 1177 | include/Test.h -> include/include/Test.h |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1178 | .intermediates/mynativelib/linux_glibc_x86_64_static/mynativelib.a -> x86_64/lib/mynativelib.a |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1179 | .intermediates/mynativelib/linux_glibc_x86_64_static/gen/aidl/aidl/foo/bar/Test.h -> x86_64/include_gen/mynativelib/aidl/foo/bar/Test.h |
| 1180 | .intermediates/mynativelib/linux_glibc_x86_64_static/gen/aidl/aidl/foo/bar/BnTest.h -> x86_64/include_gen/mynativelib/aidl/foo/bar/BnTest.h |
| 1181 | .intermediates/mynativelib/linux_glibc_x86_64_static/gen/aidl/aidl/foo/bar/BpTest.h -> x86_64/include_gen/mynativelib/aidl/foo/bar/BpTest.h |
| 1182 | .intermediates/mynativelib/linux_glibc_x86_static/mynativelib.a -> x86/lib/mynativelib.a |
Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1183 | .intermediates/mynativelib/linux_glibc_x86_static/gen/aidl/aidl/foo/bar/Test.h -> x86/include_gen/mynativelib/aidl/foo/bar/Test.h |
| 1184 | .intermediates/mynativelib/linux_glibc_x86_static/gen/aidl/aidl/foo/bar/BnTest.h -> x86/include_gen/mynativelib/aidl/foo/bar/BnTest.h |
| 1185 | .intermediates/mynativelib/linux_glibc_x86_static/gen/aidl/aidl/foo/bar/BpTest.h -> x86/include_gen/mynativelib/aidl/foo/bar/BpTest.h |
| 1186 | `), |
| 1187 | ) |
| 1188 | } |
Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1189 | |
Paul Duffin | 9b76c0b | 2020-03-12 10:24:35 +0000 | [diff] [blame] | 1190 | func TestSnapshotWithCcLibrary(t *testing.T) { |
| 1191 | result := testSdkWithCc(t, ` |
| 1192 | module_exports { |
| 1193 | name: "myexports", |
| 1194 | native_libs: ["mynativelib"], |
| 1195 | } |
| 1196 | |
| 1197 | cc_library { |
| 1198 | name: "mynativelib", |
| 1199 | srcs: [ |
| 1200 | "Test.cpp", |
| 1201 | ], |
| 1202 | export_include_dirs: ["include"], |
Paul Duffin | 9b76c0b | 2020-03-12 10:24:35 +0000 | [diff] [blame] | 1203 | stl: "none", |
| 1204 | } |
| 1205 | `) |
| 1206 | |
| 1207 | result.CheckSnapshot("myexports", "", |
| 1208 | checkAndroidBpContents(` |
| 1209 | // This is auto-generated. DO NOT EDIT. |
| 1210 | |
| 1211 | cc_prebuilt_library { |
| 1212 | name: "myexports_mynativelib@current", |
| 1213 | sdk_member_name: "mynativelib", |
| 1214 | installable: false, |
| 1215 | stl: "none", |
| 1216 | export_include_dirs: ["include/include"], |
| 1217 | arch: { |
| 1218 | arm64: { |
| 1219 | static: { |
| 1220 | srcs: ["arm64/lib/mynativelib.a"], |
| 1221 | }, |
| 1222 | shared: { |
| 1223 | srcs: ["arm64/lib/mynativelib.so"], |
| 1224 | }, |
| 1225 | }, |
| 1226 | arm: { |
| 1227 | static: { |
| 1228 | srcs: ["arm/lib/mynativelib.a"], |
| 1229 | }, |
| 1230 | shared: { |
| 1231 | srcs: ["arm/lib/mynativelib.so"], |
| 1232 | }, |
| 1233 | }, |
| 1234 | }, |
| 1235 | } |
| 1236 | |
| 1237 | cc_prebuilt_library { |
| 1238 | name: "mynativelib", |
| 1239 | prefer: false, |
| 1240 | stl: "none", |
| 1241 | export_include_dirs: ["include/include"], |
| 1242 | arch: { |
| 1243 | arm64: { |
| 1244 | static: { |
| 1245 | srcs: ["arm64/lib/mynativelib.a"], |
| 1246 | }, |
| 1247 | shared: { |
| 1248 | srcs: ["arm64/lib/mynativelib.so"], |
| 1249 | }, |
| 1250 | }, |
| 1251 | arm: { |
| 1252 | static: { |
| 1253 | srcs: ["arm/lib/mynativelib.a"], |
| 1254 | }, |
| 1255 | shared: { |
| 1256 | srcs: ["arm/lib/mynativelib.so"], |
| 1257 | }, |
| 1258 | }, |
| 1259 | }, |
| 1260 | } |
| 1261 | |
| 1262 | module_exports_snapshot { |
| 1263 | name: "myexports@current", |
| 1264 | native_libs: ["myexports_mynativelib@current"], |
| 1265 | } |
| 1266 | `), |
| 1267 | checkAllCopyRules(` |
| 1268 | include/Test.h -> include/include/Test.h |
| 1269 | .intermediates/mynativelib/android_arm64_armv8-a_static/mynativelib.a -> arm64/lib/mynativelib.a |
| 1270 | .intermediates/mynativelib/android_arm64_armv8-a_shared/mynativelib.so -> arm64/lib/mynativelib.so |
| 1271 | .intermediates/mynativelib/android_arm_armv7-a-neon_static/mynativelib.a -> arm/lib/mynativelib.a |
| 1272 | .intermediates/mynativelib/android_arm_armv7-a-neon_shared/mynativelib.so -> arm/lib/mynativelib.so`), |
| 1273 | ) |
| 1274 | } |
| 1275 | |
Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1276 | func TestHostSnapshotWithMultiLib64(t *testing.T) { |
| 1277 | // b/145598135 - Generating host snapshots for anything other than linux is not supported. |
| 1278 | SkipIfNotLinux(t) |
| 1279 | |
| 1280 | result := testSdkWithCc(t, ` |
| 1281 | module_exports { |
| 1282 | name: "myexports", |
| 1283 | device_supported: false, |
| 1284 | host_supported: true, |
| 1285 | target: { |
| 1286 | host: { |
| 1287 | compile_multilib: "64", |
| 1288 | }, |
| 1289 | }, |
| 1290 | native_static_libs: ["mynativelib"], |
| 1291 | } |
| 1292 | |
| 1293 | cc_library_static { |
| 1294 | name: "mynativelib", |
| 1295 | device_supported: false, |
| 1296 | host_supported: true, |
| 1297 | srcs: [ |
| 1298 | "Test.cpp", |
| 1299 | "aidl/foo/bar/Test.aidl", |
| 1300 | ], |
| 1301 | export_include_dirs: ["include"], |
| 1302 | aidl: { |
| 1303 | export_aidl_headers: true, |
| 1304 | }, |
Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1305 | stl: "none", |
| 1306 | } |
| 1307 | `) |
| 1308 | |
Paul Duffin | 1356d8c | 2020-02-25 19:26:33 +0000 | [diff] [blame] | 1309 | result.CheckSnapshot("myexports", "", |
Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1310 | checkAndroidBpContents(` |
| 1311 | // This is auto-generated. DO NOT EDIT. |
| 1312 | |
| 1313 | cc_prebuilt_library_static { |
| 1314 | name: "myexports_mynativelib@current", |
| 1315 | sdk_member_name: "mynativelib", |
| 1316 | device_supported: false, |
| 1317 | host_supported: true, |
Paul Duffin | 0cb37b9 | 2020-03-04 14:52:46 +0000 | [diff] [blame] | 1318 | installable: false, |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 1319 | stl: "none", |
Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1320 | export_include_dirs: ["include/include"], |
| 1321 | arch: { |
| 1322 | x86_64: { |
| 1323 | srcs: ["x86_64/lib/mynativelib.a"], |
| 1324 | export_include_dirs: ["x86_64/include_gen/mynativelib"], |
| 1325 | }, |
| 1326 | }, |
Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1327 | } |
| 1328 | |
| 1329 | cc_prebuilt_library_static { |
| 1330 | name: "mynativelib", |
| 1331 | prefer: false, |
| 1332 | device_supported: false, |
| 1333 | host_supported: true, |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 1334 | stl: "none", |
Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1335 | export_include_dirs: ["include/include"], |
| 1336 | arch: { |
| 1337 | x86_64: { |
| 1338 | srcs: ["x86_64/lib/mynativelib.a"], |
| 1339 | export_include_dirs: ["x86_64/include_gen/mynativelib"], |
| 1340 | }, |
| 1341 | }, |
Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1342 | } |
| 1343 | |
| 1344 | module_exports_snapshot { |
| 1345 | name: "myexports@current", |
| 1346 | device_supported: false, |
| 1347 | host_supported: true, |
Paul Duffin | 07ef3cb | 2020-03-11 18:17:42 +0000 | [diff] [blame] | 1348 | native_static_libs: ["myexports_mynativelib@current"], |
Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1349 | target: { |
Paul Duffin | 6a7e953 | 2020-03-20 17:50:07 +0000 | [diff] [blame] | 1350 | linux_glibc: { |
Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1351 | compile_multilib: "64", |
| 1352 | }, |
| 1353 | }, |
Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1354 | }`), |
| 1355 | checkAllCopyRules(` |
| 1356 | include/Test.h -> include/include/Test.h |
| 1357 | .intermediates/mynativelib/linux_glibc_x86_64_static/mynativelib.a -> x86_64/lib/mynativelib.a |
| 1358 | .intermediates/mynativelib/linux_glibc_x86_64_static/gen/aidl/aidl/foo/bar/Test.h -> x86_64/include_gen/mynativelib/aidl/foo/bar/Test.h |
| 1359 | .intermediates/mynativelib/linux_glibc_x86_64_static/gen/aidl/aidl/foo/bar/BnTest.h -> x86_64/include_gen/mynativelib/aidl/foo/bar/BnTest.h |
| 1360 | .intermediates/mynativelib/linux_glibc_x86_64_static/gen/aidl/aidl/foo/bar/BpTest.h -> x86_64/include_gen/mynativelib/aidl/foo/bar/BpTest.h |
| 1361 | `), |
| 1362 | ) |
| 1363 | } |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1364 | |
| 1365 | func TestSnapshotWithCcHeadersLibrary(t *testing.T) { |
| 1366 | result := testSdkWithCc(t, ` |
| 1367 | sdk { |
| 1368 | name: "mysdk", |
| 1369 | native_header_libs: ["mynativeheaders"], |
| 1370 | } |
| 1371 | |
| 1372 | cc_library_headers { |
| 1373 | name: "mynativeheaders", |
| 1374 | export_include_dirs: ["include"], |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1375 | stl: "none", |
| 1376 | } |
| 1377 | `) |
| 1378 | |
Paul Duffin | 1356d8c | 2020-02-25 19:26:33 +0000 | [diff] [blame] | 1379 | result.CheckSnapshot("mysdk", "", |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1380 | checkAndroidBpContents(` |
| 1381 | // This is auto-generated. DO NOT EDIT. |
| 1382 | |
| 1383 | cc_prebuilt_library_headers { |
| 1384 | name: "mysdk_mynativeheaders@current", |
| 1385 | sdk_member_name: "mynativeheaders", |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1386 | stl: "none", |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 1387 | export_include_dirs: ["include/include"], |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1388 | } |
| 1389 | |
| 1390 | cc_prebuilt_library_headers { |
| 1391 | name: "mynativeheaders", |
| 1392 | prefer: false, |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1393 | stl: "none", |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 1394 | export_include_dirs: ["include/include"], |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1395 | } |
| 1396 | |
| 1397 | sdk_snapshot { |
| 1398 | name: "mysdk@current", |
| 1399 | native_header_libs: ["mysdk_mynativeheaders@current"], |
| 1400 | } |
| 1401 | `), |
| 1402 | checkAllCopyRules(` |
| 1403 | include/Test.h -> include/include/Test.h |
| 1404 | `), |
| 1405 | ) |
| 1406 | } |
| 1407 | |
| 1408 | func TestHostSnapshotWithCcHeadersLibrary(t *testing.T) { |
| 1409 | // b/145598135 - Generating host snapshots for anything other than linux is not supported. |
| 1410 | SkipIfNotLinux(t) |
| 1411 | |
| 1412 | result := testSdkWithCc(t, ` |
| 1413 | sdk { |
| 1414 | name: "mysdk", |
| 1415 | device_supported: false, |
| 1416 | host_supported: true, |
| 1417 | native_header_libs: ["mynativeheaders"], |
| 1418 | } |
| 1419 | |
| 1420 | cc_library_headers { |
| 1421 | name: "mynativeheaders", |
| 1422 | device_supported: false, |
| 1423 | host_supported: true, |
| 1424 | export_include_dirs: ["include"], |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1425 | stl: "none", |
| 1426 | } |
| 1427 | `) |
| 1428 | |
Paul Duffin | 1356d8c | 2020-02-25 19:26:33 +0000 | [diff] [blame] | 1429 | result.CheckSnapshot("mysdk", "", |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1430 | checkAndroidBpContents(` |
| 1431 | // This is auto-generated. DO NOT EDIT. |
| 1432 | |
| 1433 | cc_prebuilt_library_headers { |
| 1434 | name: "mysdk_mynativeheaders@current", |
| 1435 | sdk_member_name: "mynativeheaders", |
| 1436 | device_supported: false, |
| 1437 | host_supported: true, |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1438 | stl: "none", |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 1439 | export_include_dirs: ["include/include"], |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1440 | } |
| 1441 | |
| 1442 | cc_prebuilt_library_headers { |
| 1443 | name: "mynativeheaders", |
| 1444 | prefer: false, |
| 1445 | device_supported: false, |
| 1446 | host_supported: true, |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1447 | stl: "none", |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 1448 | export_include_dirs: ["include/include"], |
Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1449 | } |
| 1450 | |
| 1451 | sdk_snapshot { |
| 1452 | name: "mysdk@current", |
| 1453 | device_supported: false, |
| 1454 | host_supported: true, |
| 1455 | native_header_libs: ["mysdk_mynativeheaders@current"], |
| 1456 | } |
| 1457 | `), |
| 1458 | checkAllCopyRules(` |
| 1459 | include/Test.h -> include/include/Test.h |
| 1460 | `), |
| 1461 | ) |
| 1462 | } |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1463 | |
| 1464 | func TestDeviceAndHostSnapshotWithCcHeadersLibrary(t *testing.T) { |
| 1465 | // b/145598135 - Generating host snapshots for anything other than linux is not supported. |
| 1466 | SkipIfNotLinux(t) |
| 1467 | |
| 1468 | result := testSdkWithCc(t, ` |
| 1469 | sdk { |
| 1470 | name: "mysdk", |
| 1471 | host_supported: true, |
| 1472 | native_header_libs: ["mynativeheaders"], |
| 1473 | } |
| 1474 | |
| 1475 | cc_library_headers { |
| 1476 | name: "mynativeheaders", |
| 1477 | host_supported: true, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1478 | stl: "none", |
| 1479 | export_system_include_dirs: ["include"], |
| 1480 | target: { |
| 1481 | android: { |
| 1482 | export_include_dirs: ["include-android"], |
| 1483 | }, |
| 1484 | host: { |
| 1485 | export_include_dirs: ["include-host"], |
| 1486 | }, |
| 1487 | }, |
| 1488 | } |
| 1489 | `) |
| 1490 | |
| 1491 | result.CheckSnapshot("mysdk", "", |
| 1492 | checkAndroidBpContents(` |
| 1493 | // This is auto-generated. DO NOT EDIT. |
| 1494 | |
| 1495 | cc_prebuilt_library_headers { |
| 1496 | name: "mysdk_mynativeheaders@current", |
| 1497 | sdk_member_name: "mynativeheaders", |
| 1498 | host_supported: true, |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 1499 | stl: "none", |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1500 | export_system_include_dirs: ["include/include"], |
| 1501 | target: { |
| 1502 | android: { |
| 1503 | export_include_dirs: ["include/include-android"], |
| 1504 | }, |
| 1505 | linux_glibc: { |
| 1506 | export_include_dirs: ["include/include-host"], |
| 1507 | }, |
| 1508 | }, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1509 | } |
| 1510 | |
| 1511 | cc_prebuilt_library_headers { |
| 1512 | name: "mynativeheaders", |
| 1513 | prefer: false, |
| 1514 | host_supported: true, |
Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 1515 | stl: "none", |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1516 | export_system_include_dirs: ["include/include"], |
| 1517 | target: { |
| 1518 | android: { |
| 1519 | export_include_dirs: ["include/include-android"], |
| 1520 | }, |
| 1521 | linux_glibc: { |
| 1522 | export_include_dirs: ["include/include-host"], |
| 1523 | }, |
| 1524 | }, |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1525 | } |
| 1526 | |
| 1527 | sdk_snapshot { |
| 1528 | name: "mysdk@current", |
| 1529 | host_supported: true, |
| 1530 | native_header_libs: ["mysdk_mynativeheaders@current"], |
| 1531 | } |
| 1532 | `), |
| 1533 | checkAllCopyRules(` |
| 1534 | include/Test.h -> include/include/Test.h |
| 1535 | include-android/AndroidTest.h -> include/include-android/AndroidTest.h |
| 1536 | include-host/HostTest.h -> include/include-host/HostTest.h |
| 1537 | `), |
| 1538 | ) |
| 1539 | } |
Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 1540 | |
| 1541 | func TestSystemSharedLibPropagation(t *testing.T) { |
Martin Stjernholm | 66a0694 | 2020-03-26 17:39:30 +0000 | [diff] [blame^] | 1542 | // b/145598135 - Generating host snapshots for anything other than linux is not supported. |
| 1543 | SkipIfNotLinux(t) |
| 1544 | |
Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 1545 | result := testSdkWithCc(t, ` |
| 1546 | sdk { |
| 1547 | name: "mysdk", |
| 1548 | native_shared_libs: ["sslnil", "sslempty", "sslnonempty"], |
| 1549 | } |
| 1550 | |
| 1551 | cc_library { |
| 1552 | name: "sslnil", |
| 1553 | host_supported: true, |
| 1554 | } |
| 1555 | |
| 1556 | cc_library { |
| 1557 | name: "sslempty", |
| 1558 | system_shared_libs: [], |
| 1559 | } |
| 1560 | |
| 1561 | cc_library { |
| 1562 | name: "sslnonempty", |
| 1563 | system_shared_libs: ["sslnil"], |
| 1564 | } |
| 1565 | `) |
| 1566 | |
| 1567 | result.CheckSnapshot("mysdk", "", |
| 1568 | checkAndroidBpContents(` |
| 1569 | // This is auto-generated. DO NOT EDIT. |
| 1570 | |
| 1571 | cc_prebuilt_library_shared { |
| 1572 | name: "mysdk_sslnil@current", |
| 1573 | sdk_member_name: "sslnil", |
| 1574 | installable: false, |
| 1575 | arch: { |
| 1576 | arm64: { |
| 1577 | srcs: ["arm64/lib/sslnil.so"], |
| 1578 | }, |
| 1579 | arm: { |
| 1580 | srcs: ["arm/lib/sslnil.so"], |
| 1581 | }, |
| 1582 | }, |
| 1583 | } |
| 1584 | |
| 1585 | cc_prebuilt_library_shared { |
| 1586 | name: "sslnil", |
| 1587 | prefer: false, |
| 1588 | arch: { |
| 1589 | arm64: { |
| 1590 | srcs: ["arm64/lib/sslnil.so"], |
| 1591 | }, |
| 1592 | arm: { |
| 1593 | srcs: ["arm/lib/sslnil.so"], |
| 1594 | }, |
| 1595 | }, |
| 1596 | } |
| 1597 | |
| 1598 | cc_prebuilt_library_shared { |
| 1599 | name: "mysdk_sslempty@current", |
| 1600 | sdk_member_name: "sslempty", |
| 1601 | installable: false, |
| 1602 | system_shared_libs: [], |
| 1603 | arch: { |
| 1604 | arm64: { |
| 1605 | srcs: ["arm64/lib/sslempty.so"], |
| 1606 | }, |
| 1607 | arm: { |
| 1608 | srcs: ["arm/lib/sslempty.so"], |
| 1609 | }, |
| 1610 | }, |
| 1611 | } |
| 1612 | |
| 1613 | cc_prebuilt_library_shared { |
| 1614 | name: "sslempty", |
| 1615 | prefer: false, |
| 1616 | system_shared_libs: [], |
| 1617 | arch: { |
| 1618 | arm64: { |
| 1619 | srcs: ["arm64/lib/sslempty.so"], |
| 1620 | }, |
| 1621 | arm: { |
| 1622 | srcs: ["arm/lib/sslempty.so"], |
| 1623 | }, |
| 1624 | }, |
| 1625 | } |
| 1626 | |
| 1627 | cc_prebuilt_library_shared { |
| 1628 | name: "mysdk_sslnonempty@current", |
| 1629 | sdk_member_name: "sslnonempty", |
| 1630 | installable: false, |
| 1631 | system_shared_libs: ["mysdk_sslnil@current"], |
| 1632 | arch: { |
| 1633 | arm64: { |
| 1634 | srcs: ["arm64/lib/sslnonempty.so"], |
| 1635 | }, |
| 1636 | arm: { |
| 1637 | srcs: ["arm/lib/sslnonempty.so"], |
| 1638 | }, |
| 1639 | }, |
| 1640 | } |
| 1641 | |
| 1642 | cc_prebuilt_library_shared { |
| 1643 | name: "sslnonempty", |
| 1644 | prefer: false, |
| 1645 | system_shared_libs: ["sslnil"], |
| 1646 | arch: { |
| 1647 | arm64: { |
| 1648 | srcs: ["arm64/lib/sslnonempty.so"], |
| 1649 | }, |
| 1650 | arm: { |
| 1651 | srcs: ["arm/lib/sslnonempty.so"], |
| 1652 | }, |
| 1653 | }, |
| 1654 | } |
| 1655 | |
| 1656 | sdk_snapshot { |
| 1657 | name: "mysdk@current", |
| 1658 | native_shared_libs: [ |
| 1659 | "mysdk_sslnil@current", |
| 1660 | "mysdk_sslempty@current", |
| 1661 | "mysdk_sslnonempty@current", |
| 1662 | ], |
| 1663 | } |
| 1664 | `)) |
| 1665 | |
| 1666 | result = testSdkWithCc(t, ` |
| 1667 | sdk { |
| 1668 | name: "mysdk", |
| 1669 | host_supported: true, |
| 1670 | native_shared_libs: ["sslvariants"], |
| 1671 | } |
| 1672 | |
| 1673 | cc_library { |
| 1674 | name: "sslvariants", |
| 1675 | host_supported: true, |
| 1676 | target: { |
| 1677 | android: { |
| 1678 | system_shared_libs: [], |
| 1679 | }, |
| 1680 | }, |
| 1681 | } |
| 1682 | `) |
| 1683 | |
| 1684 | result.CheckSnapshot("mysdk", "", |
| 1685 | checkAndroidBpContents(` |
| 1686 | // This is auto-generated. DO NOT EDIT. |
| 1687 | |
| 1688 | cc_prebuilt_library_shared { |
| 1689 | name: "mysdk_sslvariants@current", |
| 1690 | sdk_member_name: "sslvariants", |
| 1691 | host_supported: true, |
| 1692 | installable: false, |
| 1693 | target: { |
| 1694 | android: { |
| 1695 | system_shared_libs: [], |
| 1696 | }, |
| 1697 | android_arm64: { |
| 1698 | srcs: ["android/arm64/lib/sslvariants.so"], |
| 1699 | }, |
| 1700 | android_arm: { |
| 1701 | srcs: ["android/arm/lib/sslvariants.so"], |
| 1702 | }, |
| 1703 | linux_glibc_x86_64: { |
| 1704 | srcs: ["linux_glibc/x86_64/lib/sslvariants.so"], |
| 1705 | }, |
| 1706 | linux_glibc_x86: { |
| 1707 | srcs: ["linux_glibc/x86/lib/sslvariants.so"], |
| 1708 | }, |
| 1709 | }, |
| 1710 | } |
| 1711 | |
| 1712 | cc_prebuilt_library_shared { |
| 1713 | name: "sslvariants", |
| 1714 | prefer: false, |
| 1715 | host_supported: true, |
| 1716 | target: { |
| 1717 | android: { |
| 1718 | system_shared_libs: [], |
| 1719 | }, |
| 1720 | android_arm64: { |
| 1721 | srcs: ["android/arm64/lib/sslvariants.so"], |
| 1722 | }, |
| 1723 | android_arm: { |
| 1724 | srcs: ["android/arm/lib/sslvariants.so"], |
| 1725 | }, |
| 1726 | linux_glibc_x86_64: { |
| 1727 | srcs: ["linux_glibc/x86_64/lib/sslvariants.so"], |
| 1728 | }, |
| 1729 | linux_glibc_x86: { |
| 1730 | srcs: ["linux_glibc/x86/lib/sslvariants.so"], |
| 1731 | }, |
| 1732 | }, |
| 1733 | } |
| 1734 | |
| 1735 | sdk_snapshot { |
| 1736 | name: "mysdk@current", |
| 1737 | host_supported: true, |
| 1738 | native_shared_libs: ["mysdk_sslvariants@current"], |
| 1739 | } |
| 1740 | `)) |
| 1741 | } |