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