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