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" |
Paul Duffin | cee7e66 | 2020-07-09 17:32:57 +0100 | [diff] [blame] | 19 | |
Paul Duffin | 4a2a29c | 2021-03-09 22:27:13 +0000 | [diff] [blame] | 20 | "android/soong/android" |
Paul Duffin | cee7e66 | 2020-07-09 17:32:57 +0100 | [diff] [blame] | 21 | "android/soong/java" |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 22 | ) |
| 23 | |
Paul Duffin | d14cbc1 | 2021-03-18 09:14:23 +0000 | [diff] [blame] | 24 | var prepareForSdkTestWithJava = android.GroupFixturePreparers( |
| 25 | java.PrepareForTestWithJavaBuildComponents, |
| 26 | PrepareForTestWithSdkBuildComponents, |
Paul Duffin | db462dd | 2021-03-21 22:01:55 +0000 | [diff] [blame] | 27 | |
| 28 | // Ensure that all source paths are provided. This helps ensure that the snapshot generation is |
| 29 | // consistent and all files referenced from the snapshot's Android.bp file have actually been |
| 30 | // copied into the snapshot. |
| 31 | android.PrepareForTestDisallowNonExistentPaths, |
| 32 | |
| 33 | // Files needs by most of the tests. |
| 34 | android.MockFS{ |
| 35 | "Test.java": nil, |
| 36 | }.AddToFixture(), |
Paul Duffin | d14cbc1 | 2021-03-18 09:14:23 +0000 | [diff] [blame] | 37 | ) |
| 38 | |
Paul Duffin | 9ec86b1 | 2021-03-15 11:17:52 +0000 | [diff] [blame] | 39 | var prepareForSdkTestWithJavaSdkLibrary = android.GroupFixturePreparers( |
| 40 | prepareForSdkTestWithJava, |
| 41 | java.PrepareForTestWithJavaDefaultModules, |
| 42 | java.PrepareForTestWithJavaSdkLibraryFiles, |
| 43 | java.FixtureWithLastReleaseApis("myjavalib"), |
| 44 | ) |
| 45 | |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 46 | // Contains tests for SDK members provided by the java package. |
| 47 | |
Paul Duffin | cee7e66 | 2020-07-09 17:32:57 +0100 | [diff] [blame] | 48 | func TestSdkDependsOnSourceEvenWhenPrebuiltPreferred(t *testing.T) { |
Paul Duffin | 9ec86b1 | 2021-03-15 11:17:52 +0000 | [diff] [blame] | 49 | result := android.GroupFixturePreparers(prepareForSdkTestWithJava).RunTestWithBp(t, ` |
Paul Duffin | cee7e66 | 2020-07-09 17:32:57 +0100 | [diff] [blame] | 50 | sdk { |
| 51 | name: "mysdk", |
| 52 | java_header_libs: ["sdkmember"], |
| 53 | } |
| 54 | |
| 55 | java_library { |
| 56 | name: "sdkmember", |
| 57 | srcs: ["Test.java"], |
| 58 | system_modules: "none", |
| 59 | sdk_version: "none", |
| 60 | } |
Paul Duffin | cee7e66 | 2020-07-09 17:32:57 +0100 | [diff] [blame] | 61 | `) |
| 62 | |
| 63 | // Make sure that the mysdk module depends on "sdkmember" and not "prebuilt_sdkmember". |
Paul Duffin | 1822a0a | 2021-03-21 12:56:33 +0000 | [diff] [blame] | 64 | sdkChecker := func(t *testing.T, result *android.TestResult) { |
| 65 | java.CheckModuleDependencies(t, result.TestContext, "mysdk", "android_common", []string{"sdkmember"}) |
| 66 | } |
Paul Duffin | cee7e66 | 2020-07-09 17:32:57 +0100 | [diff] [blame] | 67 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 68 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | 1822a0a | 2021-03-21 12:56:33 +0000 | [diff] [blame] | 69 | snapshotTestChecker(checkSnapshotWithSourcePreferred, sdkChecker), |
| 70 | snapshotTestChecker(checkSnapshotPreferredWithSource, sdkChecker), |
| 71 | ) |
Paul Duffin | cee7e66 | 2020-07-09 17:32:57 +0100 | [diff] [blame] | 72 | } |
| 73 | |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 74 | func TestBasicSdkWithJavaLibrary(t *testing.T) { |
Paul Duffin | 9ec86b1 | 2021-03-15 11:17:52 +0000 | [diff] [blame] | 75 | result := android.GroupFixturePreparers( |
| 76 | prepareForSdkTestWithJava, |
| 77 | prepareForSdkTestWithApex, |
| 78 | ).RunTestWithBp(t, ` |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 79 | sdk { |
| 80 | name: "mysdk", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 81 | java_header_libs: ["sdkmember"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 82 | } |
| 83 | |
| 84 | sdk_snapshot { |
| 85 | name: "mysdk@1", |
Paul Duffin | 525a590 | 2021-05-06 16:33:52 +0100 | [diff] [blame] | 86 | java_header_libs: ["sdkmember_mysdk@1"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 87 | } |
| 88 | |
| 89 | sdk_snapshot { |
| 90 | name: "mysdk@2", |
Paul Duffin | 525a590 | 2021-05-06 16:33:52 +0100 | [diff] [blame] | 91 | java_header_libs: ["sdkmember_mysdk@2"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 92 | } |
| 93 | |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 94 | java_library { |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 95 | name: "sdkmember", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 96 | srcs: ["Test.java"], |
| 97 | system_modules: "none", |
| 98 | sdk_version: "none", |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 99 | host_supported: true, |
| 100 | } |
| 101 | |
| 102 | java_import { |
Paul Duffin | 525a590 | 2021-05-06 16:33:52 +0100 | [diff] [blame] | 103 | name: "sdkmember_mysdk@1", |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 104 | sdk_member_name: "sdkmember", |
| 105 | host_supported: true, |
| 106 | } |
| 107 | |
| 108 | java_import { |
Paul Duffin | 525a590 | 2021-05-06 16:33:52 +0100 | [diff] [blame] | 109 | name: "sdkmember_mysdk@2", |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 110 | sdk_member_name: "sdkmember", |
| 111 | host_supported: true, |
| 112 | } |
| 113 | |
| 114 | java_library { |
| 115 | name: "myjavalib", |
| 116 | srcs: ["Test.java"], |
| 117 | libs: ["sdkmember"], |
| 118 | system_modules: "none", |
| 119 | sdk_version: "none", |
| 120 | compile_dex: true, |
| 121 | host_supported: true, |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 122 | apex_available: [ |
| 123 | "myapex", |
| 124 | "myapex2", |
| 125 | ], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 126 | } |
| 127 | |
| 128 | apex { |
| 129 | name: "myapex", |
| 130 | java_libs: ["myjavalib"], |
| 131 | uses_sdks: ["mysdk@1"], |
| 132 | key: "myapex.key", |
| 133 | certificate: ":myapex.cert", |
Mathew Inwood | f8dcf5e | 2021-02-16 11:40:16 +0000 | [diff] [blame] | 134 | updatable: false, |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 135 | } |
| 136 | |
| 137 | apex { |
| 138 | name: "myapex2", |
| 139 | java_libs: ["myjavalib"], |
| 140 | uses_sdks: ["mysdk@2"], |
| 141 | key: "myapex.key", |
| 142 | certificate: ":myapex.cert", |
Mathew Inwood | f8dcf5e | 2021-02-16 11:40:16 +0000 | [diff] [blame] | 143 | updatable: false, |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 144 | } |
| 145 | `) |
| 146 | |
Paul Duffin | 525a590 | 2021-05-06 16:33:52 +0100 | [diff] [blame] | 147 | sdkMemberV1 := result.ModuleForTests("sdkmember_mysdk@1", "android_common").Rule("combineJar").Output |
| 148 | sdkMemberV2 := result.ModuleForTests("sdkmember_mysdk@2", "android_common").Rule("combineJar").Output |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 149 | |
Paul Duffin | 8306f25 | 2021-03-11 12:18:24 +0000 | [diff] [blame] | 150 | javalibForMyApex := result.ModuleForTests("myjavalib", "android_common_apex10000_mysdk_1") |
| 151 | javalibForMyApex2 := result.ModuleForTests("myjavalib", "android_common_apex10000_mysdk_2") |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 152 | |
| 153 | // Depending on the uses_sdks value, different libs are linked |
| 154 | ensureListContains(t, pathsToStrings(javalibForMyApex.Rule("javac").Implicits), sdkMemberV1.String()) |
| 155 | ensureListContains(t, pathsToStrings(javalibForMyApex2.Rule("javac").Implicits), sdkMemberV2.String()) |
| 156 | } |
| 157 | |
Paul Duffin | a0dbf43 | 2019-12-05 11:25:53 +0000 | [diff] [blame] | 158 | func TestSnapshotWithJavaHeaderLibrary(t *testing.T) { |
Paul Duffin | 9ec86b1 | 2021-03-15 11:17:52 +0000 | [diff] [blame] | 159 | result := android.GroupFixturePreparers( |
| 160 | prepareForSdkTestWithJava, |
| 161 | android.FixtureAddFile("aidl/foo/bar/Test.aidl", nil), |
| 162 | ).RunTestWithBp(t, ` |
Paul Duffin | a0dbf43 | 2019-12-05 11:25:53 +0000 | [diff] [blame] | 163 | sdk { |
| 164 | name: "mysdk", |
| 165 | java_header_libs: ["myjavalib"], |
| 166 | } |
| 167 | |
| 168 | java_library { |
| 169 | name: "myjavalib", |
| 170 | srcs: ["Test.java"], |
| 171 | aidl: { |
| 172 | export_include_dirs: ["aidl"], |
| 173 | }, |
| 174 | system_modules: "none", |
| 175 | sdk_version: "none", |
| 176 | compile_dex: true, |
| 177 | host_supported: true, |
| 178 | } |
| 179 | `) |
| 180 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 181 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 182 | checkUnversionedAndroidBpContents(` |
| 183 | // This is auto-generated. DO NOT EDIT. |
| 184 | |
| 185 | java_import { |
| 186 | name: "myjavalib", |
| 187 | prefer: false, |
| 188 | visibility: ["//visibility:public"], |
| 189 | apex_available: ["//apex_available:platform"], |
| 190 | jars: ["java/myjavalib.jar"], |
| 191 | } |
| 192 | `), |
| 193 | checkVersionedAndroidBpContents(` |
Paul Duffin | a0dbf43 | 2019-12-05 11:25:53 +0000 | [diff] [blame] | 194 | // This is auto-generated. DO NOT EDIT. |
| 195 | |
| 196 | java_import { |
| 197 | name: "mysdk_myjavalib@current", |
| 198 | sdk_member_name: "myjavalib", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 199 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 200 | apex_available: ["//apex_available:platform"], |
Paul Duffin | a0dbf43 | 2019-12-05 11:25:53 +0000 | [diff] [blame] | 201 | jars: ["java/myjavalib.jar"], |
| 202 | } |
| 203 | |
Paul Duffin | a0dbf43 | 2019-12-05 11:25:53 +0000 | [diff] [blame] | 204 | sdk_snapshot { |
| 205 | name: "mysdk@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 206 | visibility: ["//visibility:public"], |
Paul Duffin | a0dbf43 | 2019-12-05 11:25:53 +0000 | [diff] [blame] | 207 | java_header_libs: ["mysdk_myjavalib@current"], |
| 208 | } |
Paul Duffin | a0dbf43 | 2019-12-05 11:25:53 +0000 | [diff] [blame] | 209 | `), |
| 210 | checkAllCopyRules(` |
| 211 | .intermediates/myjavalib/android_common/turbine-combined/myjavalib.jar -> java/myjavalib.jar |
| 212 | aidl/foo/bar/Test.aidl -> aidl/aidl/foo/bar/Test.aidl |
| 213 | `), |
| 214 | ) |
| 215 | } |
| 216 | |
| 217 | func TestHostSnapshotWithJavaHeaderLibrary(t *testing.T) { |
Paul Duffin | 9ec86b1 | 2021-03-15 11:17:52 +0000 | [diff] [blame] | 218 | result := android.GroupFixturePreparers( |
| 219 | prepareForSdkTestWithJava, |
| 220 | android.FixtureAddFile("aidl/foo/bar/Test.aidl", nil), |
| 221 | ).RunTestWithBp(t, ` |
Paul Duffin | a0dbf43 | 2019-12-05 11:25:53 +0000 | [diff] [blame] | 222 | sdk { |
| 223 | name: "mysdk", |
| 224 | device_supported: false, |
| 225 | host_supported: true, |
| 226 | java_header_libs: ["myjavalib"], |
| 227 | } |
| 228 | |
| 229 | java_library { |
| 230 | name: "myjavalib", |
| 231 | device_supported: false, |
| 232 | host_supported: true, |
| 233 | srcs: ["Test.java"], |
| 234 | aidl: { |
| 235 | export_include_dirs: ["aidl"], |
| 236 | }, |
| 237 | system_modules: "none", |
| 238 | sdk_version: "none", |
| 239 | compile_dex: true, |
| 240 | } |
| 241 | `) |
| 242 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 243 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 244 | checkUnversionedAndroidBpContents(` |
Paul Duffin | a0dbf43 | 2019-12-05 11:25:53 +0000 | [diff] [blame] | 245 | // This is auto-generated. DO NOT EDIT. |
| 246 | |
| 247 | java_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 248 | name: "myjavalib", |
| 249 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 250 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 251 | apex_available: ["//apex_available:platform"], |
Paul Duffin | a0dbf43 | 2019-12-05 11:25:53 +0000 | [diff] [blame] | 252 | device_supported: false, |
| 253 | host_supported: true, |
| 254 | jars: ["java/myjavalib.jar"], |
| 255 | } |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 256 | `), |
| 257 | checkVersionedAndroidBpContents(` |
| 258 | // This is auto-generated. DO NOT EDIT. |
Paul Duffin | a0dbf43 | 2019-12-05 11:25:53 +0000 | [diff] [blame] | 259 | |
| 260 | java_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 261 | name: "mysdk_myjavalib@current", |
| 262 | sdk_member_name: "myjavalib", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 263 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 264 | apex_available: ["//apex_available:platform"], |
Paul Duffin | a0dbf43 | 2019-12-05 11:25:53 +0000 | [diff] [blame] | 265 | device_supported: false, |
| 266 | host_supported: true, |
| 267 | jars: ["java/myjavalib.jar"], |
| 268 | } |
| 269 | |
| 270 | sdk_snapshot { |
| 271 | name: "mysdk@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 272 | visibility: ["//visibility:public"], |
Paul Duffin | a0dbf43 | 2019-12-05 11:25:53 +0000 | [diff] [blame] | 273 | device_supported: false, |
| 274 | host_supported: true, |
| 275 | java_header_libs: ["mysdk_myjavalib@current"], |
| 276 | } |
| 277 | `), |
| 278 | checkAllCopyRules(` |
| 279 | .intermediates/myjavalib/linux_glibc_common/javac/myjavalib.jar -> java/myjavalib.jar |
| 280 | aidl/foo/bar/Test.aidl -> aidl/aidl/foo/bar/Test.aidl |
| 281 | `), |
| 282 | ) |
| 283 | } |
| 284 | |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 285 | func TestDeviceAndHostSnapshotWithJavaHeaderLibrary(t *testing.T) { |
Paul Duffin | 9ec86b1 | 2021-03-15 11:17:52 +0000 | [diff] [blame] | 286 | result := android.GroupFixturePreparers(prepareForSdkTestWithJava).RunTestWithBp(t, ` |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 287 | sdk { |
| 288 | name: "mysdk", |
| 289 | host_supported: true, |
| 290 | java_header_libs: ["myjavalib"], |
| 291 | } |
| 292 | |
| 293 | java_library { |
| 294 | name: "myjavalib", |
| 295 | host_supported: true, |
| 296 | srcs: ["Test.java"], |
| 297 | system_modules: "none", |
| 298 | sdk_version: "none", |
| 299 | compile_dex: true, |
| 300 | } |
| 301 | `) |
| 302 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 303 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 304 | checkUnversionedAndroidBpContents(` |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 305 | // This is auto-generated. DO NOT EDIT. |
| 306 | |
| 307 | java_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 308 | name: "myjavalib", |
| 309 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 310 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 311 | apex_available: ["//apex_available:platform"], |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 312 | host_supported: true, |
| 313 | target: { |
| 314 | android: { |
| 315 | jars: ["java/android/myjavalib.jar"], |
| 316 | }, |
| 317 | linux_glibc: { |
| 318 | jars: ["java/linux_glibc/myjavalib.jar"], |
| 319 | }, |
| 320 | }, |
| 321 | } |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 322 | `), |
| 323 | checkVersionedAndroidBpContents(` |
| 324 | // This is auto-generated. DO NOT EDIT. |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 325 | |
| 326 | java_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 327 | name: "mysdk_myjavalib@current", |
| 328 | sdk_member_name: "myjavalib", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 329 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 330 | apex_available: ["//apex_available:platform"], |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 331 | host_supported: true, |
| 332 | target: { |
| 333 | android: { |
| 334 | jars: ["java/android/myjavalib.jar"], |
| 335 | }, |
| 336 | linux_glibc: { |
| 337 | jars: ["java/linux_glibc/myjavalib.jar"], |
| 338 | }, |
| 339 | }, |
| 340 | } |
| 341 | |
| 342 | sdk_snapshot { |
| 343 | name: "mysdk@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 344 | visibility: ["//visibility:public"], |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 345 | host_supported: true, |
| 346 | java_header_libs: ["mysdk_myjavalib@current"], |
| 347 | } |
| 348 | `), |
| 349 | checkAllCopyRules(` |
| 350 | .intermediates/myjavalib/android_common/turbine-combined/myjavalib.jar -> java/android/myjavalib.jar |
| 351 | .intermediates/myjavalib/linux_glibc_common/javac/myjavalib.jar -> java/linux_glibc/myjavalib.jar |
| 352 | `), |
| 353 | ) |
| 354 | } |
| 355 | |
Paul Duffin | a0dbf43 | 2019-12-05 11:25:53 +0000 | [diff] [blame] | 356 | func TestSnapshotWithJavaImplLibrary(t *testing.T) { |
Paul Duffin | 9ec86b1 | 2021-03-15 11:17:52 +0000 | [diff] [blame] | 357 | result := android.GroupFixturePreparers( |
| 358 | prepareForSdkTestWithJava, |
| 359 | android.FixtureAddFile("aidl/foo/bar/Test.aidl", nil), |
Paul Duffin | db462dd | 2021-03-21 22:01:55 +0000 | [diff] [blame] | 360 | android.FixtureAddFile("resource.txt", nil), |
Paul Duffin | 9ec86b1 | 2021-03-15 11:17:52 +0000 | [diff] [blame] | 361 | ).RunTestWithBp(t, ` |
Paul Duffin | e602918 | 2019-12-16 17:43:48 +0000 | [diff] [blame] | 362 | module_exports { |
| 363 | name: "myexports", |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 364 | java_libs: ["myjavalib"], |
| 365 | } |
| 366 | |
| 367 | java_library { |
| 368 | name: "myjavalib", |
| 369 | srcs: ["Test.java"], |
Paul Duffin | 4e77284 | 2020-06-24 12:10:42 +0100 | [diff] [blame] | 370 | java_resources: ["resource.txt"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 371 | aidl: { |
| 372 | export_include_dirs: ["aidl"], |
| 373 | }, |
| 374 | system_modules: "none", |
| 375 | sdk_version: "none", |
| 376 | compile_dex: true, |
| 377 | host_supported: true, |
| 378 | } |
| 379 | `) |
| 380 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 381 | CheckSnapshot(t, result, "myexports", "", |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 382 | checkUnversionedAndroidBpContents(` |
| 383 | // This is auto-generated. DO NOT EDIT. |
| 384 | |
| 385 | java_import { |
| 386 | name: "myjavalib", |
| 387 | prefer: false, |
| 388 | visibility: ["//visibility:public"], |
| 389 | apex_available: ["//apex_available:platform"], |
| 390 | jars: ["java/myjavalib.jar"], |
| 391 | } |
| 392 | `), |
| 393 | checkVersionedAndroidBpContents(` |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 394 | // This is auto-generated. DO NOT EDIT. |
| 395 | |
| 396 | java_import { |
Paul Duffin | e602918 | 2019-12-16 17:43:48 +0000 | [diff] [blame] | 397 | name: "myexports_myjavalib@current", |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 398 | sdk_member_name: "myjavalib", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 399 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 400 | apex_available: ["//apex_available:platform"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 401 | jars: ["java/myjavalib.jar"], |
| 402 | } |
| 403 | |
Paul Duffin | e602918 | 2019-12-16 17:43:48 +0000 | [diff] [blame] | 404 | module_exports_snapshot { |
| 405 | name: "myexports@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 406 | visibility: ["//visibility:public"], |
Paul Duffin | e602918 | 2019-12-16 17:43:48 +0000 | [diff] [blame] | 407 | java_libs: ["myexports_myjavalib@current"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 408 | } |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 409 | `), |
| 410 | checkAllCopyRules(` |
Paul Duffin | 4e77284 | 2020-06-24 12:10:42 +0100 | [diff] [blame] | 411 | .intermediates/myjavalib/android_common/withres/myjavalib.jar -> java/myjavalib.jar |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 412 | aidl/foo/bar/Test.aidl -> aidl/aidl/foo/bar/Test.aidl |
| 413 | `), |
| 414 | ) |
| 415 | } |
| 416 | |
Paul Duffin | db170e4 | 2020-12-08 17:48:25 +0000 | [diff] [blame] | 417 | func TestSnapshotWithJavaBootLibrary(t *testing.T) { |
Paul Duffin | db462dd | 2021-03-21 22:01:55 +0000 | [diff] [blame] | 418 | result := android.GroupFixturePreparers( |
| 419 | prepareForSdkTestWithJava, |
| 420 | android.FixtureAddFile("aidl", nil), |
| 421 | android.FixtureAddFile("resource.txt", nil), |
| 422 | ).RunTestWithBp(t, ` |
Paul Duffin | db170e4 | 2020-12-08 17:48:25 +0000 | [diff] [blame] | 423 | module_exports { |
| 424 | name: "myexports", |
| 425 | java_boot_libs: ["myjavalib"], |
| 426 | } |
| 427 | |
| 428 | java_library { |
| 429 | name: "myjavalib", |
| 430 | srcs: ["Test.java"], |
| 431 | java_resources: ["resource.txt"], |
| 432 | // The aidl files should not be copied to the snapshot because a java_boot_libs member is not |
| 433 | // intended to be used for compiling Java, only for accessing the dex implementation jar. |
| 434 | aidl: { |
| 435 | export_include_dirs: ["aidl"], |
| 436 | }, |
| 437 | system_modules: "none", |
| 438 | sdk_version: "none", |
| 439 | compile_dex: true, |
| 440 | } |
| 441 | `) |
| 442 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 443 | CheckSnapshot(t, result, "myexports", "", |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 444 | checkUnversionedAndroidBpContents(` |
| 445 | // This is auto-generated. DO NOT EDIT. |
| 446 | |
| 447 | java_import { |
| 448 | name: "myjavalib", |
| 449 | prefer: false, |
| 450 | visibility: ["//visibility:public"], |
| 451 | apex_available: ["//apex_available:platform"], |
| 452 | jars: ["java/myjavalib.jar"], |
| 453 | } |
| 454 | `), |
| 455 | checkVersionedAndroidBpContents(` |
Paul Duffin | db170e4 | 2020-12-08 17:48:25 +0000 | [diff] [blame] | 456 | // This is auto-generated. DO NOT EDIT. |
| 457 | |
| 458 | java_import { |
| 459 | name: "myexports_myjavalib@current", |
| 460 | sdk_member_name: "myjavalib", |
| 461 | visibility: ["//visibility:public"], |
| 462 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 22ff0aa | 2021-02-04 11:15:34 +0000 | [diff] [blame] | 463 | jars: ["java/myjavalib.jar"], |
Paul Duffin | db170e4 | 2020-12-08 17:48:25 +0000 | [diff] [blame] | 464 | } |
| 465 | |
Paul Duffin | db170e4 | 2020-12-08 17:48:25 +0000 | [diff] [blame] | 466 | module_exports_snapshot { |
| 467 | name: "myexports@current", |
| 468 | visibility: ["//visibility:public"], |
| 469 | java_boot_libs: ["myexports_myjavalib@current"], |
| 470 | } |
Paul Duffin | db170e4 | 2020-12-08 17:48:25 +0000 | [diff] [blame] | 471 | `), |
| 472 | checkAllCopyRules(` |
Paul Duffin | 22ff0aa | 2021-02-04 11:15:34 +0000 | [diff] [blame] | 473 | .intermediates/myjavalib/android_common/withres/myjavalib.jar -> java/myjavalib.jar |
Paul Duffin | db170e4 | 2020-12-08 17:48:25 +0000 | [diff] [blame] | 474 | `), |
| 475 | ) |
| 476 | } |
| 477 | |
Paul Duffin | a0dbf43 | 2019-12-05 11:25:53 +0000 | [diff] [blame] | 478 | func TestHostSnapshotWithJavaImplLibrary(t *testing.T) { |
Paul Duffin | 9ec86b1 | 2021-03-15 11:17:52 +0000 | [diff] [blame] | 479 | result := android.GroupFixturePreparers( |
| 480 | prepareForSdkTestWithJava, |
| 481 | android.FixtureAddFile("aidl/foo/bar/Test.aidl", nil), |
| 482 | ).RunTestWithBp(t, ` |
Paul Duffin | e602918 | 2019-12-16 17:43:48 +0000 | [diff] [blame] | 483 | module_exports { |
| 484 | name: "myexports", |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 485 | device_supported: false, |
| 486 | host_supported: true, |
| 487 | java_libs: ["myjavalib"], |
| 488 | } |
| 489 | |
| 490 | java_library { |
| 491 | name: "myjavalib", |
| 492 | device_supported: false, |
| 493 | host_supported: true, |
| 494 | srcs: ["Test.java"], |
| 495 | aidl: { |
| 496 | export_include_dirs: ["aidl"], |
| 497 | }, |
| 498 | system_modules: "none", |
| 499 | sdk_version: "none", |
| 500 | compile_dex: true, |
| 501 | } |
| 502 | `) |
| 503 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 504 | CheckSnapshot(t, result, "myexports", "", |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 505 | checkUnversionedAndroidBpContents(` |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 506 | // This is auto-generated. DO NOT EDIT. |
| 507 | |
| 508 | java_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 509 | name: "myjavalib", |
| 510 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 511 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 512 | apex_available: ["//apex_available:platform"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 513 | device_supported: false, |
| 514 | host_supported: true, |
| 515 | jars: ["java/myjavalib.jar"], |
| 516 | } |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 517 | `), |
| 518 | checkVersionedAndroidBpContents(` |
| 519 | // This is auto-generated. DO NOT EDIT. |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 520 | |
| 521 | java_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 522 | name: "myexports_myjavalib@current", |
| 523 | sdk_member_name: "myjavalib", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 524 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 525 | apex_available: ["//apex_available:platform"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 526 | device_supported: false, |
| 527 | host_supported: true, |
| 528 | jars: ["java/myjavalib.jar"], |
| 529 | } |
| 530 | |
Paul Duffin | e602918 | 2019-12-16 17:43:48 +0000 | [diff] [blame] | 531 | module_exports_snapshot { |
| 532 | name: "myexports@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 533 | visibility: ["//visibility:public"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 534 | device_supported: false, |
| 535 | host_supported: true, |
Paul Duffin | e602918 | 2019-12-16 17:43:48 +0000 | [diff] [blame] | 536 | java_libs: ["myexports_myjavalib@current"], |
Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 537 | } |
| 538 | `), |
| 539 | checkAllCopyRules(` |
| 540 | .intermediates/myjavalib/linux_glibc_common/javac/myjavalib.jar -> java/myjavalib.jar |
| 541 | aidl/foo/bar/Test.aidl -> aidl/aidl/foo/bar/Test.aidl |
| 542 | `), |
| 543 | ) |
| 544 | } |
| 545 | |
Paul Duffin | 1b82e6a | 2019-12-03 18:06:47 +0000 | [diff] [blame] | 546 | func TestSnapshotWithJavaTest(t *testing.T) { |
Paul Duffin | 9ec86b1 | 2021-03-15 11:17:52 +0000 | [diff] [blame] | 547 | result := android.GroupFixturePreparers(prepareForSdkTestWithJava).RunTestWithBp(t, ` |
Paul Duffin | 1b82e6a | 2019-12-03 18:06:47 +0000 | [diff] [blame] | 548 | module_exports { |
| 549 | name: "myexports", |
| 550 | java_tests: ["myjavatests"], |
| 551 | } |
| 552 | |
| 553 | java_test { |
| 554 | name: "myjavatests", |
| 555 | srcs: ["Test.java"], |
| 556 | system_modules: "none", |
| 557 | sdk_version: "none", |
| 558 | compile_dex: true, |
| 559 | host_supported: true, |
| 560 | } |
| 561 | `) |
| 562 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 563 | CheckSnapshot(t, result, "myexports", "", |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 564 | checkUnversionedAndroidBpContents(` |
Paul Duffin | 1b82e6a | 2019-12-03 18:06:47 +0000 | [diff] [blame] | 565 | // This is auto-generated. DO NOT EDIT. |
| 566 | |
| 567 | java_test_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 568 | name: "myjavatests", |
| 569 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 570 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 571 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 1b82e6a | 2019-12-03 18:06:47 +0000 | [diff] [blame] | 572 | jars: ["java/myjavatests.jar"], |
| 573 | test_config: "java/myjavatests-AndroidTest.xml", |
| 574 | } |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 575 | `), |
| 576 | checkVersionedAndroidBpContents(` |
| 577 | // This is auto-generated. DO NOT EDIT. |
Paul Duffin | 1b82e6a | 2019-12-03 18:06:47 +0000 | [diff] [blame] | 578 | |
| 579 | java_test_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 580 | name: "myexports_myjavatests@current", |
| 581 | sdk_member_name: "myjavatests", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 582 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 583 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 1b82e6a | 2019-12-03 18:06:47 +0000 | [diff] [blame] | 584 | jars: ["java/myjavatests.jar"], |
| 585 | test_config: "java/myjavatests-AndroidTest.xml", |
| 586 | } |
| 587 | |
| 588 | module_exports_snapshot { |
| 589 | name: "myexports@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 590 | visibility: ["//visibility:public"], |
Paul Duffin | 1b82e6a | 2019-12-03 18:06:47 +0000 | [diff] [blame] | 591 | java_tests: ["myexports_myjavatests@current"], |
| 592 | } |
| 593 | `), |
| 594 | checkAllCopyRules(` |
| 595 | .intermediates/myjavatests/android_common/javac/myjavatests.jar -> java/myjavatests.jar |
| 596 | .intermediates/myjavatests/android_common/myjavatests.config -> java/myjavatests-AndroidTest.xml |
| 597 | `), |
| 598 | ) |
| 599 | } |
| 600 | |
| 601 | func TestHostSnapshotWithJavaTest(t *testing.T) { |
Paul Duffin | 9ec86b1 | 2021-03-15 11:17:52 +0000 | [diff] [blame] | 602 | result := android.GroupFixturePreparers(prepareForSdkTestWithJava).RunTestWithBp(t, ` |
Paul Duffin | 1b82e6a | 2019-12-03 18:06:47 +0000 | [diff] [blame] | 603 | module_exports { |
| 604 | name: "myexports", |
| 605 | device_supported: false, |
| 606 | host_supported: true, |
| 607 | java_tests: ["myjavatests"], |
| 608 | } |
| 609 | |
| 610 | java_test { |
| 611 | name: "myjavatests", |
| 612 | device_supported: false, |
| 613 | host_supported: true, |
| 614 | srcs: ["Test.java"], |
| 615 | system_modules: "none", |
| 616 | sdk_version: "none", |
| 617 | compile_dex: true, |
| 618 | } |
| 619 | `) |
| 620 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 621 | CheckSnapshot(t, result, "myexports", "", |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 622 | checkUnversionedAndroidBpContents(` |
Paul Duffin | 1b82e6a | 2019-12-03 18:06:47 +0000 | [diff] [blame] | 623 | // This is auto-generated. DO NOT EDIT. |
| 624 | |
| 625 | java_test_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 626 | name: "myjavatests", |
| 627 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 628 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 629 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 1b82e6a | 2019-12-03 18:06:47 +0000 | [diff] [blame] | 630 | device_supported: false, |
| 631 | host_supported: true, |
| 632 | jars: ["java/myjavatests.jar"], |
| 633 | test_config: "java/myjavatests-AndroidTest.xml", |
| 634 | } |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 635 | `), |
| 636 | checkVersionedAndroidBpContents(` |
| 637 | // This is auto-generated. DO NOT EDIT. |
Paul Duffin | 1b82e6a | 2019-12-03 18:06:47 +0000 | [diff] [blame] | 638 | |
| 639 | java_test_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 640 | name: "myexports_myjavatests@current", |
| 641 | sdk_member_name: "myjavatests", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 642 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 643 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 1b82e6a | 2019-12-03 18:06:47 +0000 | [diff] [blame] | 644 | device_supported: false, |
| 645 | host_supported: true, |
| 646 | jars: ["java/myjavatests.jar"], |
| 647 | test_config: "java/myjavatests-AndroidTest.xml", |
| 648 | } |
| 649 | |
| 650 | module_exports_snapshot { |
| 651 | name: "myexports@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 652 | visibility: ["//visibility:public"], |
Paul Duffin | 1b82e6a | 2019-12-03 18:06:47 +0000 | [diff] [blame] | 653 | device_supported: false, |
| 654 | host_supported: true, |
| 655 | java_tests: ["myexports_myjavatests@current"], |
| 656 | } |
| 657 | `), |
| 658 | checkAllCopyRules(` |
| 659 | .intermediates/myjavatests/linux_glibc_common/javac/myjavatests.jar -> java/myjavatests.jar |
| 660 | .intermediates/myjavatests/linux_glibc_common/myjavatests.config -> java/myjavatests-AndroidTest.xml |
| 661 | `), |
| 662 | ) |
| 663 | } |
| 664 | |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 665 | func TestSnapshotWithJavaSystemModules(t *testing.T) { |
Paul Duffin | 3302871 | 2021-06-22 11:00:07 +0100 | [diff] [blame] | 666 | result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, ` |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 667 | sdk { |
| 668 | name: "mysdk", |
Paul Duffin | 7291095 | 2020-01-20 18:16:30 +0000 | [diff] [blame] | 669 | java_header_libs: ["exported-system-module"], |
Paul Duffin | 3302871 | 2021-06-22 11:00:07 +0100 | [diff] [blame] | 670 | java_sdk_libs: ["myjavalib"], |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 671 | java_system_modules: ["my-system-modules"], |
| 672 | } |
| 673 | |
Paul Duffin | 3302871 | 2021-06-22 11:00:07 +0100 | [diff] [blame] | 674 | java_sdk_library { |
| 675 | name: "myjavalib", |
| 676 | apex_available: ["//apex_available:anyapex"], |
| 677 | srcs: ["Test.java"], |
| 678 | sdk_version: "current", |
| 679 | shared_library: false, |
| 680 | public: { |
| 681 | enabled: true, |
| 682 | }, |
| 683 | } |
| 684 | |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 685 | java_system_modules { |
| 686 | name: "my-system-modules", |
Paul Duffin | 3302871 | 2021-06-22 11:00:07 +0100 | [diff] [blame] | 687 | libs: ["system-module", "exported-system-module", "myjavalib.stubs"], |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 688 | } |
| 689 | |
| 690 | java_library { |
| 691 | name: "system-module", |
| 692 | srcs: ["Test.java"], |
| 693 | sdk_version: "none", |
| 694 | system_modules: "none", |
| 695 | } |
Paul Duffin | 7291095 | 2020-01-20 18:16:30 +0000 | [diff] [blame] | 696 | |
| 697 | java_library { |
| 698 | name: "exported-system-module", |
| 699 | srcs: ["Test.java"], |
| 700 | sdk_version: "none", |
| 701 | system_modules: "none", |
| 702 | } |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 703 | `) |
| 704 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 705 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 706 | checkUnversionedAndroidBpContents(` |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 707 | // This is auto-generated. DO NOT EDIT. |
| 708 | |
| 709 | java_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 710 | name: "exported-system-module", |
| 711 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 712 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 713 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 7291095 | 2020-01-20 18:16:30 +0000 | [diff] [blame] | 714 | jars: ["java/exported-system-module.jar"], |
| 715 | } |
| 716 | |
| 717 | java_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 718 | name: "mysdk_system-module", |
Paul Duffin | 7291095 | 2020-01-20 18:16:30 +0000 | [diff] [blame] | 719 | prefer: false, |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 720 | visibility: ["//visibility:private"], |
| 721 | apex_available: ["//apex_available:platform"], |
| 722 | jars: ["java/system-module.jar"], |
| 723 | } |
| 724 | |
Paul Duffin | 3302871 | 2021-06-22 11:00:07 +0100 | [diff] [blame] | 725 | java_sdk_library_import { |
| 726 | name: "myjavalib", |
| 727 | prefer: false, |
| 728 | visibility: ["//visibility:public"], |
| 729 | apex_available: ["//apex_available:anyapex"], |
| 730 | shared_library: false, |
| 731 | public: { |
| 732 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
| 733 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
| 734 | current_api: "sdk_library/public/myjavalib.txt", |
| 735 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
| 736 | sdk_version: "current", |
| 737 | }, |
| 738 | } |
| 739 | |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 740 | java_system_modules_import { |
| 741 | name: "my-system-modules", |
| 742 | prefer: false, |
| 743 | visibility: ["//visibility:public"], |
| 744 | libs: [ |
| 745 | "mysdk_system-module", |
| 746 | "exported-system-module", |
Paul Duffin | b97b157 | 2021-04-29 21:50:40 +0100 | [diff] [blame^] | 747 | "myjavalib.stubs", |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 748 | ], |
| 749 | } |
| 750 | `), |
| 751 | checkVersionedAndroidBpContents(` |
| 752 | // This is auto-generated. DO NOT EDIT. |
| 753 | |
| 754 | java_import { |
| 755 | name: "mysdk_exported-system-module@current", |
| 756 | sdk_member_name: "exported-system-module", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 757 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 758 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 7291095 | 2020-01-20 18:16:30 +0000 | [diff] [blame] | 759 | jars: ["java/exported-system-module.jar"], |
| 760 | } |
| 761 | |
| 762 | java_import { |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 763 | name: "mysdk_system-module@current", |
| 764 | sdk_member_name: "system-module", |
Paul Duffin | 7291095 | 2020-01-20 18:16:30 +0000 | [diff] [blame] | 765 | visibility: ["//visibility:private"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 766 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 767 | jars: ["java/system-module.jar"], |
| 768 | } |
| 769 | |
Paul Duffin | 3302871 | 2021-06-22 11:00:07 +0100 | [diff] [blame] | 770 | java_sdk_library_import { |
| 771 | name: "mysdk_myjavalib@current", |
| 772 | sdk_member_name: "myjavalib", |
| 773 | visibility: ["//visibility:public"], |
| 774 | apex_available: ["//apex_available:anyapex"], |
| 775 | shared_library: false, |
| 776 | public: { |
| 777 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
| 778 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
| 779 | current_api: "sdk_library/public/myjavalib.txt", |
| 780 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
| 781 | sdk_version: "current", |
| 782 | }, |
| 783 | } |
| 784 | |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 785 | java_system_modules_import { |
| 786 | name: "mysdk_my-system-modules@current", |
| 787 | sdk_member_name: "my-system-modules", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 788 | visibility: ["//visibility:public"], |
Paul Duffin | 7291095 | 2020-01-20 18:16:30 +0000 | [diff] [blame] | 789 | libs: [ |
| 790 | "mysdk_system-module@current", |
| 791 | "mysdk_exported-system-module@current", |
Paul Duffin | 3302871 | 2021-06-22 11:00:07 +0100 | [diff] [blame] | 792 | "mysdk_myjavalib.stubs@current", |
Paul Duffin | 7291095 | 2020-01-20 18:16:30 +0000 | [diff] [blame] | 793 | ], |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 794 | } |
| 795 | |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 796 | sdk_snapshot { |
| 797 | name: "mysdk@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 798 | visibility: ["//visibility:public"], |
Paul Duffin | 7291095 | 2020-01-20 18:16:30 +0000 | [diff] [blame] | 799 | java_header_libs: ["mysdk_exported-system-module@current"], |
Paul Duffin | 3302871 | 2021-06-22 11:00:07 +0100 | [diff] [blame] | 800 | java_sdk_libs: ["mysdk_myjavalib@current"], |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 801 | java_system_modules: ["mysdk_my-system-modules@current"], |
| 802 | } |
| 803 | `), |
Paul Duffin | 7291095 | 2020-01-20 18:16:30 +0000 | [diff] [blame] | 804 | checkAllCopyRules(` |
| 805 | .intermediates/exported-system-module/android_common/turbine-combined/exported-system-module.jar -> java/exported-system-module.jar |
| 806 | .intermediates/system-module/android_common/turbine-combined/system-module.jar -> java/system-module.jar |
Paul Duffin | 3302871 | 2021-06-22 11:00:07 +0100 | [diff] [blame] | 807 | .intermediates/myjavalib.stubs/android_common/javac/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar |
| 808 | .intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt |
| 809 | .intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt |
Paul Duffin | 7291095 | 2020-01-20 18:16:30 +0000 | [diff] [blame] | 810 | `), |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 811 | ) |
| 812 | } |
| 813 | |
| 814 | func TestHostSnapshotWithJavaSystemModules(t *testing.T) { |
Paul Duffin | 9ec86b1 | 2021-03-15 11:17:52 +0000 | [diff] [blame] | 815 | result := android.GroupFixturePreparers(prepareForSdkTestWithJava).RunTestWithBp(t, ` |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 816 | sdk { |
| 817 | name: "mysdk", |
| 818 | device_supported: false, |
| 819 | host_supported: true, |
| 820 | java_system_modules: ["my-system-modules"], |
| 821 | } |
| 822 | |
| 823 | java_system_modules { |
| 824 | name: "my-system-modules", |
| 825 | device_supported: false, |
| 826 | host_supported: true, |
| 827 | libs: ["system-module"], |
| 828 | } |
| 829 | |
| 830 | java_library { |
| 831 | name: "system-module", |
| 832 | device_supported: false, |
| 833 | host_supported: true, |
| 834 | srcs: ["Test.java"], |
| 835 | sdk_version: "none", |
| 836 | system_modules: "none", |
| 837 | } |
| 838 | `) |
| 839 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 840 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 841 | checkUnversionedAndroidBpContents(` |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 842 | // This is auto-generated. DO NOT EDIT. |
| 843 | |
| 844 | java_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 845 | name: "mysdk_system-module", |
| 846 | prefer: false, |
Paul Duffin | 7291095 | 2020-01-20 18:16:30 +0000 | [diff] [blame] | 847 | visibility: ["//visibility:private"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 848 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 849 | device_supported: false, |
| 850 | host_supported: true, |
| 851 | jars: ["java/system-module.jar"], |
| 852 | } |
| 853 | |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 854 | java_system_modules_import { |
| 855 | name: "my-system-modules", |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 856 | prefer: false, |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 857 | visibility: ["//visibility:public"], |
| 858 | device_supported: false, |
| 859 | host_supported: true, |
| 860 | libs: ["mysdk_system-module"], |
| 861 | } |
| 862 | `), |
| 863 | checkVersionedAndroidBpContents(` |
| 864 | // This is auto-generated. DO NOT EDIT. |
| 865 | |
| 866 | java_import { |
| 867 | name: "mysdk_system-module@current", |
| 868 | sdk_member_name: "system-module", |
Paul Duffin | 7291095 | 2020-01-20 18:16:30 +0000 | [diff] [blame] | 869 | visibility: ["//visibility:private"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 870 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 871 | device_supported: false, |
| 872 | host_supported: true, |
| 873 | jars: ["java/system-module.jar"], |
| 874 | } |
| 875 | |
| 876 | java_system_modules_import { |
| 877 | name: "mysdk_my-system-modules@current", |
| 878 | sdk_member_name: "my-system-modules", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 879 | visibility: ["//visibility:public"], |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 880 | device_supported: false, |
| 881 | host_supported: true, |
| 882 | libs: ["mysdk_system-module@current"], |
| 883 | } |
| 884 | |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 885 | sdk_snapshot { |
| 886 | name: "mysdk@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 887 | visibility: ["//visibility:public"], |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 888 | device_supported: false, |
| 889 | host_supported: true, |
| 890 | java_system_modules: ["mysdk_my-system-modules@current"], |
| 891 | } |
| 892 | `), |
| 893 | checkAllCopyRules(".intermediates/system-module/linux_glibc_common/javac/system-module.jar -> java/system-module.jar"), |
| 894 | ) |
| 895 | } |
Paul Duffin | 865171e | 2020-03-02 18:38:15 +0000 | [diff] [blame] | 896 | |
| 897 | func TestDeviceAndHostSnapshotWithOsSpecificMembers(t *testing.T) { |
Paul Duffin | 9ec86b1 | 2021-03-15 11:17:52 +0000 | [diff] [blame] | 898 | result := android.GroupFixturePreparers(prepareForSdkTestWithJava).RunTestWithBp(t, ` |
Paul Duffin | 865171e | 2020-03-02 18:38:15 +0000 | [diff] [blame] | 899 | module_exports { |
| 900 | name: "myexports", |
| 901 | host_supported: true, |
| 902 | java_libs: ["myjavalib"], |
| 903 | target: { |
| 904 | android: { |
| 905 | java_header_libs: ["androidjavalib"], |
| 906 | }, |
| 907 | host: { |
| 908 | java_header_libs: ["hostjavalib"], |
| 909 | }, |
| 910 | }, |
| 911 | } |
| 912 | |
| 913 | java_library { |
| 914 | name: "myjavalib", |
| 915 | host_supported: true, |
| 916 | srcs: ["Test.java"], |
| 917 | system_modules: "none", |
| 918 | sdk_version: "none", |
| 919 | } |
| 920 | |
| 921 | java_library { |
| 922 | name: "androidjavalib", |
| 923 | srcs: ["Test.java"], |
| 924 | system_modules: "none", |
| 925 | sdk_version: "none", |
| 926 | } |
| 927 | |
| 928 | java_library_host { |
| 929 | name: "hostjavalib", |
| 930 | srcs: ["Test.java"], |
| 931 | } |
| 932 | `) |
| 933 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 934 | CheckSnapshot(t, result, "myexports", "", |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 935 | checkUnversionedAndroidBpContents(` |
Paul Duffin | 865171e | 2020-03-02 18:38:15 +0000 | [diff] [blame] | 936 | // This is auto-generated. DO NOT EDIT. |
| 937 | |
| 938 | java_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 939 | name: "hostjavalib", |
| 940 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 941 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 942 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 865171e | 2020-03-02 18:38:15 +0000 | [diff] [blame] | 943 | device_supported: false, |
| 944 | host_supported: true, |
| 945 | jars: ["java/hostjavalib.jar"], |
| 946 | } |
| 947 | |
| 948 | java_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 949 | name: "androidjavalib", |
Paul Duffin | 865171e | 2020-03-02 18:38:15 +0000 | [diff] [blame] | 950 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 951 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 952 | apex_available: ["//apex_available:platform"], |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 953 | jars: ["java/androidjavalib.jar"], |
| 954 | } |
| 955 | |
| 956 | java_import { |
| 957 | name: "myjavalib", |
| 958 | prefer: false, |
| 959 | visibility: ["//visibility:public"], |
| 960 | apex_available: ["//apex_available:platform"], |
| 961 | host_supported: true, |
| 962 | target: { |
| 963 | android: { |
| 964 | jars: ["java/android/myjavalib.jar"], |
| 965 | }, |
| 966 | linux_glibc: { |
| 967 | jars: ["java/linux_glibc/myjavalib.jar"], |
| 968 | }, |
| 969 | }, |
| 970 | } |
| 971 | `), |
| 972 | checkVersionedAndroidBpContents(` |
| 973 | // This is auto-generated. DO NOT EDIT. |
| 974 | |
| 975 | java_import { |
| 976 | name: "myexports_hostjavalib@current", |
| 977 | sdk_member_name: "hostjavalib", |
| 978 | visibility: ["//visibility:public"], |
| 979 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 865171e | 2020-03-02 18:38:15 +0000 | [diff] [blame] | 980 | device_supported: false, |
| 981 | host_supported: true, |
| 982 | jars: ["java/hostjavalib.jar"], |
| 983 | } |
| 984 | |
| 985 | java_import { |
| 986 | name: "myexports_androidjavalib@current", |
| 987 | sdk_member_name: "androidjavalib", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 988 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 989 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 865171e | 2020-03-02 18:38:15 +0000 | [diff] [blame] | 990 | jars: ["java/androidjavalib.jar"], |
| 991 | } |
| 992 | |
| 993 | java_import { |
Paul Duffin | 865171e | 2020-03-02 18:38:15 +0000 | [diff] [blame] | 994 | name: "myexports_myjavalib@current", |
| 995 | sdk_member_name: "myjavalib", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 996 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 997 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 865171e | 2020-03-02 18:38:15 +0000 | [diff] [blame] | 998 | host_supported: true, |
| 999 | target: { |
| 1000 | android: { |
| 1001 | jars: ["java/android/myjavalib.jar"], |
| 1002 | }, |
| 1003 | linux_glibc: { |
| 1004 | jars: ["java/linux_glibc/myjavalib.jar"], |
| 1005 | }, |
| 1006 | }, |
| 1007 | } |
| 1008 | |
Paul Duffin | 865171e | 2020-03-02 18:38:15 +0000 | [diff] [blame] | 1009 | module_exports_snapshot { |
| 1010 | name: "myexports@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1011 | visibility: ["//visibility:public"], |
Paul Duffin | 865171e | 2020-03-02 18:38:15 +0000 | [diff] [blame] | 1012 | host_supported: true, |
Paul Duffin | 07ef3cb | 2020-03-11 18:17:42 +0000 | [diff] [blame] | 1013 | java_libs: ["myexports_myjavalib@current"], |
Paul Duffin | 865171e | 2020-03-02 18:38:15 +0000 | [diff] [blame] | 1014 | target: { |
| 1015 | android: { |
| 1016 | java_header_libs: ["myexports_androidjavalib@current"], |
| 1017 | }, |
| 1018 | linux_glibc: { |
| 1019 | java_header_libs: ["myexports_hostjavalib@current"], |
| 1020 | }, |
| 1021 | }, |
Paul Duffin | 865171e | 2020-03-02 18:38:15 +0000 | [diff] [blame] | 1022 | } |
| 1023 | `), |
| 1024 | checkAllCopyRules(` |
| 1025 | .intermediates/hostjavalib/linux_glibc_common/javac/hostjavalib.jar -> java/hostjavalib.jar |
| 1026 | .intermediates/androidjavalib/android_common/turbine-combined/androidjavalib.jar -> java/androidjavalib.jar |
| 1027 | .intermediates/myjavalib/android_common/javac/myjavalib.jar -> java/android/myjavalib.jar |
| 1028 | .intermediates/myjavalib/linux_glibc_common/javac/myjavalib.jar -> java/linux_glibc/myjavalib.jar |
| 1029 | `), |
| 1030 | ) |
| 1031 | } |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1032 | |
| 1033 | func TestSnapshotWithJavaSdkLibrary(t *testing.T) { |
Paul Duffin | 9ec86b1 | 2021-03-15 11:17:52 +0000 | [diff] [blame] | 1034 | result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, ` |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1035 | sdk { |
| 1036 | name: "mysdk", |
| 1037 | java_sdk_libs: ["myjavalib"], |
| 1038 | } |
| 1039 | |
| 1040 | java_sdk_library { |
| 1041 | name: "myjavalib", |
| 1042 | apex_available: ["//apex_available:anyapex"], |
| 1043 | srcs: ["Test.java"], |
| 1044 | sdk_version: "current", |
Paul Duffin | d7eb1c2 | 2020-05-26 20:57:10 +0100 | [diff] [blame] | 1045 | shared_library: false, |
Paul Duffin | 4911a89 | 2020-04-29 23:35:13 +0100 | [diff] [blame] | 1046 | stubs_library_visibility: ["//other"], |
| 1047 | stubs_source_visibility: ["//another"], |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1048 | } |
| 1049 | `) |
| 1050 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 1051 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1052 | checkUnversionedAndroidBpContents(` |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1053 | // This is auto-generated. DO NOT EDIT. |
| 1054 | |
| 1055 | java_sdk_library_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1056 | name: "myjavalib", |
| 1057 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1058 | visibility: ["//visibility:public"], |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1059 | apex_available: ["//apex_available:anyapex"], |
Paul Duffin | d7eb1c2 | 2020-05-26 20:57:10 +0100 | [diff] [blame] | 1060 | shared_library: false, |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1061 | public: { |
| 1062 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1063 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
Paul Duffin | 1fd005d | 2020-04-09 01:08:11 +0100 | [diff] [blame] | 1064 | current_api: "sdk_library/public/myjavalib.txt", |
| 1065 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1066 | sdk_version: "current", |
| 1067 | }, |
| 1068 | system: { |
| 1069 | jars: ["sdk_library/system/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1070 | stub_srcs: ["sdk_library/system/myjavalib_stub_sources"], |
Paul Duffin | 1fd005d | 2020-04-09 01:08:11 +0100 | [diff] [blame] | 1071 | current_api: "sdk_library/system/myjavalib.txt", |
| 1072 | removed_api: "sdk_library/system/myjavalib-removed.txt", |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1073 | sdk_version: "system_current", |
| 1074 | }, |
| 1075 | test: { |
| 1076 | jars: ["sdk_library/test/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1077 | stub_srcs: ["sdk_library/test/myjavalib_stub_sources"], |
Paul Duffin | 1fd005d | 2020-04-09 01:08:11 +0100 | [diff] [blame] | 1078 | current_api: "sdk_library/test/myjavalib.txt", |
| 1079 | removed_api: "sdk_library/test/myjavalib-removed.txt", |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1080 | sdk_version: "test_current", |
| 1081 | }, |
| 1082 | } |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1083 | `), |
| 1084 | checkVersionedAndroidBpContents(` |
| 1085 | // This is auto-generated. DO NOT EDIT. |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1086 | |
| 1087 | java_sdk_library_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1088 | name: "mysdk_myjavalib@current", |
| 1089 | sdk_member_name: "myjavalib", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1090 | visibility: ["//visibility:public"], |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1091 | apex_available: ["//apex_available:anyapex"], |
Paul Duffin | d7eb1c2 | 2020-05-26 20:57:10 +0100 | [diff] [blame] | 1092 | shared_library: false, |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1093 | public: { |
| 1094 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1095 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
Paul Duffin | 1fd005d | 2020-04-09 01:08:11 +0100 | [diff] [blame] | 1096 | current_api: "sdk_library/public/myjavalib.txt", |
| 1097 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1098 | sdk_version: "current", |
| 1099 | }, |
| 1100 | system: { |
| 1101 | jars: ["sdk_library/system/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1102 | stub_srcs: ["sdk_library/system/myjavalib_stub_sources"], |
Paul Duffin | 1fd005d | 2020-04-09 01:08:11 +0100 | [diff] [blame] | 1103 | current_api: "sdk_library/system/myjavalib.txt", |
| 1104 | removed_api: "sdk_library/system/myjavalib-removed.txt", |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1105 | sdk_version: "system_current", |
| 1106 | }, |
| 1107 | test: { |
| 1108 | jars: ["sdk_library/test/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1109 | stub_srcs: ["sdk_library/test/myjavalib_stub_sources"], |
Paul Duffin | 1fd005d | 2020-04-09 01:08:11 +0100 | [diff] [blame] | 1110 | current_api: "sdk_library/test/myjavalib.txt", |
| 1111 | removed_api: "sdk_library/test/myjavalib-removed.txt", |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1112 | sdk_version: "test_current", |
| 1113 | }, |
| 1114 | } |
| 1115 | |
| 1116 | sdk_snapshot { |
| 1117 | name: "mysdk@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1118 | visibility: ["//visibility:public"], |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1119 | java_sdk_libs: ["mysdk_myjavalib@current"], |
| 1120 | } |
| 1121 | `), |
| 1122 | checkAllCopyRules(` |
| 1123 | .intermediates/myjavalib.stubs/android_common/javac/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar |
Colin Cross | cb77f75 | 2021-03-24 12:04:44 -0700 | [diff] [blame] | 1124 | .intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt |
| 1125 | .intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1126 | .intermediates/myjavalib.stubs.system/android_common/javac/myjavalib.stubs.system.jar -> sdk_library/system/myjavalib-stubs.jar |
Colin Cross | cb77f75 | 2021-03-24 12:04:44 -0700 | [diff] [blame] | 1127 | .intermediates/myjavalib.stubs.source.system/android_common/metalava/myjavalib.stubs.source.system_api.txt -> sdk_library/system/myjavalib.txt |
| 1128 | .intermediates/myjavalib.stubs.source.system/android_common/metalava/myjavalib.stubs.source.system_removed.txt -> sdk_library/system/myjavalib-removed.txt |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1129 | .intermediates/myjavalib.stubs.test/android_common/javac/myjavalib.stubs.test.jar -> sdk_library/test/myjavalib-stubs.jar |
Colin Cross | cb77f75 | 2021-03-24 12:04:44 -0700 | [diff] [blame] | 1130 | .intermediates/myjavalib.stubs.source.test/android_common/metalava/myjavalib.stubs.source.test_api.txt -> sdk_library/test/myjavalib.txt |
| 1131 | .intermediates/myjavalib.stubs.source.test/android_common/metalava/myjavalib.stubs.source.test_removed.txt -> sdk_library/test/myjavalib-removed.txt |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1132 | `), |
Paul Duffin | 3d1248c | 2020-04-09 00:10:17 +0100 | [diff] [blame] | 1133 | checkMergeZips( |
| 1134 | ".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip", |
| 1135 | ".intermediates/mysdk/common_os/tmp/sdk_library/system/myjavalib_stub_sources.zip", |
Paul Duffin | 3302871 | 2021-06-22 11:00:07 +0100 | [diff] [blame] | 1136 | ".intermediates/mysdk/common_os/tmp/sdk_library/test/myjavalib_stub_sources.zip", |
| 1137 | ), |
| 1138 | snapshotTestChecker(checkSnapshotWithoutSource, func(t *testing.T, result *android.TestResult) { |
Paul Duffin | b97b157 | 2021-04-29 21:50:40 +0100 | [diff] [blame^] | 1139 | // Make sure that the name of the child modules created by a versioned java_sdk_library_import |
| 1140 | // module is correct, i.e. the suffix is added before the version and not after. |
| 1141 | result.Module("mysdk_myjavalib.stubs@current", "android_common") |
| 1142 | result.Module("mysdk_myjavalib.stubs.source@current", "android_common") |
Paul Duffin | 3302871 | 2021-06-22 11:00:07 +0100 | [diff] [blame] | 1143 | }), |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1144 | ) |
| 1145 | } |
Paul Duffin | 3375e35 | 2020-04-28 10:44:03 +0100 | [diff] [blame] | 1146 | |
Paul Duffin | 22628d5 | 2021-05-12 23:13:22 +0100 | [diff] [blame] | 1147 | func TestSnapshotWithJavaSdkLibrary_UseSrcJar(t *testing.T) { |
| 1148 | result := android.GroupFixturePreparers( |
| 1149 | prepareForSdkTestWithJavaSdkLibrary, |
| 1150 | android.FixtureMergeEnv(map[string]string{ |
| 1151 | "SOONG_SDK_SNAPSHOT_USE_SRCJAR": "true", |
| 1152 | }), |
| 1153 | ).RunTestWithBp(t, ` |
| 1154 | sdk { |
| 1155 | name: "mysdk", |
| 1156 | java_sdk_libs: ["myjavalib"], |
| 1157 | } |
| 1158 | |
| 1159 | java_sdk_library { |
| 1160 | name: "myjavalib", |
| 1161 | srcs: ["Test.java"], |
| 1162 | sdk_version: "current", |
| 1163 | shared_library: false, |
| 1164 | public: { |
| 1165 | enabled: true, |
| 1166 | }, |
| 1167 | } |
| 1168 | `) |
| 1169 | |
| 1170 | CheckSnapshot(t, result, "mysdk", "", |
| 1171 | checkUnversionedAndroidBpContents(` |
| 1172 | // This is auto-generated. DO NOT EDIT. |
| 1173 | |
| 1174 | java_sdk_library_import { |
| 1175 | name: "myjavalib", |
| 1176 | prefer: false, |
| 1177 | visibility: ["//visibility:public"], |
| 1178 | apex_available: ["//apex_available:platform"], |
| 1179 | shared_library: false, |
| 1180 | public: { |
| 1181 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
| 1182 | stub_srcs: ["sdk_library/public/myjavalib.srcjar"], |
| 1183 | current_api: "sdk_library/public/myjavalib.txt", |
| 1184 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
| 1185 | sdk_version: "current", |
| 1186 | }, |
| 1187 | } |
| 1188 | `), |
| 1189 | checkAllCopyRules(` |
| 1190 | .intermediates/myjavalib.stubs/android_common/javac/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar |
| 1191 | .intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source-stubs.srcjar -> sdk_library/public/myjavalib.srcjar |
| 1192 | .intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt |
| 1193 | .intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt |
| 1194 | `), |
| 1195 | ) |
| 1196 | } |
| 1197 | |
Paul Duffin | 1267d87 | 2021-04-16 17:21:36 +0100 | [diff] [blame] | 1198 | func TestSnapshotWithJavaSdkLibrary_CompileDex(t *testing.T) { |
| 1199 | result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, ` |
| 1200 | sdk { |
| 1201 | name: "mysdk", |
| 1202 | java_sdk_libs: ["myjavalib"], |
| 1203 | } |
| 1204 | |
| 1205 | java_sdk_library { |
| 1206 | name: "myjavalib", |
| 1207 | srcs: ["Test.java"], |
| 1208 | sdk_version: "current", |
| 1209 | shared_library: false, |
| 1210 | compile_dex: true, |
| 1211 | public: { |
| 1212 | enabled: true, |
| 1213 | }, |
| 1214 | system: { |
| 1215 | enabled: true, |
| 1216 | }, |
| 1217 | } |
| 1218 | `) |
| 1219 | |
| 1220 | CheckSnapshot(t, result, "mysdk", "", |
| 1221 | checkUnversionedAndroidBpContents(` |
| 1222 | // This is auto-generated. DO NOT EDIT. |
| 1223 | |
| 1224 | java_sdk_library_import { |
| 1225 | name: "myjavalib", |
| 1226 | prefer: false, |
| 1227 | visibility: ["//visibility:public"], |
| 1228 | apex_available: ["//apex_available:platform"], |
| 1229 | shared_library: false, |
| 1230 | compile_dex: true, |
| 1231 | public: { |
| 1232 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
| 1233 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
| 1234 | current_api: "sdk_library/public/myjavalib.txt", |
| 1235 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
| 1236 | sdk_version: "current", |
| 1237 | }, |
| 1238 | system: { |
| 1239 | jars: ["sdk_library/system/myjavalib-stubs.jar"], |
| 1240 | stub_srcs: ["sdk_library/system/myjavalib_stub_sources"], |
| 1241 | current_api: "sdk_library/system/myjavalib.txt", |
| 1242 | removed_api: "sdk_library/system/myjavalib-removed.txt", |
| 1243 | sdk_version: "system_current", |
| 1244 | }, |
| 1245 | } |
| 1246 | `), |
| 1247 | snapshotTestChecker(checkSnapshotWithSourcePreferred, func(t *testing.T, result *android.TestResult) { |
| 1248 | ctx := android.ModuleInstallPathContextForTesting(result.Config) |
| 1249 | dexJarBuildPath := func(name string, kind android.SdkKind) string { |
| 1250 | dep := result.Module(name, "android_common").(java.SdkLibraryDependency) |
| 1251 | path := dep.SdkApiStubDexJar(ctx, kind) |
| 1252 | return path.RelativeToTop().String() |
| 1253 | } |
| 1254 | |
| 1255 | dexJarPath := dexJarBuildPath("myjavalib", android.SdkPublic) |
| 1256 | android.AssertStringEquals(t, "source dex public stubs jar build path", "out/soong/.intermediates/myjavalib.stubs/android_common/dex/myjavalib.stubs.jar", dexJarPath) |
| 1257 | |
| 1258 | dexJarPath = dexJarBuildPath("myjavalib", android.SdkSystem) |
| 1259 | systemDexJar := "out/soong/.intermediates/myjavalib.stubs.system/android_common/dex/myjavalib.stubs.system.jar" |
| 1260 | android.AssertStringEquals(t, "source dex system stubs jar build path", systemDexJar, dexJarPath) |
| 1261 | |
| 1262 | // This should fall back to system as module is not available. |
| 1263 | dexJarPath = dexJarBuildPath("myjavalib", android.SdkModule) |
| 1264 | android.AssertStringEquals(t, "source dex module stubs jar build path", systemDexJar, dexJarPath) |
| 1265 | |
| 1266 | dexJarPath = dexJarBuildPath(android.PrebuiltNameFromSource("myjavalib"), android.SdkPublic) |
| 1267 | android.AssertStringEquals(t, "prebuilt dex public stubs jar build path", "out/soong/.intermediates/snapshot/prebuilt_myjavalib.stubs/android_common/dex/myjavalib.stubs.jar", dexJarPath) |
| 1268 | }), |
| 1269 | ) |
| 1270 | } |
| 1271 | |
Paul Duffin | 780c5f4 | 2020-05-12 15:52:55 +0100 | [diff] [blame] | 1272 | func TestSnapshotWithJavaSdkLibrary_SdkVersion_None(t *testing.T) { |
Paul Duffin | 9ec86b1 | 2021-03-15 11:17:52 +0000 | [diff] [blame] | 1273 | result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, ` |
Paul Duffin | 780c5f4 | 2020-05-12 15:52:55 +0100 | [diff] [blame] | 1274 | sdk { |
| 1275 | name: "mysdk", |
| 1276 | java_sdk_libs: ["myjavalib"], |
| 1277 | } |
| 1278 | |
| 1279 | java_sdk_library { |
| 1280 | name: "myjavalib", |
| 1281 | srcs: ["Test.java"], |
| 1282 | sdk_version: "none", |
| 1283 | system_modules: "none", |
| 1284 | } |
| 1285 | `) |
| 1286 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 1287 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1288 | checkUnversionedAndroidBpContents(` |
Paul Duffin | 780c5f4 | 2020-05-12 15:52:55 +0100 | [diff] [blame] | 1289 | // This is auto-generated. DO NOT EDIT. |
| 1290 | |
| 1291 | java_sdk_library_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1292 | name: "myjavalib", |
| 1293 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1294 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1295 | apex_available: ["//apex_available:platform"], |
Paul Duffin | d7eb1c2 | 2020-05-26 20:57:10 +0100 | [diff] [blame] | 1296 | shared_library: true, |
Paul Duffin | 780c5f4 | 2020-05-12 15:52:55 +0100 | [diff] [blame] | 1297 | public: { |
| 1298 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1299 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
Paul Duffin | 780c5f4 | 2020-05-12 15:52:55 +0100 | [diff] [blame] | 1300 | current_api: "sdk_library/public/myjavalib.txt", |
| 1301 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
| 1302 | sdk_version: "none", |
| 1303 | }, |
| 1304 | } |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1305 | `), |
| 1306 | checkVersionedAndroidBpContents(` |
| 1307 | // This is auto-generated. DO NOT EDIT. |
Paul Duffin | 780c5f4 | 2020-05-12 15:52:55 +0100 | [diff] [blame] | 1308 | |
| 1309 | java_sdk_library_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1310 | name: "mysdk_myjavalib@current", |
| 1311 | sdk_member_name: "myjavalib", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1312 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1313 | apex_available: ["//apex_available:platform"], |
Paul Duffin | d7eb1c2 | 2020-05-26 20:57:10 +0100 | [diff] [blame] | 1314 | shared_library: true, |
Paul Duffin | 780c5f4 | 2020-05-12 15:52:55 +0100 | [diff] [blame] | 1315 | public: { |
| 1316 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1317 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
Paul Duffin | 780c5f4 | 2020-05-12 15:52:55 +0100 | [diff] [blame] | 1318 | current_api: "sdk_library/public/myjavalib.txt", |
| 1319 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
| 1320 | sdk_version: "none", |
| 1321 | }, |
| 1322 | } |
| 1323 | |
| 1324 | sdk_snapshot { |
| 1325 | name: "mysdk@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1326 | visibility: ["//visibility:public"], |
Paul Duffin | 780c5f4 | 2020-05-12 15:52:55 +0100 | [diff] [blame] | 1327 | java_sdk_libs: ["mysdk_myjavalib@current"], |
| 1328 | } |
| 1329 | `), |
| 1330 | checkAllCopyRules(` |
| 1331 | .intermediates/myjavalib.stubs/android_common/javac/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar |
Colin Cross | cb77f75 | 2021-03-24 12:04:44 -0700 | [diff] [blame] | 1332 | .intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt |
| 1333 | .intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt |
Paul Duffin | 780c5f4 | 2020-05-12 15:52:55 +0100 | [diff] [blame] | 1334 | `), |
| 1335 | checkMergeZips( |
| 1336 | ".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip", |
| 1337 | ), |
| 1338 | ) |
| 1339 | } |
| 1340 | |
Paul Duffin | 87a05a3 | 2020-05-12 11:50:28 +0100 | [diff] [blame] | 1341 | func TestSnapshotWithJavaSdkLibrary_SdkVersion_ForScope(t *testing.T) { |
Paul Duffin | 9ec86b1 | 2021-03-15 11:17:52 +0000 | [diff] [blame] | 1342 | result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, ` |
Paul Duffin | 87a05a3 | 2020-05-12 11:50:28 +0100 | [diff] [blame] | 1343 | sdk { |
| 1344 | name: "mysdk", |
| 1345 | java_sdk_libs: ["myjavalib"], |
| 1346 | } |
| 1347 | |
| 1348 | java_sdk_library { |
| 1349 | name: "myjavalib", |
| 1350 | srcs: ["Test.java"], |
| 1351 | sdk_version: "module_current", |
| 1352 | public: { |
| 1353 | enabled: true, |
| 1354 | sdk_version: "module_current", |
| 1355 | }, |
| 1356 | } |
| 1357 | `) |
| 1358 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 1359 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1360 | checkUnversionedAndroidBpContents(` |
Paul Duffin | 87a05a3 | 2020-05-12 11:50:28 +0100 | [diff] [blame] | 1361 | // This is auto-generated. DO NOT EDIT. |
| 1362 | |
| 1363 | java_sdk_library_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1364 | name: "myjavalib", |
| 1365 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1366 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1367 | apex_available: ["//apex_available:platform"], |
Paul Duffin | d7eb1c2 | 2020-05-26 20:57:10 +0100 | [diff] [blame] | 1368 | shared_library: true, |
Paul Duffin | 87a05a3 | 2020-05-12 11:50:28 +0100 | [diff] [blame] | 1369 | public: { |
| 1370 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1371 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
Paul Duffin | 87a05a3 | 2020-05-12 11:50:28 +0100 | [diff] [blame] | 1372 | current_api: "sdk_library/public/myjavalib.txt", |
| 1373 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
| 1374 | sdk_version: "module_current", |
| 1375 | }, |
| 1376 | } |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1377 | `), |
| 1378 | checkVersionedAndroidBpContents(` |
| 1379 | // This is auto-generated. DO NOT EDIT. |
Paul Duffin | 87a05a3 | 2020-05-12 11:50:28 +0100 | [diff] [blame] | 1380 | |
| 1381 | java_sdk_library_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1382 | name: "mysdk_myjavalib@current", |
| 1383 | sdk_member_name: "myjavalib", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1384 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1385 | apex_available: ["//apex_available:platform"], |
Paul Duffin | d7eb1c2 | 2020-05-26 20:57:10 +0100 | [diff] [blame] | 1386 | shared_library: true, |
Paul Duffin | 87a05a3 | 2020-05-12 11:50:28 +0100 | [diff] [blame] | 1387 | public: { |
| 1388 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1389 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
Paul Duffin | 87a05a3 | 2020-05-12 11:50:28 +0100 | [diff] [blame] | 1390 | current_api: "sdk_library/public/myjavalib.txt", |
| 1391 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
| 1392 | sdk_version: "module_current", |
| 1393 | }, |
| 1394 | } |
| 1395 | |
| 1396 | sdk_snapshot { |
| 1397 | name: "mysdk@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1398 | visibility: ["//visibility:public"], |
Paul Duffin | 87a05a3 | 2020-05-12 11:50:28 +0100 | [diff] [blame] | 1399 | java_sdk_libs: ["mysdk_myjavalib@current"], |
| 1400 | } |
| 1401 | `), |
| 1402 | checkAllCopyRules(` |
| 1403 | .intermediates/myjavalib.stubs/android_common/javac/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar |
Colin Cross | cb77f75 | 2021-03-24 12:04:44 -0700 | [diff] [blame] | 1404 | .intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt |
| 1405 | .intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt |
Paul Duffin | 87a05a3 | 2020-05-12 11:50:28 +0100 | [diff] [blame] | 1406 | `), |
| 1407 | checkMergeZips( |
| 1408 | ".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip", |
| 1409 | ), |
| 1410 | ) |
| 1411 | } |
| 1412 | |
| 1413 | func TestSnapshotWithJavaSdkLibrary_ApiScopes(t *testing.T) { |
Paul Duffin | 9ec86b1 | 2021-03-15 11:17:52 +0000 | [diff] [blame] | 1414 | result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, ` |
Paul Duffin | 3375e35 | 2020-04-28 10:44:03 +0100 | [diff] [blame] | 1415 | sdk { |
| 1416 | name: "mysdk", |
| 1417 | java_sdk_libs: ["myjavalib"], |
| 1418 | } |
| 1419 | |
| 1420 | java_sdk_library { |
| 1421 | name: "myjavalib", |
| 1422 | apex_available: ["//apex_available:anyapex"], |
| 1423 | srcs: ["Test.java"], |
| 1424 | sdk_version: "current", |
| 1425 | public: { |
| 1426 | enabled: true, |
| 1427 | }, |
| 1428 | system: { |
| 1429 | enabled: true, |
| 1430 | }, |
| 1431 | } |
| 1432 | `) |
| 1433 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 1434 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1435 | checkUnversionedAndroidBpContents(` |
Paul Duffin | 3375e35 | 2020-04-28 10:44:03 +0100 | [diff] [blame] | 1436 | // This is auto-generated. DO NOT EDIT. |
| 1437 | |
| 1438 | java_sdk_library_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1439 | name: "myjavalib", |
| 1440 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1441 | visibility: ["//visibility:public"], |
Paul Duffin | 3375e35 | 2020-04-28 10:44:03 +0100 | [diff] [blame] | 1442 | apex_available: ["//apex_available:anyapex"], |
Paul Duffin | d7eb1c2 | 2020-05-26 20:57:10 +0100 | [diff] [blame] | 1443 | shared_library: true, |
Paul Duffin | 3375e35 | 2020-04-28 10:44:03 +0100 | [diff] [blame] | 1444 | public: { |
| 1445 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1446 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
Paul Duffin | 3375e35 | 2020-04-28 10:44:03 +0100 | [diff] [blame] | 1447 | current_api: "sdk_library/public/myjavalib.txt", |
| 1448 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
| 1449 | sdk_version: "current", |
| 1450 | }, |
| 1451 | system: { |
| 1452 | jars: ["sdk_library/system/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1453 | stub_srcs: ["sdk_library/system/myjavalib_stub_sources"], |
Paul Duffin | 3375e35 | 2020-04-28 10:44:03 +0100 | [diff] [blame] | 1454 | current_api: "sdk_library/system/myjavalib.txt", |
| 1455 | removed_api: "sdk_library/system/myjavalib-removed.txt", |
| 1456 | sdk_version: "system_current", |
| 1457 | }, |
| 1458 | } |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1459 | `), |
| 1460 | checkVersionedAndroidBpContents(` |
| 1461 | // This is auto-generated. DO NOT EDIT. |
Paul Duffin | 3375e35 | 2020-04-28 10:44:03 +0100 | [diff] [blame] | 1462 | |
| 1463 | java_sdk_library_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1464 | name: "mysdk_myjavalib@current", |
| 1465 | sdk_member_name: "myjavalib", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1466 | visibility: ["//visibility:public"], |
Paul Duffin | 3375e35 | 2020-04-28 10:44:03 +0100 | [diff] [blame] | 1467 | apex_available: ["//apex_available:anyapex"], |
Paul Duffin | d7eb1c2 | 2020-05-26 20:57:10 +0100 | [diff] [blame] | 1468 | shared_library: true, |
Paul Duffin | 3375e35 | 2020-04-28 10:44:03 +0100 | [diff] [blame] | 1469 | public: { |
| 1470 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1471 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
Paul Duffin | 3375e35 | 2020-04-28 10:44:03 +0100 | [diff] [blame] | 1472 | current_api: "sdk_library/public/myjavalib.txt", |
| 1473 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
| 1474 | sdk_version: "current", |
| 1475 | }, |
| 1476 | system: { |
| 1477 | jars: ["sdk_library/system/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1478 | stub_srcs: ["sdk_library/system/myjavalib_stub_sources"], |
Paul Duffin | 3375e35 | 2020-04-28 10:44:03 +0100 | [diff] [blame] | 1479 | current_api: "sdk_library/system/myjavalib.txt", |
| 1480 | removed_api: "sdk_library/system/myjavalib-removed.txt", |
| 1481 | sdk_version: "system_current", |
| 1482 | }, |
| 1483 | } |
| 1484 | |
| 1485 | sdk_snapshot { |
| 1486 | name: "mysdk@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1487 | visibility: ["//visibility:public"], |
Paul Duffin | 3375e35 | 2020-04-28 10:44:03 +0100 | [diff] [blame] | 1488 | java_sdk_libs: ["mysdk_myjavalib@current"], |
| 1489 | } |
| 1490 | `), |
| 1491 | checkAllCopyRules(` |
| 1492 | .intermediates/myjavalib.stubs/android_common/javac/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar |
Colin Cross | cb77f75 | 2021-03-24 12:04:44 -0700 | [diff] [blame] | 1493 | .intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt |
| 1494 | .intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt |
Paul Duffin | 3375e35 | 2020-04-28 10:44:03 +0100 | [diff] [blame] | 1495 | .intermediates/myjavalib.stubs.system/android_common/javac/myjavalib.stubs.system.jar -> sdk_library/system/myjavalib-stubs.jar |
Colin Cross | cb77f75 | 2021-03-24 12:04:44 -0700 | [diff] [blame] | 1496 | .intermediates/myjavalib.stubs.source.system/android_common/metalava/myjavalib.stubs.source.system_api.txt -> sdk_library/system/myjavalib.txt |
| 1497 | .intermediates/myjavalib.stubs.source.system/android_common/metalava/myjavalib.stubs.source.system_removed.txt -> sdk_library/system/myjavalib-removed.txt |
Paul Duffin | 3375e35 | 2020-04-28 10:44:03 +0100 | [diff] [blame] | 1498 | `), |
| 1499 | checkMergeZips( |
| 1500 | ".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip", |
| 1501 | ".intermediates/mysdk/common_os/tmp/sdk_library/system/myjavalib_stub_sources.zip", |
| 1502 | ), |
| 1503 | ) |
| 1504 | } |
Paul Duffin | 8f265b9 | 2020-04-28 14:13:56 +0100 | [diff] [blame] | 1505 | |
| 1506 | func TestSnapshotWithJavaSdkLibrary_ModuleLib(t *testing.T) { |
Paul Duffin | 9ec86b1 | 2021-03-15 11:17:52 +0000 | [diff] [blame] | 1507 | result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, ` |
Paul Duffin | 8f265b9 | 2020-04-28 14:13:56 +0100 | [diff] [blame] | 1508 | sdk { |
| 1509 | name: "mysdk", |
| 1510 | java_sdk_libs: ["myjavalib"], |
| 1511 | } |
| 1512 | |
| 1513 | java_sdk_library { |
| 1514 | name: "myjavalib", |
| 1515 | apex_available: ["//apex_available:anyapex"], |
| 1516 | srcs: ["Test.java"], |
| 1517 | sdk_version: "current", |
| 1518 | public: { |
| 1519 | enabled: true, |
| 1520 | }, |
| 1521 | system: { |
| 1522 | enabled: true, |
| 1523 | }, |
| 1524 | module_lib: { |
| 1525 | enabled: true, |
| 1526 | }, |
| 1527 | } |
| 1528 | `) |
| 1529 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 1530 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1531 | checkUnversionedAndroidBpContents(` |
Paul Duffin | 8f265b9 | 2020-04-28 14:13:56 +0100 | [diff] [blame] | 1532 | // This is auto-generated. DO NOT EDIT. |
| 1533 | |
| 1534 | java_sdk_library_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1535 | name: "myjavalib", |
| 1536 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1537 | visibility: ["//visibility:public"], |
Paul Duffin | 8f265b9 | 2020-04-28 14:13:56 +0100 | [diff] [blame] | 1538 | apex_available: ["//apex_available:anyapex"], |
Paul Duffin | d7eb1c2 | 2020-05-26 20:57:10 +0100 | [diff] [blame] | 1539 | shared_library: true, |
Paul Duffin | 8f265b9 | 2020-04-28 14:13:56 +0100 | [diff] [blame] | 1540 | public: { |
| 1541 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1542 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
Paul Duffin | 8f265b9 | 2020-04-28 14:13:56 +0100 | [diff] [blame] | 1543 | current_api: "sdk_library/public/myjavalib.txt", |
| 1544 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
| 1545 | sdk_version: "current", |
| 1546 | }, |
| 1547 | system: { |
| 1548 | jars: ["sdk_library/system/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1549 | stub_srcs: ["sdk_library/system/myjavalib_stub_sources"], |
Paul Duffin | 8f265b9 | 2020-04-28 14:13:56 +0100 | [diff] [blame] | 1550 | current_api: "sdk_library/system/myjavalib.txt", |
| 1551 | removed_api: "sdk_library/system/myjavalib-removed.txt", |
| 1552 | sdk_version: "system_current", |
| 1553 | }, |
| 1554 | module_lib: { |
Paul Duffin | 6b836ba | 2020-05-13 19:19:49 +0100 | [diff] [blame] | 1555 | jars: ["sdk_library/module-lib/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1556 | stub_srcs: ["sdk_library/module-lib/myjavalib_stub_sources"], |
Paul Duffin | 6b836ba | 2020-05-13 19:19:49 +0100 | [diff] [blame] | 1557 | current_api: "sdk_library/module-lib/myjavalib.txt", |
| 1558 | removed_api: "sdk_library/module-lib/myjavalib-removed.txt", |
Paul Duffin | 8f265b9 | 2020-04-28 14:13:56 +0100 | [diff] [blame] | 1559 | sdk_version: "module_current", |
| 1560 | }, |
| 1561 | } |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1562 | `), |
| 1563 | checkVersionedAndroidBpContents(` |
| 1564 | // This is auto-generated. DO NOT EDIT. |
Paul Duffin | 8f265b9 | 2020-04-28 14:13:56 +0100 | [diff] [blame] | 1565 | |
| 1566 | java_sdk_library_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1567 | name: "mysdk_myjavalib@current", |
| 1568 | sdk_member_name: "myjavalib", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1569 | visibility: ["//visibility:public"], |
Paul Duffin | 8f265b9 | 2020-04-28 14:13:56 +0100 | [diff] [blame] | 1570 | apex_available: ["//apex_available:anyapex"], |
Paul Duffin | d7eb1c2 | 2020-05-26 20:57:10 +0100 | [diff] [blame] | 1571 | shared_library: true, |
Paul Duffin | 8f265b9 | 2020-04-28 14:13:56 +0100 | [diff] [blame] | 1572 | public: { |
| 1573 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1574 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
Paul Duffin | 8f265b9 | 2020-04-28 14:13:56 +0100 | [diff] [blame] | 1575 | current_api: "sdk_library/public/myjavalib.txt", |
| 1576 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
| 1577 | sdk_version: "current", |
| 1578 | }, |
| 1579 | system: { |
| 1580 | jars: ["sdk_library/system/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1581 | stub_srcs: ["sdk_library/system/myjavalib_stub_sources"], |
Paul Duffin | 8f265b9 | 2020-04-28 14:13:56 +0100 | [diff] [blame] | 1582 | current_api: "sdk_library/system/myjavalib.txt", |
| 1583 | removed_api: "sdk_library/system/myjavalib-removed.txt", |
| 1584 | sdk_version: "system_current", |
| 1585 | }, |
| 1586 | module_lib: { |
Paul Duffin | 6b836ba | 2020-05-13 19:19:49 +0100 | [diff] [blame] | 1587 | jars: ["sdk_library/module-lib/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1588 | stub_srcs: ["sdk_library/module-lib/myjavalib_stub_sources"], |
Paul Duffin | 6b836ba | 2020-05-13 19:19:49 +0100 | [diff] [blame] | 1589 | current_api: "sdk_library/module-lib/myjavalib.txt", |
| 1590 | removed_api: "sdk_library/module-lib/myjavalib-removed.txt", |
Paul Duffin | 8f265b9 | 2020-04-28 14:13:56 +0100 | [diff] [blame] | 1591 | sdk_version: "module_current", |
| 1592 | }, |
| 1593 | } |
| 1594 | |
| 1595 | sdk_snapshot { |
| 1596 | name: "mysdk@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1597 | visibility: ["//visibility:public"], |
Paul Duffin | 8f265b9 | 2020-04-28 14:13:56 +0100 | [diff] [blame] | 1598 | java_sdk_libs: ["mysdk_myjavalib@current"], |
| 1599 | } |
| 1600 | `), |
| 1601 | checkAllCopyRules(` |
| 1602 | .intermediates/myjavalib.stubs/android_common/javac/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar |
Colin Cross | cb77f75 | 2021-03-24 12:04:44 -0700 | [diff] [blame] | 1603 | .intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt |
| 1604 | .intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt |
Paul Duffin | 8f265b9 | 2020-04-28 14:13:56 +0100 | [diff] [blame] | 1605 | .intermediates/myjavalib.stubs.system/android_common/javac/myjavalib.stubs.system.jar -> sdk_library/system/myjavalib-stubs.jar |
Colin Cross | cb77f75 | 2021-03-24 12:04:44 -0700 | [diff] [blame] | 1606 | .intermediates/myjavalib.stubs.source.system/android_common/metalava/myjavalib.stubs.source.system_api.txt -> sdk_library/system/myjavalib.txt |
| 1607 | .intermediates/myjavalib.stubs.source.system/android_common/metalava/myjavalib.stubs.source.system_removed.txt -> sdk_library/system/myjavalib-removed.txt |
Paul Duffin | 6b836ba | 2020-05-13 19:19:49 +0100 | [diff] [blame] | 1608 | .intermediates/myjavalib.stubs.module_lib/android_common/javac/myjavalib.stubs.module_lib.jar -> sdk_library/module-lib/myjavalib-stubs.jar |
Colin Cross | cb77f75 | 2021-03-24 12:04:44 -0700 | [diff] [blame] | 1609 | .intermediates/myjavalib.stubs.source.module_lib/android_common/metalava/myjavalib.stubs.source.module_lib_api.txt -> sdk_library/module-lib/myjavalib.txt |
| 1610 | .intermediates/myjavalib.stubs.source.module_lib/android_common/metalava/myjavalib.stubs.source.module_lib_removed.txt -> sdk_library/module-lib/myjavalib-removed.txt |
Paul Duffin | 8f265b9 | 2020-04-28 14:13:56 +0100 | [diff] [blame] | 1611 | `), |
| 1612 | checkMergeZips( |
| 1613 | ".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip", |
| 1614 | ".intermediates/mysdk/common_os/tmp/sdk_library/system/myjavalib_stub_sources.zip", |
Paul Duffin | 6b836ba | 2020-05-13 19:19:49 +0100 | [diff] [blame] | 1615 | ".intermediates/mysdk/common_os/tmp/sdk_library/module-lib/myjavalib_stub_sources.zip", |
Paul Duffin | 8f265b9 | 2020-04-28 14:13:56 +0100 | [diff] [blame] | 1616 | ), |
| 1617 | ) |
| 1618 | } |
Paul Duffin | f7a6433 | 2020-05-13 16:54:55 +0100 | [diff] [blame] | 1619 | |
Paul Duffin | 0c5bae5 | 2020-06-02 13:00:08 +0100 | [diff] [blame] | 1620 | func TestSnapshotWithJavaSdkLibrary_SystemServer(t *testing.T) { |
Paul Duffin | 9ec86b1 | 2021-03-15 11:17:52 +0000 | [diff] [blame] | 1621 | result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, ` |
Paul Duffin | 0c5bae5 | 2020-06-02 13:00:08 +0100 | [diff] [blame] | 1622 | sdk { |
| 1623 | name: "mysdk", |
| 1624 | java_sdk_libs: ["myjavalib"], |
| 1625 | } |
| 1626 | |
| 1627 | java_sdk_library { |
| 1628 | name: "myjavalib", |
| 1629 | apex_available: ["//apex_available:anyapex"], |
| 1630 | srcs: ["Test.java"], |
| 1631 | sdk_version: "current", |
| 1632 | public: { |
| 1633 | enabled: true, |
| 1634 | }, |
| 1635 | system_server: { |
| 1636 | enabled: true, |
| 1637 | }, |
| 1638 | } |
| 1639 | `) |
| 1640 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 1641 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1642 | checkUnversionedAndroidBpContents(` |
Paul Duffin | 0c5bae5 | 2020-06-02 13:00:08 +0100 | [diff] [blame] | 1643 | // This is auto-generated. DO NOT EDIT. |
| 1644 | |
| 1645 | java_sdk_library_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1646 | name: "myjavalib", |
| 1647 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1648 | visibility: ["//visibility:public"], |
Paul Duffin | 0c5bae5 | 2020-06-02 13:00:08 +0100 | [diff] [blame] | 1649 | apex_available: ["//apex_available:anyapex"], |
| 1650 | shared_library: true, |
| 1651 | public: { |
| 1652 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1653 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
Paul Duffin | 0c5bae5 | 2020-06-02 13:00:08 +0100 | [diff] [blame] | 1654 | current_api: "sdk_library/public/myjavalib.txt", |
| 1655 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
| 1656 | sdk_version: "current", |
| 1657 | }, |
| 1658 | system_server: { |
| 1659 | jars: ["sdk_library/system-server/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1660 | stub_srcs: ["sdk_library/system-server/myjavalib_stub_sources"], |
Paul Duffin | 0c5bae5 | 2020-06-02 13:00:08 +0100 | [diff] [blame] | 1661 | current_api: "sdk_library/system-server/myjavalib.txt", |
| 1662 | removed_api: "sdk_library/system-server/myjavalib-removed.txt", |
| 1663 | sdk_version: "system_server_current", |
| 1664 | }, |
| 1665 | } |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1666 | `), |
| 1667 | checkVersionedAndroidBpContents(` |
| 1668 | // This is auto-generated. DO NOT EDIT. |
Paul Duffin | 0c5bae5 | 2020-06-02 13:00:08 +0100 | [diff] [blame] | 1669 | |
| 1670 | java_sdk_library_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1671 | name: "mysdk_myjavalib@current", |
| 1672 | sdk_member_name: "myjavalib", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1673 | visibility: ["//visibility:public"], |
Paul Duffin | 0c5bae5 | 2020-06-02 13:00:08 +0100 | [diff] [blame] | 1674 | apex_available: ["//apex_available:anyapex"], |
| 1675 | shared_library: true, |
| 1676 | public: { |
| 1677 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1678 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
Paul Duffin | 0c5bae5 | 2020-06-02 13:00:08 +0100 | [diff] [blame] | 1679 | current_api: "sdk_library/public/myjavalib.txt", |
| 1680 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
| 1681 | sdk_version: "current", |
| 1682 | }, |
| 1683 | system_server: { |
| 1684 | jars: ["sdk_library/system-server/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1685 | stub_srcs: ["sdk_library/system-server/myjavalib_stub_sources"], |
Paul Duffin | 0c5bae5 | 2020-06-02 13:00:08 +0100 | [diff] [blame] | 1686 | current_api: "sdk_library/system-server/myjavalib.txt", |
| 1687 | removed_api: "sdk_library/system-server/myjavalib-removed.txt", |
| 1688 | sdk_version: "system_server_current", |
| 1689 | }, |
| 1690 | } |
| 1691 | |
| 1692 | sdk_snapshot { |
| 1693 | name: "mysdk@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1694 | visibility: ["//visibility:public"], |
Paul Duffin | 0c5bae5 | 2020-06-02 13:00:08 +0100 | [diff] [blame] | 1695 | java_sdk_libs: ["mysdk_myjavalib@current"], |
| 1696 | } |
| 1697 | `), |
| 1698 | checkAllCopyRules(` |
| 1699 | .intermediates/myjavalib.stubs/android_common/javac/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar |
Colin Cross | cb77f75 | 2021-03-24 12:04:44 -0700 | [diff] [blame] | 1700 | .intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt |
| 1701 | .intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt |
Paul Duffin | 0c5bae5 | 2020-06-02 13:00:08 +0100 | [diff] [blame] | 1702 | .intermediates/myjavalib.stubs.system_server/android_common/javac/myjavalib.stubs.system_server.jar -> sdk_library/system-server/myjavalib-stubs.jar |
Colin Cross | cb77f75 | 2021-03-24 12:04:44 -0700 | [diff] [blame] | 1703 | .intermediates/myjavalib.stubs.source.system_server/android_common/metalava/myjavalib.stubs.source.system_server_api.txt -> sdk_library/system-server/myjavalib.txt |
| 1704 | .intermediates/myjavalib.stubs.source.system_server/android_common/metalava/myjavalib.stubs.source.system_server_removed.txt -> sdk_library/system-server/myjavalib-removed.txt |
Paul Duffin | 0c5bae5 | 2020-06-02 13:00:08 +0100 | [diff] [blame] | 1705 | `), |
| 1706 | checkMergeZips( |
| 1707 | ".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip", |
| 1708 | ".intermediates/mysdk/common_os/tmp/sdk_library/system-server/myjavalib_stub_sources.zip", |
| 1709 | ), |
| 1710 | ) |
| 1711 | } |
| 1712 | |
Paul Duffin | f7a6433 | 2020-05-13 16:54:55 +0100 | [diff] [blame] | 1713 | func TestSnapshotWithJavaSdkLibrary_NamingScheme(t *testing.T) { |
Paul Duffin | 9ec86b1 | 2021-03-15 11:17:52 +0000 | [diff] [blame] | 1714 | result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, ` |
Paul Duffin | f7a6433 | 2020-05-13 16:54:55 +0100 | [diff] [blame] | 1715 | sdk { |
| 1716 | name: "mysdk", |
| 1717 | java_sdk_libs: ["myjavalib"], |
| 1718 | } |
| 1719 | |
| 1720 | java_sdk_library { |
| 1721 | name: "myjavalib", |
| 1722 | apex_available: ["//apex_available:anyapex"], |
| 1723 | srcs: ["Test.java"], |
| 1724 | sdk_version: "current", |
Paul Duffin | ee9ad5d | 2020-09-11 13:04:05 +0100 | [diff] [blame] | 1725 | naming_scheme: "default", |
Paul Duffin | f7a6433 | 2020-05-13 16:54:55 +0100 | [diff] [blame] | 1726 | public: { |
| 1727 | enabled: true, |
| 1728 | }, |
| 1729 | } |
| 1730 | `) |
| 1731 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 1732 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1733 | checkUnversionedAndroidBpContents(` |
Paul Duffin | f7a6433 | 2020-05-13 16:54:55 +0100 | [diff] [blame] | 1734 | // This is auto-generated. DO NOT EDIT. |
| 1735 | |
| 1736 | java_sdk_library_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1737 | name: "myjavalib", |
| 1738 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1739 | visibility: ["//visibility:public"], |
Paul Duffin | f7a6433 | 2020-05-13 16:54:55 +0100 | [diff] [blame] | 1740 | apex_available: ["//apex_available:anyapex"], |
Paul Duffin | ee9ad5d | 2020-09-11 13:04:05 +0100 | [diff] [blame] | 1741 | naming_scheme: "default", |
Paul Duffin | d7eb1c2 | 2020-05-26 20:57:10 +0100 | [diff] [blame] | 1742 | shared_library: true, |
Paul Duffin | f7a6433 | 2020-05-13 16:54:55 +0100 | [diff] [blame] | 1743 | public: { |
| 1744 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1745 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
Paul Duffin | f7a6433 | 2020-05-13 16:54:55 +0100 | [diff] [blame] | 1746 | current_api: "sdk_library/public/myjavalib.txt", |
| 1747 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
| 1748 | sdk_version: "current", |
| 1749 | }, |
| 1750 | } |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1751 | `), |
| 1752 | checkVersionedAndroidBpContents(` |
| 1753 | // This is auto-generated. DO NOT EDIT. |
Paul Duffin | f7a6433 | 2020-05-13 16:54:55 +0100 | [diff] [blame] | 1754 | |
| 1755 | java_sdk_library_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1756 | name: "mysdk_myjavalib@current", |
| 1757 | sdk_member_name: "myjavalib", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1758 | visibility: ["//visibility:public"], |
Paul Duffin | f7a6433 | 2020-05-13 16:54:55 +0100 | [diff] [blame] | 1759 | apex_available: ["//apex_available:anyapex"], |
Paul Duffin | ee9ad5d | 2020-09-11 13:04:05 +0100 | [diff] [blame] | 1760 | naming_scheme: "default", |
Paul Duffin | d7eb1c2 | 2020-05-26 20:57:10 +0100 | [diff] [blame] | 1761 | shared_library: true, |
Paul Duffin | f7a6433 | 2020-05-13 16:54:55 +0100 | [diff] [blame] | 1762 | public: { |
| 1763 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1764 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
Paul Duffin | f7a6433 | 2020-05-13 16:54:55 +0100 | [diff] [blame] | 1765 | current_api: "sdk_library/public/myjavalib.txt", |
| 1766 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
| 1767 | sdk_version: "current", |
| 1768 | }, |
| 1769 | } |
| 1770 | |
| 1771 | sdk_snapshot { |
| 1772 | name: "mysdk@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1773 | visibility: ["//visibility:public"], |
Paul Duffin | f7a6433 | 2020-05-13 16:54:55 +0100 | [diff] [blame] | 1774 | java_sdk_libs: ["mysdk_myjavalib@current"], |
| 1775 | } |
| 1776 | `), |
| 1777 | checkAllCopyRules(` |
Paul Duffin | ee9ad5d | 2020-09-11 13:04:05 +0100 | [diff] [blame] | 1778 | .intermediates/myjavalib.stubs/android_common/javac/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar |
Colin Cross | cb77f75 | 2021-03-24 12:04:44 -0700 | [diff] [blame] | 1779 | .intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt |
| 1780 | .intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt |
Paul Duffin | f7a6433 | 2020-05-13 16:54:55 +0100 | [diff] [blame] | 1781 | `), |
| 1782 | checkMergeZips( |
| 1783 | ".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip", |
| 1784 | ), |
| 1785 | ) |
| 1786 | } |
Paul Duffin | a2ae7e0 | 2020-09-11 11:55:00 +0100 | [diff] [blame] | 1787 | |
| 1788 | func TestSnapshotWithJavaSdkLibrary_DoctagFiles(t *testing.T) { |
Paul Duffin | db462dd | 2021-03-21 22:01:55 +0000 | [diff] [blame] | 1789 | result := android.GroupFixturePreparers( |
| 1790 | prepareForSdkTestWithJavaSdkLibrary, |
| 1791 | android.FixtureAddFile("docs/known_doctags", nil), |
| 1792 | ).RunTestWithBp(t, ` |
Paul Duffin | a2ae7e0 | 2020-09-11 11:55:00 +0100 | [diff] [blame] | 1793 | sdk { |
| 1794 | name: "mysdk", |
| 1795 | java_sdk_libs: ["myjavalib"], |
| 1796 | } |
| 1797 | |
| 1798 | java_sdk_library { |
| 1799 | name: "myjavalib", |
| 1800 | srcs: ["Test.java"], |
| 1801 | sdk_version: "current", |
| 1802 | public: { |
| 1803 | enabled: true, |
| 1804 | }, |
| 1805 | doctag_files: ["docs/known_doctags"], |
| 1806 | } |
| 1807 | |
| 1808 | filegroup { |
| 1809 | name: "mygroup", |
| 1810 | srcs: [":myjavalib{.doctags}"], |
| 1811 | } |
| 1812 | `) |
| 1813 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 1814 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1815 | checkUnversionedAndroidBpContents(` |
Paul Duffin | a2ae7e0 | 2020-09-11 11:55:00 +0100 | [diff] [blame] | 1816 | // This is auto-generated. DO NOT EDIT. |
| 1817 | |
| 1818 | java_sdk_library_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1819 | name: "myjavalib", |
| 1820 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1821 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1822 | apex_available: ["//apex_available:platform"], |
Paul Duffin | a2ae7e0 | 2020-09-11 11:55:00 +0100 | [diff] [blame] | 1823 | shared_library: true, |
| 1824 | doctag_files: ["doctags/docs/known_doctags"], |
| 1825 | public: { |
| 1826 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1827 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
Paul Duffin | a2ae7e0 | 2020-09-11 11:55:00 +0100 | [diff] [blame] | 1828 | current_api: "sdk_library/public/myjavalib.txt", |
| 1829 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
| 1830 | sdk_version: "current", |
| 1831 | }, |
| 1832 | } |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1833 | `), |
| 1834 | checkVersionedAndroidBpContents(` |
| 1835 | // This is auto-generated. DO NOT EDIT. |
Paul Duffin | a2ae7e0 | 2020-09-11 11:55:00 +0100 | [diff] [blame] | 1836 | |
| 1837 | java_sdk_library_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1838 | name: "mysdk_myjavalib@current", |
| 1839 | sdk_member_name: "myjavalib", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1840 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1841 | apex_available: ["//apex_available:platform"], |
Paul Duffin | a2ae7e0 | 2020-09-11 11:55:00 +0100 | [diff] [blame] | 1842 | shared_library: true, |
| 1843 | doctag_files: ["doctags/docs/known_doctags"], |
| 1844 | public: { |
| 1845 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1846 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
Paul Duffin | a2ae7e0 | 2020-09-11 11:55:00 +0100 | [diff] [blame] | 1847 | current_api: "sdk_library/public/myjavalib.txt", |
| 1848 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
| 1849 | sdk_version: "current", |
| 1850 | }, |
| 1851 | } |
| 1852 | |
| 1853 | sdk_snapshot { |
| 1854 | name: "mysdk@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1855 | visibility: ["//visibility:public"], |
Paul Duffin | a2ae7e0 | 2020-09-11 11:55:00 +0100 | [diff] [blame] | 1856 | java_sdk_libs: ["mysdk_myjavalib@current"], |
| 1857 | } |
| 1858 | `), |
| 1859 | checkAllCopyRules(` |
| 1860 | .intermediates/myjavalib.stubs/android_common/javac/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar |
Colin Cross | cb77f75 | 2021-03-24 12:04:44 -0700 | [diff] [blame] | 1861 | .intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt |
| 1862 | .intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt |
Paul Duffin | a2ae7e0 | 2020-09-11 11:55:00 +0100 | [diff] [blame] | 1863 | docs/known_doctags -> doctags/docs/known_doctags |
| 1864 | `), |
| 1865 | ) |
| 1866 | } |