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