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