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