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