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