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