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