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_import { |
| 726 | name: "mysdk_myjavalib.stubs", |
| 727 | prefer: false, |
| 728 | visibility: ["//visibility:private"], |
| 729 | apex_available: ["//apex_available:platform"], |
| 730 | jars: ["java/myjavalib.stubs.jar"], |
| 731 | } |
| 732 | |
| 733 | java_sdk_library_import { |
| 734 | name: "myjavalib", |
| 735 | prefer: false, |
| 736 | visibility: ["//visibility:public"], |
| 737 | apex_available: ["//apex_available:anyapex"], |
| 738 | shared_library: false, |
| 739 | public: { |
| 740 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
| 741 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
| 742 | current_api: "sdk_library/public/myjavalib.txt", |
| 743 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
| 744 | sdk_version: "current", |
| 745 | }, |
| 746 | } |
| 747 | |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 748 | java_system_modules_import { |
| 749 | name: "my-system-modules", |
| 750 | prefer: false, |
| 751 | visibility: ["//visibility:public"], |
| 752 | libs: [ |
| 753 | "mysdk_system-module", |
| 754 | "exported-system-module", |
Paul Duffin | 3302871 | 2021-06-22 11:00:07 +0100 | [diff] [blame^] | 755 | "mysdk_myjavalib.stubs", |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 756 | ], |
| 757 | } |
| 758 | `), |
| 759 | checkVersionedAndroidBpContents(` |
| 760 | // This is auto-generated. DO NOT EDIT. |
| 761 | |
| 762 | java_import { |
| 763 | name: "mysdk_exported-system-module@current", |
| 764 | sdk_member_name: "exported-system-module", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 765 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 766 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 7291095 | 2020-01-20 18:16:30 +0000 | [diff] [blame] | 767 | jars: ["java/exported-system-module.jar"], |
| 768 | } |
| 769 | |
| 770 | java_import { |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 771 | name: "mysdk_system-module@current", |
| 772 | sdk_member_name: "system-module", |
Paul Duffin | 7291095 | 2020-01-20 18:16:30 +0000 | [diff] [blame] | 773 | visibility: ["//visibility:private"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 774 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 775 | jars: ["java/system-module.jar"], |
| 776 | } |
| 777 | |
Paul Duffin | 3302871 | 2021-06-22 11:00:07 +0100 | [diff] [blame^] | 778 | java_import { |
| 779 | name: "mysdk_myjavalib.stubs@current", |
| 780 | sdk_member_name: "myjavalib.stubs", |
| 781 | visibility: ["//visibility:private"], |
| 782 | apex_available: ["//apex_available:platform"], |
| 783 | jars: ["java/myjavalib.stubs.jar"], |
| 784 | } |
| 785 | |
| 786 | java_sdk_library_import { |
| 787 | name: "mysdk_myjavalib@current", |
| 788 | sdk_member_name: "myjavalib", |
| 789 | visibility: ["//visibility:public"], |
| 790 | apex_available: ["//apex_available:anyapex"], |
| 791 | shared_library: false, |
| 792 | public: { |
| 793 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
| 794 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
| 795 | current_api: "sdk_library/public/myjavalib.txt", |
| 796 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
| 797 | sdk_version: "current", |
| 798 | }, |
| 799 | } |
| 800 | |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 801 | java_system_modules_import { |
| 802 | name: "mysdk_my-system-modules@current", |
| 803 | sdk_member_name: "my-system-modules", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 804 | visibility: ["//visibility:public"], |
Paul Duffin | 7291095 | 2020-01-20 18:16:30 +0000 | [diff] [blame] | 805 | libs: [ |
| 806 | "mysdk_system-module@current", |
| 807 | "mysdk_exported-system-module@current", |
Paul Duffin | 3302871 | 2021-06-22 11:00:07 +0100 | [diff] [blame^] | 808 | "mysdk_myjavalib.stubs@current", |
Paul Duffin | 7291095 | 2020-01-20 18:16:30 +0000 | [diff] [blame] | 809 | ], |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 810 | } |
| 811 | |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 812 | sdk_snapshot { |
| 813 | name: "mysdk@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 814 | visibility: ["//visibility:public"], |
Paul Duffin | 7291095 | 2020-01-20 18:16:30 +0000 | [diff] [blame] | 815 | java_header_libs: ["mysdk_exported-system-module@current"], |
Paul Duffin | 3302871 | 2021-06-22 11:00:07 +0100 | [diff] [blame^] | 816 | java_sdk_libs: ["mysdk_myjavalib@current"], |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 817 | java_system_modules: ["mysdk_my-system-modules@current"], |
| 818 | } |
| 819 | `), |
Paul Duffin | 7291095 | 2020-01-20 18:16:30 +0000 | [diff] [blame] | 820 | checkAllCopyRules(` |
| 821 | .intermediates/exported-system-module/android_common/turbine-combined/exported-system-module.jar -> java/exported-system-module.jar |
| 822 | .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^] | 823 | .intermediates/myjavalib.stubs/android_common/turbine-combined/myjavalib.stubs.jar -> java/myjavalib.stubs.jar |
| 824 | .intermediates/myjavalib.stubs/android_common/javac/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar |
| 825 | .intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt |
| 826 | .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] | 827 | `), |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 828 | ) |
| 829 | } |
| 830 | |
| 831 | func TestHostSnapshotWithJavaSystemModules(t *testing.T) { |
Paul Duffin | 9ec86b1 | 2021-03-15 11:17:52 +0000 | [diff] [blame] | 832 | result := android.GroupFixturePreparers(prepareForSdkTestWithJava).RunTestWithBp(t, ` |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 833 | sdk { |
| 834 | name: "mysdk", |
| 835 | device_supported: false, |
| 836 | host_supported: true, |
| 837 | java_system_modules: ["my-system-modules"], |
| 838 | } |
| 839 | |
| 840 | java_system_modules { |
| 841 | name: "my-system-modules", |
| 842 | device_supported: false, |
| 843 | host_supported: true, |
| 844 | libs: ["system-module"], |
| 845 | } |
| 846 | |
| 847 | java_library { |
| 848 | name: "system-module", |
| 849 | device_supported: false, |
| 850 | host_supported: true, |
| 851 | srcs: ["Test.java"], |
| 852 | sdk_version: "none", |
| 853 | system_modules: "none", |
| 854 | } |
| 855 | `) |
| 856 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 857 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 858 | checkUnversionedAndroidBpContents(` |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 859 | // This is auto-generated. DO NOT EDIT. |
| 860 | |
| 861 | java_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 862 | name: "mysdk_system-module", |
| 863 | prefer: false, |
Paul Duffin | 7291095 | 2020-01-20 18:16:30 +0000 | [diff] [blame] | 864 | visibility: ["//visibility:private"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 865 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 866 | device_supported: false, |
| 867 | host_supported: true, |
| 868 | jars: ["java/system-module.jar"], |
| 869 | } |
| 870 | |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 871 | java_system_modules_import { |
| 872 | name: "my-system-modules", |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 873 | prefer: false, |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 874 | visibility: ["//visibility:public"], |
| 875 | device_supported: false, |
| 876 | host_supported: true, |
| 877 | libs: ["mysdk_system-module"], |
| 878 | } |
| 879 | `), |
| 880 | checkVersionedAndroidBpContents(` |
| 881 | // This is auto-generated. DO NOT EDIT. |
| 882 | |
| 883 | java_import { |
| 884 | name: "mysdk_system-module@current", |
| 885 | sdk_member_name: "system-module", |
Paul Duffin | 7291095 | 2020-01-20 18:16:30 +0000 | [diff] [blame] | 886 | visibility: ["//visibility:private"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 887 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 888 | device_supported: false, |
| 889 | host_supported: true, |
| 890 | jars: ["java/system-module.jar"], |
| 891 | } |
| 892 | |
| 893 | java_system_modules_import { |
| 894 | name: "mysdk_my-system-modules@current", |
| 895 | sdk_member_name: "my-system-modules", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 896 | visibility: ["//visibility:public"], |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 897 | device_supported: false, |
| 898 | host_supported: true, |
| 899 | libs: ["mysdk_system-module@current"], |
| 900 | } |
| 901 | |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 902 | sdk_snapshot { |
| 903 | name: "mysdk@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 904 | visibility: ["//visibility:public"], |
Paul Duffin | 7b81f5e | 2020-01-13 21:03:22 +0000 | [diff] [blame] | 905 | device_supported: false, |
| 906 | host_supported: true, |
| 907 | java_system_modules: ["mysdk_my-system-modules@current"], |
| 908 | } |
| 909 | `), |
| 910 | checkAllCopyRules(".intermediates/system-module/linux_glibc_common/javac/system-module.jar -> java/system-module.jar"), |
| 911 | ) |
| 912 | } |
Paul Duffin | 865171e | 2020-03-02 18:38:15 +0000 | [diff] [blame] | 913 | |
| 914 | func TestDeviceAndHostSnapshotWithOsSpecificMembers(t *testing.T) { |
Paul Duffin | 9ec86b1 | 2021-03-15 11:17:52 +0000 | [diff] [blame] | 915 | result := android.GroupFixturePreparers(prepareForSdkTestWithJava).RunTestWithBp(t, ` |
Paul Duffin | 865171e | 2020-03-02 18:38:15 +0000 | [diff] [blame] | 916 | module_exports { |
| 917 | name: "myexports", |
| 918 | host_supported: true, |
| 919 | java_libs: ["myjavalib"], |
| 920 | target: { |
| 921 | android: { |
| 922 | java_header_libs: ["androidjavalib"], |
| 923 | }, |
| 924 | host: { |
| 925 | java_header_libs: ["hostjavalib"], |
| 926 | }, |
| 927 | }, |
| 928 | } |
| 929 | |
| 930 | java_library { |
| 931 | name: "myjavalib", |
| 932 | host_supported: true, |
| 933 | srcs: ["Test.java"], |
| 934 | system_modules: "none", |
| 935 | sdk_version: "none", |
| 936 | } |
| 937 | |
| 938 | java_library { |
| 939 | name: "androidjavalib", |
| 940 | srcs: ["Test.java"], |
| 941 | system_modules: "none", |
| 942 | sdk_version: "none", |
| 943 | } |
| 944 | |
| 945 | java_library_host { |
| 946 | name: "hostjavalib", |
| 947 | srcs: ["Test.java"], |
| 948 | } |
| 949 | `) |
| 950 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 951 | CheckSnapshot(t, result, "myexports", "", |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 952 | checkUnversionedAndroidBpContents(` |
Paul Duffin | 865171e | 2020-03-02 18:38:15 +0000 | [diff] [blame] | 953 | // This is auto-generated. DO NOT EDIT. |
| 954 | |
| 955 | java_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 956 | name: "hostjavalib", |
| 957 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 958 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 959 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 865171e | 2020-03-02 18:38:15 +0000 | [diff] [blame] | 960 | device_supported: false, |
| 961 | host_supported: true, |
| 962 | jars: ["java/hostjavalib.jar"], |
| 963 | } |
| 964 | |
| 965 | java_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 966 | name: "androidjavalib", |
Paul Duffin | 865171e | 2020-03-02 18:38:15 +0000 | [diff] [blame] | 967 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 968 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 969 | apex_available: ["//apex_available:platform"], |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 970 | jars: ["java/androidjavalib.jar"], |
| 971 | } |
| 972 | |
| 973 | java_import { |
| 974 | name: "myjavalib", |
| 975 | prefer: false, |
| 976 | visibility: ["//visibility:public"], |
| 977 | apex_available: ["//apex_available:platform"], |
| 978 | host_supported: true, |
| 979 | target: { |
| 980 | android: { |
| 981 | jars: ["java/android/myjavalib.jar"], |
| 982 | }, |
| 983 | linux_glibc: { |
| 984 | jars: ["java/linux_glibc/myjavalib.jar"], |
| 985 | }, |
| 986 | }, |
| 987 | } |
| 988 | `), |
| 989 | checkVersionedAndroidBpContents(` |
| 990 | // This is auto-generated. DO NOT EDIT. |
| 991 | |
| 992 | java_import { |
| 993 | name: "myexports_hostjavalib@current", |
| 994 | sdk_member_name: "hostjavalib", |
| 995 | visibility: ["//visibility:public"], |
| 996 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 865171e | 2020-03-02 18:38:15 +0000 | [diff] [blame] | 997 | device_supported: false, |
| 998 | host_supported: true, |
| 999 | jars: ["java/hostjavalib.jar"], |
| 1000 | } |
| 1001 | |
| 1002 | java_import { |
| 1003 | name: "myexports_androidjavalib@current", |
| 1004 | sdk_member_name: "androidjavalib", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1005 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1006 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 865171e | 2020-03-02 18:38:15 +0000 | [diff] [blame] | 1007 | jars: ["java/androidjavalib.jar"], |
| 1008 | } |
| 1009 | |
| 1010 | java_import { |
Paul Duffin | 865171e | 2020-03-02 18:38:15 +0000 | [diff] [blame] | 1011 | name: "myexports_myjavalib@current", |
| 1012 | sdk_member_name: "myjavalib", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1013 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1014 | apex_available: ["//apex_available:platform"], |
Paul Duffin | 865171e | 2020-03-02 18:38:15 +0000 | [diff] [blame] | 1015 | host_supported: true, |
| 1016 | target: { |
| 1017 | android: { |
| 1018 | jars: ["java/android/myjavalib.jar"], |
| 1019 | }, |
| 1020 | linux_glibc: { |
| 1021 | jars: ["java/linux_glibc/myjavalib.jar"], |
| 1022 | }, |
| 1023 | }, |
| 1024 | } |
| 1025 | |
Paul Duffin | 865171e | 2020-03-02 18:38:15 +0000 | [diff] [blame] | 1026 | module_exports_snapshot { |
| 1027 | name: "myexports@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1028 | visibility: ["//visibility:public"], |
Paul Duffin | 865171e | 2020-03-02 18:38:15 +0000 | [diff] [blame] | 1029 | host_supported: true, |
Paul Duffin | 07ef3cb | 2020-03-11 18:17:42 +0000 | [diff] [blame] | 1030 | java_libs: ["myexports_myjavalib@current"], |
Paul Duffin | 865171e | 2020-03-02 18:38:15 +0000 | [diff] [blame] | 1031 | target: { |
| 1032 | android: { |
| 1033 | java_header_libs: ["myexports_androidjavalib@current"], |
| 1034 | }, |
| 1035 | linux_glibc: { |
| 1036 | java_header_libs: ["myexports_hostjavalib@current"], |
| 1037 | }, |
| 1038 | }, |
Paul Duffin | 865171e | 2020-03-02 18:38:15 +0000 | [diff] [blame] | 1039 | } |
| 1040 | `), |
| 1041 | checkAllCopyRules(` |
| 1042 | .intermediates/hostjavalib/linux_glibc_common/javac/hostjavalib.jar -> java/hostjavalib.jar |
| 1043 | .intermediates/androidjavalib/android_common/turbine-combined/androidjavalib.jar -> java/androidjavalib.jar |
| 1044 | .intermediates/myjavalib/android_common/javac/myjavalib.jar -> java/android/myjavalib.jar |
| 1045 | .intermediates/myjavalib/linux_glibc_common/javac/myjavalib.jar -> java/linux_glibc/myjavalib.jar |
| 1046 | `), |
| 1047 | ) |
| 1048 | } |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1049 | |
| 1050 | func TestSnapshotWithJavaSdkLibrary(t *testing.T) { |
Paul Duffin | 9ec86b1 | 2021-03-15 11:17:52 +0000 | [diff] [blame] | 1051 | result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, ` |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1052 | sdk { |
| 1053 | name: "mysdk", |
| 1054 | java_sdk_libs: ["myjavalib"], |
| 1055 | } |
| 1056 | |
| 1057 | java_sdk_library { |
| 1058 | name: "myjavalib", |
| 1059 | apex_available: ["//apex_available:anyapex"], |
| 1060 | srcs: ["Test.java"], |
| 1061 | sdk_version: "current", |
Paul Duffin | d7eb1c2 | 2020-05-26 20:57:10 +0100 | [diff] [blame] | 1062 | shared_library: false, |
Paul Duffin | 4911a89 | 2020-04-29 23:35:13 +0100 | [diff] [blame] | 1063 | stubs_library_visibility: ["//other"], |
| 1064 | stubs_source_visibility: ["//another"], |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1065 | } |
| 1066 | `) |
| 1067 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 1068 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1069 | checkUnversionedAndroidBpContents(` |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1070 | // This is auto-generated. DO NOT EDIT. |
| 1071 | |
| 1072 | java_sdk_library_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1073 | name: "myjavalib", |
| 1074 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1075 | visibility: ["//visibility:public"], |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1076 | apex_available: ["//apex_available:anyapex"], |
Paul Duffin | d7eb1c2 | 2020-05-26 20:57:10 +0100 | [diff] [blame] | 1077 | shared_library: false, |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1078 | public: { |
| 1079 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1080 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
Paul Duffin | 1fd005d | 2020-04-09 01:08:11 +0100 | [diff] [blame] | 1081 | current_api: "sdk_library/public/myjavalib.txt", |
| 1082 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1083 | sdk_version: "current", |
| 1084 | }, |
| 1085 | system: { |
| 1086 | jars: ["sdk_library/system/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1087 | stub_srcs: ["sdk_library/system/myjavalib_stub_sources"], |
Paul Duffin | 1fd005d | 2020-04-09 01:08:11 +0100 | [diff] [blame] | 1088 | current_api: "sdk_library/system/myjavalib.txt", |
| 1089 | removed_api: "sdk_library/system/myjavalib-removed.txt", |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1090 | sdk_version: "system_current", |
| 1091 | }, |
| 1092 | test: { |
| 1093 | jars: ["sdk_library/test/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1094 | stub_srcs: ["sdk_library/test/myjavalib_stub_sources"], |
Paul Duffin | 1fd005d | 2020-04-09 01:08:11 +0100 | [diff] [blame] | 1095 | current_api: "sdk_library/test/myjavalib.txt", |
| 1096 | removed_api: "sdk_library/test/myjavalib-removed.txt", |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1097 | sdk_version: "test_current", |
| 1098 | }, |
| 1099 | } |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1100 | `), |
| 1101 | checkVersionedAndroidBpContents(` |
| 1102 | // This is auto-generated. DO NOT EDIT. |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1103 | |
| 1104 | java_sdk_library_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1105 | name: "mysdk_myjavalib@current", |
| 1106 | sdk_member_name: "myjavalib", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1107 | visibility: ["//visibility:public"], |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1108 | apex_available: ["//apex_available:anyapex"], |
Paul Duffin | d7eb1c2 | 2020-05-26 20:57:10 +0100 | [diff] [blame] | 1109 | shared_library: false, |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1110 | public: { |
| 1111 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1112 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
Paul Duffin | 1fd005d | 2020-04-09 01:08:11 +0100 | [diff] [blame] | 1113 | current_api: "sdk_library/public/myjavalib.txt", |
| 1114 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1115 | sdk_version: "current", |
| 1116 | }, |
| 1117 | system: { |
| 1118 | jars: ["sdk_library/system/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1119 | stub_srcs: ["sdk_library/system/myjavalib_stub_sources"], |
Paul Duffin | 1fd005d | 2020-04-09 01:08:11 +0100 | [diff] [blame] | 1120 | current_api: "sdk_library/system/myjavalib.txt", |
| 1121 | removed_api: "sdk_library/system/myjavalib-removed.txt", |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1122 | sdk_version: "system_current", |
| 1123 | }, |
| 1124 | test: { |
| 1125 | jars: ["sdk_library/test/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1126 | stub_srcs: ["sdk_library/test/myjavalib_stub_sources"], |
Paul Duffin | 1fd005d | 2020-04-09 01:08:11 +0100 | [diff] [blame] | 1127 | current_api: "sdk_library/test/myjavalib.txt", |
| 1128 | removed_api: "sdk_library/test/myjavalib-removed.txt", |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1129 | sdk_version: "test_current", |
| 1130 | }, |
| 1131 | } |
| 1132 | |
| 1133 | sdk_snapshot { |
| 1134 | name: "mysdk@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1135 | visibility: ["//visibility:public"], |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1136 | java_sdk_libs: ["mysdk_myjavalib@current"], |
| 1137 | } |
| 1138 | `), |
| 1139 | checkAllCopyRules(` |
| 1140 | .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] | 1141 | .intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt |
| 1142 | .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] | 1143 | .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] | 1144 | .intermediates/myjavalib.stubs.source.system/android_common/metalava/myjavalib.stubs.source.system_api.txt -> sdk_library/system/myjavalib.txt |
| 1145 | .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] | 1146 | .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] | 1147 | .intermediates/myjavalib.stubs.source.test/android_common/metalava/myjavalib.stubs.source.test_api.txt -> sdk_library/test/myjavalib.txt |
| 1148 | .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] | 1149 | `), |
Paul Duffin | 3d1248c | 2020-04-09 00:10:17 +0100 | [diff] [blame] | 1150 | checkMergeZips( |
| 1151 | ".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip", |
| 1152 | ".intermediates/mysdk/common_os/tmp/sdk_library/system/myjavalib_stub_sources.zip", |
Paul Duffin | 3302871 | 2021-06-22 11:00:07 +0100 | [diff] [blame^] | 1153 | ".intermediates/mysdk/common_os/tmp/sdk_library/test/myjavalib_stub_sources.zip", |
| 1154 | ), |
| 1155 | snapshotTestChecker(checkSnapshotWithoutSource, func(t *testing.T, result *android.TestResult) { |
| 1156 | // Show that the existing behavior is incorrect as the suffix for the child modules is added |
| 1157 | // to the version not before it. |
| 1158 | result.Module("mysdk_myjavalib@current.stubs", "android_common") |
| 1159 | result.Module("mysdk_myjavalib@current.stubs.source", "android_common") |
| 1160 | }), |
Paul Duffin | dd46f71 | 2020-02-10 13:37:10 +0000 | [diff] [blame] | 1161 | ) |
| 1162 | } |
Paul Duffin | 3375e35 | 2020-04-28 10:44:03 +0100 | [diff] [blame] | 1163 | |
Paul Duffin | 22628d5 | 2021-05-12 23:13:22 +0100 | [diff] [blame] | 1164 | func TestSnapshotWithJavaSdkLibrary_UseSrcJar(t *testing.T) { |
| 1165 | result := android.GroupFixturePreparers( |
| 1166 | prepareForSdkTestWithJavaSdkLibrary, |
| 1167 | android.FixtureMergeEnv(map[string]string{ |
| 1168 | "SOONG_SDK_SNAPSHOT_USE_SRCJAR": "true", |
| 1169 | }), |
| 1170 | ).RunTestWithBp(t, ` |
| 1171 | sdk { |
| 1172 | name: "mysdk", |
| 1173 | java_sdk_libs: ["myjavalib"], |
| 1174 | } |
| 1175 | |
| 1176 | java_sdk_library { |
| 1177 | name: "myjavalib", |
| 1178 | srcs: ["Test.java"], |
| 1179 | sdk_version: "current", |
| 1180 | shared_library: false, |
| 1181 | public: { |
| 1182 | enabled: true, |
| 1183 | }, |
| 1184 | } |
| 1185 | `) |
| 1186 | |
| 1187 | CheckSnapshot(t, result, "mysdk", "", |
| 1188 | checkUnversionedAndroidBpContents(` |
| 1189 | // This is auto-generated. DO NOT EDIT. |
| 1190 | |
| 1191 | java_sdk_library_import { |
| 1192 | name: "myjavalib", |
| 1193 | prefer: false, |
| 1194 | visibility: ["//visibility:public"], |
| 1195 | apex_available: ["//apex_available:platform"], |
| 1196 | shared_library: false, |
| 1197 | public: { |
| 1198 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
| 1199 | stub_srcs: ["sdk_library/public/myjavalib.srcjar"], |
| 1200 | current_api: "sdk_library/public/myjavalib.txt", |
| 1201 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
| 1202 | sdk_version: "current", |
| 1203 | }, |
| 1204 | } |
| 1205 | `), |
| 1206 | checkAllCopyRules(` |
| 1207 | .intermediates/myjavalib.stubs/android_common/javac/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar |
| 1208 | .intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source-stubs.srcjar -> sdk_library/public/myjavalib.srcjar |
| 1209 | .intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt |
| 1210 | .intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt |
| 1211 | `), |
| 1212 | ) |
| 1213 | } |
| 1214 | |
Paul Duffin | 1267d87 | 2021-04-16 17:21:36 +0100 | [diff] [blame] | 1215 | func TestSnapshotWithJavaSdkLibrary_CompileDex(t *testing.T) { |
| 1216 | result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, ` |
| 1217 | sdk { |
| 1218 | name: "mysdk", |
| 1219 | java_sdk_libs: ["myjavalib"], |
| 1220 | } |
| 1221 | |
| 1222 | java_sdk_library { |
| 1223 | name: "myjavalib", |
| 1224 | srcs: ["Test.java"], |
| 1225 | sdk_version: "current", |
| 1226 | shared_library: false, |
| 1227 | compile_dex: true, |
| 1228 | public: { |
| 1229 | enabled: true, |
| 1230 | }, |
| 1231 | system: { |
| 1232 | enabled: true, |
| 1233 | }, |
| 1234 | } |
| 1235 | `) |
| 1236 | |
| 1237 | CheckSnapshot(t, result, "mysdk", "", |
| 1238 | checkUnversionedAndroidBpContents(` |
| 1239 | // This is auto-generated. DO NOT EDIT. |
| 1240 | |
| 1241 | java_sdk_library_import { |
| 1242 | name: "myjavalib", |
| 1243 | prefer: false, |
| 1244 | visibility: ["//visibility:public"], |
| 1245 | apex_available: ["//apex_available:platform"], |
| 1246 | shared_library: false, |
| 1247 | compile_dex: true, |
| 1248 | public: { |
| 1249 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
| 1250 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
| 1251 | current_api: "sdk_library/public/myjavalib.txt", |
| 1252 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
| 1253 | sdk_version: "current", |
| 1254 | }, |
| 1255 | system: { |
| 1256 | jars: ["sdk_library/system/myjavalib-stubs.jar"], |
| 1257 | stub_srcs: ["sdk_library/system/myjavalib_stub_sources"], |
| 1258 | current_api: "sdk_library/system/myjavalib.txt", |
| 1259 | removed_api: "sdk_library/system/myjavalib-removed.txt", |
| 1260 | sdk_version: "system_current", |
| 1261 | }, |
| 1262 | } |
| 1263 | `), |
| 1264 | snapshotTestChecker(checkSnapshotWithSourcePreferred, func(t *testing.T, result *android.TestResult) { |
| 1265 | ctx := android.ModuleInstallPathContextForTesting(result.Config) |
| 1266 | dexJarBuildPath := func(name string, kind android.SdkKind) string { |
| 1267 | dep := result.Module(name, "android_common").(java.SdkLibraryDependency) |
| 1268 | path := dep.SdkApiStubDexJar(ctx, kind) |
| 1269 | return path.RelativeToTop().String() |
| 1270 | } |
| 1271 | |
| 1272 | dexJarPath := dexJarBuildPath("myjavalib", android.SdkPublic) |
| 1273 | android.AssertStringEquals(t, "source dex public stubs jar build path", "out/soong/.intermediates/myjavalib.stubs/android_common/dex/myjavalib.stubs.jar", dexJarPath) |
| 1274 | |
| 1275 | dexJarPath = dexJarBuildPath("myjavalib", android.SdkSystem) |
| 1276 | systemDexJar := "out/soong/.intermediates/myjavalib.stubs.system/android_common/dex/myjavalib.stubs.system.jar" |
| 1277 | android.AssertStringEquals(t, "source dex system stubs jar build path", systemDexJar, dexJarPath) |
| 1278 | |
| 1279 | // This should fall back to system as module is not available. |
| 1280 | dexJarPath = dexJarBuildPath("myjavalib", android.SdkModule) |
| 1281 | android.AssertStringEquals(t, "source dex module stubs jar build path", systemDexJar, dexJarPath) |
| 1282 | |
| 1283 | dexJarPath = dexJarBuildPath(android.PrebuiltNameFromSource("myjavalib"), android.SdkPublic) |
| 1284 | android.AssertStringEquals(t, "prebuilt dex public stubs jar build path", "out/soong/.intermediates/snapshot/prebuilt_myjavalib.stubs/android_common/dex/myjavalib.stubs.jar", dexJarPath) |
| 1285 | }), |
| 1286 | ) |
| 1287 | } |
| 1288 | |
Paul Duffin | 780c5f4 | 2020-05-12 15:52:55 +0100 | [diff] [blame] | 1289 | func TestSnapshotWithJavaSdkLibrary_SdkVersion_None(t *testing.T) { |
Paul Duffin | 9ec86b1 | 2021-03-15 11:17:52 +0000 | [diff] [blame] | 1290 | result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, ` |
Paul Duffin | 780c5f4 | 2020-05-12 15:52:55 +0100 | [diff] [blame] | 1291 | sdk { |
| 1292 | name: "mysdk", |
| 1293 | java_sdk_libs: ["myjavalib"], |
| 1294 | } |
| 1295 | |
| 1296 | java_sdk_library { |
| 1297 | name: "myjavalib", |
| 1298 | srcs: ["Test.java"], |
| 1299 | sdk_version: "none", |
| 1300 | system_modules: "none", |
| 1301 | } |
| 1302 | `) |
| 1303 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 1304 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1305 | checkUnversionedAndroidBpContents(` |
Paul Duffin | 780c5f4 | 2020-05-12 15:52:55 +0100 | [diff] [blame] | 1306 | // This is auto-generated. DO NOT EDIT. |
| 1307 | |
| 1308 | java_sdk_library_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1309 | name: "myjavalib", |
| 1310 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1311 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1312 | apex_available: ["//apex_available:platform"], |
Paul Duffin | d7eb1c2 | 2020-05-26 20:57:10 +0100 | [diff] [blame] | 1313 | shared_library: true, |
Paul Duffin | 780c5f4 | 2020-05-12 15:52:55 +0100 | [diff] [blame] | 1314 | public: { |
| 1315 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1316 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
Paul Duffin | 780c5f4 | 2020-05-12 15:52:55 +0100 | [diff] [blame] | 1317 | current_api: "sdk_library/public/myjavalib.txt", |
| 1318 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
| 1319 | sdk_version: "none", |
| 1320 | }, |
| 1321 | } |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1322 | `), |
| 1323 | checkVersionedAndroidBpContents(` |
| 1324 | // This is auto-generated. DO NOT EDIT. |
Paul Duffin | 780c5f4 | 2020-05-12 15:52:55 +0100 | [diff] [blame] | 1325 | |
| 1326 | java_sdk_library_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1327 | name: "mysdk_myjavalib@current", |
| 1328 | sdk_member_name: "myjavalib", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1329 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1330 | apex_available: ["//apex_available:platform"], |
Paul Duffin | d7eb1c2 | 2020-05-26 20:57:10 +0100 | [diff] [blame] | 1331 | shared_library: true, |
Paul Duffin | 780c5f4 | 2020-05-12 15:52:55 +0100 | [diff] [blame] | 1332 | public: { |
| 1333 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1334 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
Paul Duffin | 780c5f4 | 2020-05-12 15:52:55 +0100 | [diff] [blame] | 1335 | current_api: "sdk_library/public/myjavalib.txt", |
| 1336 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
| 1337 | sdk_version: "none", |
| 1338 | }, |
| 1339 | } |
| 1340 | |
| 1341 | sdk_snapshot { |
| 1342 | name: "mysdk@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1343 | visibility: ["//visibility:public"], |
Paul Duffin | 780c5f4 | 2020-05-12 15:52:55 +0100 | [diff] [blame] | 1344 | java_sdk_libs: ["mysdk_myjavalib@current"], |
| 1345 | } |
| 1346 | `), |
| 1347 | checkAllCopyRules(` |
| 1348 | .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] | 1349 | .intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt |
| 1350 | .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] | 1351 | `), |
| 1352 | checkMergeZips( |
| 1353 | ".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip", |
| 1354 | ), |
| 1355 | ) |
| 1356 | } |
| 1357 | |
Paul Duffin | 87a05a3 | 2020-05-12 11:50:28 +0100 | [diff] [blame] | 1358 | func TestSnapshotWithJavaSdkLibrary_SdkVersion_ForScope(t *testing.T) { |
Paul Duffin | 9ec86b1 | 2021-03-15 11:17:52 +0000 | [diff] [blame] | 1359 | result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, ` |
Paul Duffin | 87a05a3 | 2020-05-12 11:50:28 +0100 | [diff] [blame] | 1360 | sdk { |
| 1361 | name: "mysdk", |
| 1362 | java_sdk_libs: ["myjavalib"], |
| 1363 | } |
| 1364 | |
| 1365 | java_sdk_library { |
| 1366 | name: "myjavalib", |
| 1367 | srcs: ["Test.java"], |
| 1368 | sdk_version: "module_current", |
| 1369 | public: { |
| 1370 | enabled: true, |
| 1371 | sdk_version: "module_current", |
| 1372 | }, |
| 1373 | } |
| 1374 | `) |
| 1375 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 1376 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1377 | checkUnversionedAndroidBpContents(` |
Paul Duffin | 87a05a3 | 2020-05-12 11:50:28 +0100 | [diff] [blame] | 1378 | // This is auto-generated. DO NOT EDIT. |
| 1379 | |
| 1380 | java_sdk_library_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1381 | name: "myjavalib", |
| 1382 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1383 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1384 | apex_available: ["//apex_available:platform"], |
Paul Duffin | d7eb1c2 | 2020-05-26 20:57:10 +0100 | [diff] [blame] | 1385 | shared_library: true, |
Paul Duffin | 87a05a3 | 2020-05-12 11:50:28 +0100 | [diff] [blame] | 1386 | public: { |
| 1387 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1388 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
Paul Duffin | 87a05a3 | 2020-05-12 11:50:28 +0100 | [diff] [blame] | 1389 | current_api: "sdk_library/public/myjavalib.txt", |
| 1390 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
| 1391 | sdk_version: "module_current", |
| 1392 | }, |
| 1393 | } |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1394 | `), |
| 1395 | checkVersionedAndroidBpContents(` |
| 1396 | // This is auto-generated. DO NOT EDIT. |
Paul Duffin | 87a05a3 | 2020-05-12 11:50:28 +0100 | [diff] [blame] | 1397 | |
| 1398 | java_sdk_library_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1399 | name: "mysdk_myjavalib@current", |
| 1400 | sdk_member_name: "myjavalib", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1401 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1402 | apex_available: ["//apex_available:platform"], |
Paul Duffin | d7eb1c2 | 2020-05-26 20:57:10 +0100 | [diff] [blame] | 1403 | shared_library: true, |
Paul Duffin | 87a05a3 | 2020-05-12 11:50:28 +0100 | [diff] [blame] | 1404 | public: { |
| 1405 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1406 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
Paul Duffin | 87a05a3 | 2020-05-12 11:50:28 +0100 | [diff] [blame] | 1407 | current_api: "sdk_library/public/myjavalib.txt", |
| 1408 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
| 1409 | sdk_version: "module_current", |
| 1410 | }, |
| 1411 | } |
| 1412 | |
| 1413 | sdk_snapshot { |
| 1414 | name: "mysdk@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1415 | visibility: ["//visibility:public"], |
Paul Duffin | 87a05a3 | 2020-05-12 11:50:28 +0100 | [diff] [blame] | 1416 | java_sdk_libs: ["mysdk_myjavalib@current"], |
| 1417 | } |
| 1418 | `), |
| 1419 | checkAllCopyRules(` |
| 1420 | .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] | 1421 | .intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt |
| 1422 | .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] | 1423 | `), |
| 1424 | checkMergeZips( |
| 1425 | ".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip", |
| 1426 | ), |
| 1427 | ) |
| 1428 | } |
| 1429 | |
| 1430 | func TestSnapshotWithJavaSdkLibrary_ApiScopes(t *testing.T) { |
Paul Duffin | 9ec86b1 | 2021-03-15 11:17:52 +0000 | [diff] [blame] | 1431 | result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, ` |
Paul Duffin | 3375e35 | 2020-04-28 10:44:03 +0100 | [diff] [blame] | 1432 | sdk { |
| 1433 | name: "mysdk", |
| 1434 | java_sdk_libs: ["myjavalib"], |
| 1435 | } |
| 1436 | |
| 1437 | java_sdk_library { |
| 1438 | name: "myjavalib", |
| 1439 | apex_available: ["//apex_available:anyapex"], |
| 1440 | srcs: ["Test.java"], |
| 1441 | sdk_version: "current", |
| 1442 | public: { |
| 1443 | enabled: true, |
| 1444 | }, |
| 1445 | system: { |
| 1446 | enabled: true, |
| 1447 | }, |
| 1448 | } |
| 1449 | `) |
| 1450 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 1451 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1452 | checkUnversionedAndroidBpContents(` |
Paul Duffin | 3375e35 | 2020-04-28 10:44:03 +0100 | [diff] [blame] | 1453 | // This is auto-generated. DO NOT EDIT. |
| 1454 | |
| 1455 | java_sdk_library_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1456 | name: "myjavalib", |
| 1457 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1458 | visibility: ["//visibility:public"], |
Paul Duffin | 3375e35 | 2020-04-28 10:44:03 +0100 | [diff] [blame] | 1459 | apex_available: ["//apex_available:anyapex"], |
Paul Duffin | d7eb1c2 | 2020-05-26 20:57:10 +0100 | [diff] [blame] | 1460 | shared_library: true, |
Paul Duffin | 3375e35 | 2020-04-28 10:44:03 +0100 | [diff] [blame] | 1461 | public: { |
| 1462 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1463 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
Paul Duffin | 3375e35 | 2020-04-28 10:44:03 +0100 | [diff] [blame] | 1464 | current_api: "sdk_library/public/myjavalib.txt", |
| 1465 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
| 1466 | sdk_version: "current", |
| 1467 | }, |
| 1468 | system: { |
| 1469 | jars: ["sdk_library/system/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1470 | stub_srcs: ["sdk_library/system/myjavalib_stub_sources"], |
Paul Duffin | 3375e35 | 2020-04-28 10:44:03 +0100 | [diff] [blame] | 1471 | current_api: "sdk_library/system/myjavalib.txt", |
| 1472 | removed_api: "sdk_library/system/myjavalib-removed.txt", |
| 1473 | sdk_version: "system_current", |
| 1474 | }, |
| 1475 | } |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1476 | `), |
| 1477 | checkVersionedAndroidBpContents(` |
| 1478 | // This is auto-generated. DO NOT EDIT. |
Paul Duffin | 3375e35 | 2020-04-28 10:44:03 +0100 | [diff] [blame] | 1479 | |
| 1480 | java_sdk_library_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1481 | name: "mysdk_myjavalib@current", |
| 1482 | sdk_member_name: "myjavalib", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1483 | visibility: ["//visibility:public"], |
Paul Duffin | 3375e35 | 2020-04-28 10:44:03 +0100 | [diff] [blame] | 1484 | apex_available: ["//apex_available:anyapex"], |
Paul Duffin | d7eb1c2 | 2020-05-26 20:57:10 +0100 | [diff] [blame] | 1485 | shared_library: true, |
Paul Duffin | 3375e35 | 2020-04-28 10:44:03 +0100 | [diff] [blame] | 1486 | public: { |
| 1487 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1488 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
Paul Duffin | 3375e35 | 2020-04-28 10:44:03 +0100 | [diff] [blame] | 1489 | current_api: "sdk_library/public/myjavalib.txt", |
| 1490 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
| 1491 | sdk_version: "current", |
| 1492 | }, |
| 1493 | system: { |
| 1494 | jars: ["sdk_library/system/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1495 | stub_srcs: ["sdk_library/system/myjavalib_stub_sources"], |
Paul Duffin | 3375e35 | 2020-04-28 10:44:03 +0100 | [diff] [blame] | 1496 | current_api: "sdk_library/system/myjavalib.txt", |
| 1497 | removed_api: "sdk_library/system/myjavalib-removed.txt", |
| 1498 | sdk_version: "system_current", |
| 1499 | }, |
| 1500 | } |
| 1501 | |
| 1502 | sdk_snapshot { |
| 1503 | name: "mysdk@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1504 | visibility: ["//visibility:public"], |
Paul Duffin | 3375e35 | 2020-04-28 10:44:03 +0100 | [diff] [blame] | 1505 | java_sdk_libs: ["mysdk_myjavalib@current"], |
| 1506 | } |
| 1507 | `), |
| 1508 | checkAllCopyRules(` |
| 1509 | .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] | 1510 | .intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt |
| 1511 | .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] | 1512 | .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] | 1513 | .intermediates/myjavalib.stubs.source.system/android_common/metalava/myjavalib.stubs.source.system_api.txt -> sdk_library/system/myjavalib.txt |
| 1514 | .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] | 1515 | `), |
| 1516 | checkMergeZips( |
| 1517 | ".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip", |
| 1518 | ".intermediates/mysdk/common_os/tmp/sdk_library/system/myjavalib_stub_sources.zip", |
| 1519 | ), |
| 1520 | ) |
| 1521 | } |
Paul Duffin | 8f265b9 | 2020-04-28 14:13:56 +0100 | [diff] [blame] | 1522 | |
| 1523 | func TestSnapshotWithJavaSdkLibrary_ModuleLib(t *testing.T) { |
Paul Duffin | 9ec86b1 | 2021-03-15 11:17:52 +0000 | [diff] [blame] | 1524 | result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, ` |
Paul Duffin | 8f265b9 | 2020-04-28 14:13:56 +0100 | [diff] [blame] | 1525 | sdk { |
| 1526 | name: "mysdk", |
| 1527 | java_sdk_libs: ["myjavalib"], |
| 1528 | } |
| 1529 | |
| 1530 | java_sdk_library { |
| 1531 | name: "myjavalib", |
| 1532 | apex_available: ["//apex_available:anyapex"], |
| 1533 | srcs: ["Test.java"], |
| 1534 | sdk_version: "current", |
| 1535 | public: { |
| 1536 | enabled: true, |
| 1537 | }, |
| 1538 | system: { |
| 1539 | enabled: true, |
| 1540 | }, |
| 1541 | module_lib: { |
| 1542 | enabled: true, |
| 1543 | }, |
| 1544 | } |
| 1545 | `) |
| 1546 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 1547 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1548 | checkUnversionedAndroidBpContents(` |
Paul Duffin | 8f265b9 | 2020-04-28 14:13:56 +0100 | [diff] [blame] | 1549 | // This is auto-generated. DO NOT EDIT. |
| 1550 | |
| 1551 | java_sdk_library_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1552 | name: "myjavalib", |
| 1553 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1554 | visibility: ["//visibility:public"], |
Paul Duffin | 8f265b9 | 2020-04-28 14:13:56 +0100 | [diff] [blame] | 1555 | apex_available: ["//apex_available:anyapex"], |
Paul Duffin | d7eb1c2 | 2020-05-26 20:57:10 +0100 | [diff] [blame] | 1556 | shared_library: true, |
Paul Duffin | 8f265b9 | 2020-04-28 14:13:56 +0100 | [diff] [blame] | 1557 | public: { |
| 1558 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1559 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
Paul Duffin | 8f265b9 | 2020-04-28 14:13:56 +0100 | [diff] [blame] | 1560 | current_api: "sdk_library/public/myjavalib.txt", |
| 1561 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
| 1562 | sdk_version: "current", |
| 1563 | }, |
| 1564 | system: { |
| 1565 | jars: ["sdk_library/system/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1566 | stub_srcs: ["sdk_library/system/myjavalib_stub_sources"], |
Paul Duffin | 8f265b9 | 2020-04-28 14:13:56 +0100 | [diff] [blame] | 1567 | current_api: "sdk_library/system/myjavalib.txt", |
| 1568 | removed_api: "sdk_library/system/myjavalib-removed.txt", |
| 1569 | sdk_version: "system_current", |
| 1570 | }, |
| 1571 | module_lib: { |
Paul Duffin | 6b836ba | 2020-05-13 19:19:49 +0100 | [diff] [blame] | 1572 | jars: ["sdk_library/module-lib/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1573 | stub_srcs: ["sdk_library/module-lib/myjavalib_stub_sources"], |
Paul Duffin | 6b836ba | 2020-05-13 19:19:49 +0100 | [diff] [blame] | 1574 | current_api: "sdk_library/module-lib/myjavalib.txt", |
| 1575 | removed_api: "sdk_library/module-lib/myjavalib-removed.txt", |
Paul Duffin | 8f265b9 | 2020-04-28 14:13:56 +0100 | [diff] [blame] | 1576 | sdk_version: "module_current", |
| 1577 | }, |
| 1578 | } |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1579 | `), |
| 1580 | checkVersionedAndroidBpContents(` |
| 1581 | // This is auto-generated. DO NOT EDIT. |
Paul Duffin | 8f265b9 | 2020-04-28 14:13:56 +0100 | [diff] [blame] | 1582 | |
| 1583 | java_sdk_library_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1584 | name: "mysdk_myjavalib@current", |
| 1585 | sdk_member_name: "myjavalib", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1586 | visibility: ["//visibility:public"], |
Paul Duffin | 8f265b9 | 2020-04-28 14:13:56 +0100 | [diff] [blame] | 1587 | apex_available: ["//apex_available:anyapex"], |
Paul Duffin | d7eb1c2 | 2020-05-26 20:57:10 +0100 | [diff] [blame] | 1588 | shared_library: true, |
Paul Duffin | 8f265b9 | 2020-04-28 14:13:56 +0100 | [diff] [blame] | 1589 | public: { |
| 1590 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1591 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
Paul Duffin | 8f265b9 | 2020-04-28 14:13:56 +0100 | [diff] [blame] | 1592 | current_api: "sdk_library/public/myjavalib.txt", |
| 1593 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
| 1594 | sdk_version: "current", |
| 1595 | }, |
| 1596 | system: { |
| 1597 | jars: ["sdk_library/system/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1598 | stub_srcs: ["sdk_library/system/myjavalib_stub_sources"], |
Paul Duffin | 8f265b9 | 2020-04-28 14:13:56 +0100 | [diff] [blame] | 1599 | current_api: "sdk_library/system/myjavalib.txt", |
| 1600 | removed_api: "sdk_library/system/myjavalib-removed.txt", |
| 1601 | sdk_version: "system_current", |
| 1602 | }, |
| 1603 | module_lib: { |
Paul Duffin | 6b836ba | 2020-05-13 19:19:49 +0100 | [diff] [blame] | 1604 | jars: ["sdk_library/module-lib/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1605 | stub_srcs: ["sdk_library/module-lib/myjavalib_stub_sources"], |
Paul Duffin | 6b836ba | 2020-05-13 19:19:49 +0100 | [diff] [blame] | 1606 | current_api: "sdk_library/module-lib/myjavalib.txt", |
| 1607 | removed_api: "sdk_library/module-lib/myjavalib-removed.txt", |
Paul Duffin | 8f265b9 | 2020-04-28 14:13:56 +0100 | [diff] [blame] | 1608 | sdk_version: "module_current", |
| 1609 | }, |
| 1610 | } |
| 1611 | |
| 1612 | sdk_snapshot { |
| 1613 | name: "mysdk@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1614 | visibility: ["//visibility:public"], |
Paul Duffin | 8f265b9 | 2020-04-28 14:13:56 +0100 | [diff] [blame] | 1615 | java_sdk_libs: ["mysdk_myjavalib@current"], |
| 1616 | } |
| 1617 | `), |
| 1618 | checkAllCopyRules(` |
| 1619 | .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] | 1620 | .intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt |
| 1621 | .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] | 1622 | .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] | 1623 | .intermediates/myjavalib.stubs.source.system/android_common/metalava/myjavalib.stubs.source.system_api.txt -> sdk_library/system/myjavalib.txt |
| 1624 | .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] | 1625 | .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] | 1626 | .intermediates/myjavalib.stubs.source.module_lib/android_common/metalava/myjavalib.stubs.source.module_lib_api.txt -> sdk_library/module-lib/myjavalib.txt |
| 1627 | .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] | 1628 | `), |
| 1629 | checkMergeZips( |
| 1630 | ".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip", |
| 1631 | ".intermediates/mysdk/common_os/tmp/sdk_library/system/myjavalib_stub_sources.zip", |
Paul Duffin | 6b836ba | 2020-05-13 19:19:49 +0100 | [diff] [blame] | 1632 | ".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] | 1633 | ), |
| 1634 | ) |
| 1635 | } |
Paul Duffin | f7a6433 | 2020-05-13 16:54:55 +0100 | [diff] [blame] | 1636 | |
Paul Duffin | 0c5bae5 | 2020-06-02 13:00:08 +0100 | [diff] [blame] | 1637 | func TestSnapshotWithJavaSdkLibrary_SystemServer(t *testing.T) { |
Paul Duffin | 9ec86b1 | 2021-03-15 11:17:52 +0000 | [diff] [blame] | 1638 | result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, ` |
Paul Duffin | 0c5bae5 | 2020-06-02 13:00:08 +0100 | [diff] [blame] | 1639 | sdk { |
| 1640 | name: "mysdk", |
| 1641 | java_sdk_libs: ["myjavalib"], |
| 1642 | } |
| 1643 | |
| 1644 | java_sdk_library { |
| 1645 | name: "myjavalib", |
| 1646 | apex_available: ["//apex_available:anyapex"], |
| 1647 | srcs: ["Test.java"], |
| 1648 | sdk_version: "current", |
| 1649 | public: { |
| 1650 | enabled: true, |
| 1651 | }, |
| 1652 | system_server: { |
| 1653 | enabled: true, |
| 1654 | }, |
| 1655 | } |
| 1656 | `) |
| 1657 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 1658 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1659 | checkUnversionedAndroidBpContents(` |
Paul Duffin | 0c5bae5 | 2020-06-02 13:00:08 +0100 | [diff] [blame] | 1660 | // This is auto-generated. DO NOT EDIT. |
| 1661 | |
| 1662 | java_sdk_library_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1663 | name: "myjavalib", |
| 1664 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1665 | visibility: ["//visibility:public"], |
Paul Duffin | 0c5bae5 | 2020-06-02 13:00:08 +0100 | [diff] [blame] | 1666 | apex_available: ["//apex_available:anyapex"], |
| 1667 | shared_library: true, |
| 1668 | public: { |
| 1669 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1670 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
Paul Duffin | 0c5bae5 | 2020-06-02 13:00:08 +0100 | [diff] [blame] | 1671 | current_api: "sdk_library/public/myjavalib.txt", |
| 1672 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
| 1673 | sdk_version: "current", |
| 1674 | }, |
| 1675 | system_server: { |
| 1676 | jars: ["sdk_library/system-server/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1677 | stub_srcs: ["sdk_library/system-server/myjavalib_stub_sources"], |
Paul Duffin | 0c5bae5 | 2020-06-02 13:00:08 +0100 | [diff] [blame] | 1678 | current_api: "sdk_library/system-server/myjavalib.txt", |
| 1679 | removed_api: "sdk_library/system-server/myjavalib-removed.txt", |
| 1680 | sdk_version: "system_server_current", |
| 1681 | }, |
| 1682 | } |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1683 | `), |
| 1684 | checkVersionedAndroidBpContents(` |
| 1685 | // This is auto-generated. DO NOT EDIT. |
Paul Duffin | 0c5bae5 | 2020-06-02 13:00:08 +0100 | [diff] [blame] | 1686 | |
| 1687 | java_sdk_library_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1688 | name: "mysdk_myjavalib@current", |
| 1689 | sdk_member_name: "myjavalib", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1690 | visibility: ["//visibility:public"], |
Paul Duffin | 0c5bae5 | 2020-06-02 13:00:08 +0100 | [diff] [blame] | 1691 | apex_available: ["//apex_available:anyapex"], |
| 1692 | shared_library: true, |
| 1693 | public: { |
| 1694 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1695 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
Paul Duffin | 0c5bae5 | 2020-06-02 13:00:08 +0100 | [diff] [blame] | 1696 | current_api: "sdk_library/public/myjavalib.txt", |
| 1697 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
| 1698 | sdk_version: "current", |
| 1699 | }, |
| 1700 | system_server: { |
| 1701 | jars: ["sdk_library/system-server/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1702 | stub_srcs: ["sdk_library/system-server/myjavalib_stub_sources"], |
Paul Duffin | 0c5bae5 | 2020-06-02 13:00:08 +0100 | [diff] [blame] | 1703 | current_api: "sdk_library/system-server/myjavalib.txt", |
| 1704 | removed_api: "sdk_library/system-server/myjavalib-removed.txt", |
| 1705 | sdk_version: "system_server_current", |
| 1706 | }, |
| 1707 | } |
| 1708 | |
| 1709 | sdk_snapshot { |
| 1710 | name: "mysdk@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1711 | visibility: ["//visibility:public"], |
Paul Duffin | 0c5bae5 | 2020-06-02 13:00:08 +0100 | [diff] [blame] | 1712 | java_sdk_libs: ["mysdk_myjavalib@current"], |
| 1713 | } |
| 1714 | `), |
| 1715 | checkAllCopyRules(` |
| 1716 | .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] | 1717 | .intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt |
| 1718 | .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] | 1719 | .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] | 1720 | .intermediates/myjavalib.stubs.source.system_server/android_common/metalava/myjavalib.stubs.source.system_server_api.txt -> sdk_library/system-server/myjavalib.txt |
| 1721 | .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] | 1722 | `), |
| 1723 | checkMergeZips( |
| 1724 | ".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip", |
| 1725 | ".intermediates/mysdk/common_os/tmp/sdk_library/system-server/myjavalib_stub_sources.zip", |
| 1726 | ), |
| 1727 | ) |
| 1728 | } |
| 1729 | |
Paul Duffin | f7a6433 | 2020-05-13 16:54:55 +0100 | [diff] [blame] | 1730 | func TestSnapshotWithJavaSdkLibrary_NamingScheme(t *testing.T) { |
Paul Duffin | 9ec86b1 | 2021-03-15 11:17:52 +0000 | [diff] [blame] | 1731 | result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, ` |
Paul Duffin | f7a6433 | 2020-05-13 16:54:55 +0100 | [diff] [blame] | 1732 | sdk { |
| 1733 | name: "mysdk", |
| 1734 | java_sdk_libs: ["myjavalib"], |
| 1735 | } |
| 1736 | |
| 1737 | java_sdk_library { |
| 1738 | name: "myjavalib", |
| 1739 | apex_available: ["//apex_available:anyapex"], |
| 1740 | srcs: ["Test.java"], |
| 1741 | sdk_version: "current", |
Paul Duffin | ee9ad5d | 2020-09-11 13:04:05 +0100 | [diff] [blame] | 1742 | naming_scheme: "default", |
Paul Duffin | f7a6433 | 2020-05-13 16:54:55 +0100 | [diff] [blame] | 1743 | public: { |
| 1744 | enabled: true, |
| 1745 | }, |
| 1746 | } |
| 1747 | `) |
| 1748 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 1749 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1750 | checkUnversionedAndroidBpContents(` |
Paul Duffin | f7a6433 | 2020-05-13 16:54:55 +0100 | [diff] [blame] | 1751 | // This is auto-generated. DO NOT EDIT. |
| 1752 | |
| 1753 | java_sdk_library_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1754 | name: "myjavalib", |
| 1755 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1756 | visibility: ["//visibility:public"], |
Paul Duffin | f7a6433 | 2020-05-13 16:54:55 +0100 | [diff] [blame] | 1757 | apex_available: ["//apex_available:anyapex"], |
Paul Duffin | ee9ad5d | 2020-09-11 13:04:05 +0100 | [diff] [blame] | 1758 | naming_scheme: "default", |
Paul Duffin | d7eb1c2 | 2020-05-26 20:57:10 +0100 | [diff] [blame] | 1759 | shared_library: true, |
Paul Duffin | f7a6433 | 2020-05-13 16:54:55 +0100 | [diff] [blame] | 1760 | public: { |
| 1761 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1762 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
Paul Duffin | f7a6433 | 2020-05-13 16:54:55 +0100 | [diff] [blame] | 1763 | current_api: "sdk_library/public/myjavalib.txt", |
| 1764 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
| 1765 | sdk_version: "current", |
| 1766 | }, |
| 1767 | } |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1768 | `), |
| 1769 | checkVersionedAndroidBpContents(` |
| 1770 | // This is auto-generated. DO NOT EDIT. |
Paul Duffin | f7a6433 | 2020-05-13 16:54:55 +0100 | [diff] [blame] | 1771 | |
| 1772 | java_sdk_library_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1773 | name: "mysdk_myjavalib@current", |
| 1774 | sdk_member_name: "myjavalib", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1775 | visibility: ["//visibility:public"], |
Paul Duffin | f7a6433 | 2020-05-13 16:54:55 +0100 | [diff] [blame] | 1776 | apex_available: ["//apex_available:anyapex"], |
Paul Duffin | ee9ad5d | 2020-09-11 13:04:05 +0100 | [diff] [blame] | 1777 | naming_scheme: "default", |
Paul Duffin | d7eb1c2 | 2020-05-26 20:57:10 +0100 | [diff] [blame] | 1778 | shared_library: true, |
Paul Duffin | f7a6433 | 2020-05-13 16:54:55 +0100 | [diff] [blame] | 1779 | public: { |
| 1780 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1781 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
Paul Duffin | f7a6433 | 2020-05-13 16:54:55 +0100 | [diff] [blame] | 1782 | current_api: "sdk_library/public/myjavalib.txt", |
| 1783 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
| 1784 | sdk_version: "current", |
| 1785 | }, |
| 1786 | } |
| 1787 | |
| 1788 | sdk_snapshot { |
| 1789 | name: "mysdk@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1790 | visibility: ["//visibility:public"], |
Paul Duffin | f7a6433 | 2020-05-13 16:54:55 +0100 | [diff] [blame] | 1791 | java_sdk_libs: ["mysdk_myjavalib@current"], |
| 1792 | } |
| 1793 | `), |
| 1794 | checkAllCopyRules(` |
Paul Duffin | ee9ad5d | 2020-09-11 13:04:05 +0100 | [diff] [blame] | 1795 | .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] | 1796 | .intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt |
| 1797 | .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] | 1798 | `), |
| 1799 | checkMergeZips( |
| 1800 | ".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip", |
| 1801 | ), |
| 1802 | ) |
| 1803 | } |
Paul Duffin | a2ae7e0 | 2020-09-11 11:55:00 +0100 | [diff] [blame] | 1804 | |
| 1805 | func TestSnapshotWithJavaSdkLibrary_DoctagFiles(t *testing.T) { |
Paul Duffin | db462dd | 2021-03-21 22:01:55 +0000 | [diff] [blame] | 1806 | result := android.GroupFixturePreparers( |
| 1807 | prepareForSdkTestWithJavaSdkLibrary, |
| 1808 | android.FixtureAddFile("docs/known_doctags", nil), |
| 1809 | ).RunTestWithBp(t, ` |
Paul Duffin | a2ae7e0 | 2020-09-11 11:55:00 +0100 | [diff] [blame] | 1810 | sdk { |
| 1811 | name: "mysdk", |
| 1812 | java_sdk_libs: ["myjavalib"], |
| 1813 | } |
| 1814 | |
| 1815 | java_sdk_library { |
| 1816 | name: "myjavalib", |
| 1817 | srcs: ["Test.java"], |
| 1818 | sdk_version: "current", |
| 1819 | public: { |
| 1820 | enabled: true, |
| 1821 | }, |
| 1822 | doctag_files: ["docs/known_doctags"], |
| 1823 | } |
| 1824 | |
| 1825 | filegroup { |
| 1826 | name: "mygroup", |
| 1827 | srcs: [":myjavalib{.doctags}"], |
| 1828 | } |
| 1829 | `) |
| 1830 | |
Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 1831 | CheckSnapshot(t, result, "mysdk", "", |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1832 | checkUnversionedAndroidBpContents(` |
Paul Duffin | a2ae7e0 | 2020-09-11 11:55:00 +0100 | [diff] [blame] | 1833 | // This is auto-generated. DO NOT EDIT. |
| 1834 | |
| 1835 | java_sdk_library_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1836 | name: "myjavalib", |
| 1837 | prefer: false, |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1838 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1839 | apex_available: ["//apex_available:platform"], |
Paul Duffin | a2ae7e0 | 2020-09-11 11:55:00 +0100 | [diff] [blame] | 1840 | shared_library: true, |
| 1841 | doctag_files: ["doctags/docs/known_doctags"], |
| 1842 | public: { |
| 1843 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1844 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
Paul Duffin | a2ae7e0 | 2020-09-11 11:55:00 +0100 | [diff] [blame] | 1845 | current_api: "sdk_library/public/myjavalib.txt", |
| 1846 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
| 1847 | sdk_version: "current", |
| 1848 | }, |
| 1849 | } |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1850 | `), |
| 1851 | checkVersionedAndroidBpContents(` |
| 1852 | // This is auto-generated. DO NOT EDIT. |
Paul Duffin | a2ae7e0 | 2020-09-11 11:55:00 +0100 | [diff] [blame] | 1853 | |
| 1854 | java_sdk_library_import { |
Paul Duffin | e138188 | 2021-04-16 17:05:10 +0100 | [diff] [blame] | 1855 | name: "mysdk_myjavalib@current", |
| 1856 | sdk_member_name: "myjavalib", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1857 | visibility: ["//visibility:public"], |
Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1858 | apex_available: ["//apex_available:platform"], |
Paul Duffin | a2ae7e0 | 2020-09-11 11:55:00 +0100 | [diff] [blame] | 1859 | shared_library: true, |
| 1860 | doctag_files: ["doctags/docs/known_doctags"], |
| 1861 | public: { |
| 1862 | jars: ["sdk_library/public/myjavalib-stubs.jar"], |
Paul Duffin | ab5ac8f | 2020-11-18 16:37:35 +0000 | [diff] [blame] | 1863 | stub_srcs: ["sdk_library/public/myjavalib_stub_sources"], |
Paul Duffin | a2ae7e0 | 2020-09-11 11:55:00 +0100 | [diff] [blame] | 1864 | current_api: "sdk_library/public/myjavalib.txt", |
| 1865 | removed_api: "sdk_library/public/myjavalib-removed.txt", |
| 1866 | sdk_version: "current", |
| 1867 | }, |
| 1868 | } |
| 1869 | |
| 1870 | sdk_snapshot { |
| 1871 | name: "mysdk@current", |
Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1872 | visibility: ["//visibility:public"], |
Paul Duffin | a2ae7e0 | 2020-09-11 11:55:00 +0100 | [diff] [blame] | 1873 | java_sdk_libs: ["mysdk_myjavalib@current"], |
| 1874 | } |
| 1875 | `), |
| 1876 | checkAllCopyRules(` |
| 1877 | .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] | 1878 | .intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt |
| 1879 | .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] | 1880 | docs/known_doctags -> doctags/docs/known_doctags |
| 1881 | `), |
| 1882 | ) |
| 1883 | } |