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