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