blob: 736ec8a2dbafe03d0ae6be873ac85872a5cd7585 [file] [log] [blame]
Paul Duffinf7f65da2021-03-10 15:00:46 +00001// Copyright (C) 2021 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
15package sdk
16
Paul Duffin4a1d4512021-03-18 10:12:26 +000017import (
Paul Duffin7c475152021-06-09 16:17:58 +010018 "fmt"
19 "path/filepath"
Paul Duffin4a1d4512021-03-18 10:12:26 +000020 "testing"
21
22 "android/soong/android"
Paul Duffina57835e2021-04-19 13:23:06 +010023 "android/soong/java"
Paul Duffin4a1d4512021-03-18 10:12:26 +000024)
Paul Duffinf7f65da2021-03-10 15:00:46 +000025
Paul Duffin7c475152021-06-09 16:17:58 +010026// fixtureAddPlatformBootclasspathForBootclasspathFragment adds a platform_bootclasspath module that
27// references the bootclasspath fragment.
28func fixtureAddPlatformBootclasspathForBootclasspathFragment(apex, fragment string) android.FixturePreparer {
29 return android.GroupFixturePreparers(
30 // Add a platform_bootclasspath module.
31 android.FixtureAddTextFile("frameworks/base/boot/Android.bp", fmt.Sprintf(`
32 platform_bootclasspath {
33 name: "platform-bootclasspath",
34 fragments: [
35 {
36 apex: "%s",
37 module: "%s",
38 },
39 ],
40 }
41 `, apex, fragment)),
42 android.FixtureAddFile("frameworks/base/config/boot-profile.txt", nil),
Paul Duffinc8ead412021-06-07 19:28:15 +010043 android.FixtureAddFile("build/soong/scripts/check_boot_jars/package_allowed_list.txt", nil),
Paul Duffin7c475152021-06-09 16:17:58 +010044 )
45}
46
47// fixtureAddPrebuiltApexForBootclasspathFragment adds a prebuilt_apex that exports the fragment.
48func fixtureAddPrebuiltApexForBootclasspathFragment(apex, fragment string) android.FixturePreparer {
49 apexFile := fmt.Sprintf("%s.apex", apex)
50 dir := "prebuilts/apex"
51 return android.GroupFixturePreparers(
52 // A preparer to add a prebuilt apex to the test fixture.
53 android.FixtureAddTextFile(filepath.Join(dir, "Android.bp"), fmt.Sprintf(`
54 prebuilt_apex {
55 name: "%s",
56 src: "%s",
57 exported_bootclasspath_fragments: [
58 "%s",
59 ],
60 }
61 `, apex, apexFile, fragment)),
62 android.FixtureAddFile(filepath.Join(dir, apexFile), nil),
63 )
64}
65
Paul Duffina57835e2021-04-19 13:23:06 +010066func TestSnapshotWithBootclasspathFragment_ImageName(t *testing.T) {
67 result := android.GroupFixturePreparers(
68 prepareForSdkTestWithJava,
Paul Duffin023dba02021-04-22 01:45:29 +010069 java.PrepareForTestWithJavaDefaultModules,
Paul Duffina57835e2021-04-19 13:23:06 +010070 prepareForSdkTestWithApex,
71
72 // Some additional files needed for the art apex.
73 android.FixtureMergeMockFs(android.MockFS{
74 "com.android.art.avbpubkey": nil,
75 "com.android.art.pem": nil,
76 "system/sepolicy/apex/com.android.art-file_contexts": nil,
77 }),
Paul Duffin023dba02021-04-22 01:45:29 +010078
Paul Duffin7c475152021-06-09 16:17:58 +010079 // Add a platform_bootclasspath that depends on the fragment.
80 fixtureAddPlatformBootclasspathForBootclasspathFragment("com.android.art", "mybootclasspathfragment"),
Paul Duffin023dba02021-04-22 01:45:29 +010081
Paul Duffina57835e2021-04-19 13:23:06 +010082 java.FixtureConfigureBootJars("com.android.art:mybootlib"),
83 android.FixtureWithRootAndroidBp(`
84 sdk {
85 name: "mysdk",
86 bootclasspath_fragments: ["mybootclasspathfragment"],
Paul Duffina57835e2021-04-19 13:23:06 +010087 }
88
89 apex {
90 name: "com.android.art",
91 key: "com.android.art.key",
92 bootclasspath_fragments: [
93 "mybootclasspathfragment",
94 ],
95 updatable: false,
96 }
97
98 bootclasspath_fragment {
99 name: "mybootclasspathfragment",
100 image_name: "art",
Paul Duffinf23bc472021-04-27 12:42:20 +0100101 contents: ["mybootlib"],
Paul Duffina57835e2021-04-19 13:23:06 +0100102 apex_available: ["com.android.art"],
103 }
104
105 apex_key {
106 name: "com.android.art.key",
107 public_key: "com.android.art.avbpubkey",
108 private_key: "com.android.art.pem",
109 }
110
111 java_library {
112 name: "mybootlib",
113 srcs: ["Test.java"],
114 system_modules: "none",
115 sdk_version: "none",
116 compile_dex: true,
117 apex_available: ["com.android.art"],
118 }
119 `),
120 ).RunTest(t)
121
Paul Duffin7c475152021-06-09 16:17:58 +0100122 // A preparer to update the test fixture used when processing an unpackage snapshot.
123 preparerForSnapshot := fixtureAddPrebuiltApexForBootclasspathFragment("com.android.art", "mybootclasspathfragment")
Paul Duffin023dba02021-04-22 01:45:29 +0100124
Paul Duffina57835e2021-04-19 13:23:06 +0100125 CheckSnapshot(t, result, "mysdk", "",
126 checkUnversionedAndroidBpContents(`
127// This is auto-generated. DO NOT EDIT.
128
129prebuilt_bootclasspath_fragment {
130 name: "mybootclasspathfragment",
131 prefer: false,
132 visibility: ["//visibility:public"],
133 apex_available: ["com.android.art"],
134 image_name: "art",
Paul Duffin2dc665b2021-04-23 16:58:51 +0100135 contents: ["mybootlib"],
Paul Duffinda286f42021-06-29 11:59:23 +0100136 hidden_api: {
137 stub_flags: "hiddenapi/stub-flags.csv",
138 annotation_flags: "hiddenapi/annotation-flags.csv",
139 metadata: "hiddenapi/metadata.csv",
140 index: "hiddenapi/index.csv",
141 all_flags: "hiddenapi/all-flags.csv",
142 },
Paul Duffina57835e2021-04-19 13:23:06 +0100143}
144
145java_import {
146 name: "mybootlib",
147 prefer: false,
148 visibility: ["//visibility:public"],
149 apex_available: ["com.android.art"],
Paul Duffin5c211452021-07-15 12:42:44 +0100150 jars: ["java_boot_libs/snapshot/jars/are/invalid/mybootlib.jar"],
Paul Duffina57835e2021-04-19 13:23:06 +0100151}
152`),
153 checkVersionedAndroidBpContents(`
154// This is auto-generated. DO NOT EDIT.
155
156prebuilt_bootclasspath_fragment {
157 name: "mysdk_mybootclasspathfragment@current",
158 sdk_member_name: "mybootclasspathfragment",
159 visibility: ["//visibility:public"],
160 apex_available: ["com.android.art"],
161 image_name: "art",
Paul Duffin2dc665b2021-04-23 16:58:51 +0100162 contents: ["mysdk_mybootlib@current"],
Paul Duffinda286f42021-06-29 11:59:23 +0100163 hidden_api: {
164 stub_flags: "hiddenapi/stub-flags.csv",
165 annotation_flags: "hiddenapi/annotation-flags.csv",
166 metadata: "hiddenapi/metadata.csv",
167 index: "hiddenapi/index.csv",
168 all_flags: "hiddenapi/all-flags.csv",
169 },
Paul Duffina57835e2021-04-19 13:23:06 +0100170}
171
172java_import {
173 name: "mysdk_mybootlib@current",
174 sdk_member_name: "mybootlib",
175 visibility: ["//visibility:public"],
176 apex_available: ["com.android.art"],
Paul Duffin5c211452021-07-15 12:42:44 +0100177 jars: ["java_boot_libs/snapshot/jars/are/invalid/mybootlib.jar"],
Paul Duffina57835e2021-04-19 13:23:06 +0100178}
179
180sdk_snapshot {
181 name: "mysdk@current",
182 visibility: ["//visibility:public"],
183 bootclasspath_fragments: ["mysdk_mybootclasspathfragment@current"],
184 java_boot_libs: ["mysdk_mybootlib@current"],
185}
186`),
187 checkAllCopyRules(`
Paul Duffinda286f42021-06-29 11:59:23 +0100188.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/stub-flags.csv -> hiddenapi/stub-flags.csv
189.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/annotation-flags.csv -> hiddenapi/annotation-flags.csv
190.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/metadata.csv -> hiddenapi/metadata.csv
191.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/index.csv -> hiddenapi/index.csv
192.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/all-flags.csv -> hiddenapi/all-flags.csv
Paul Duffin5c211452021-07-15 12:42:44 +0100193.intermediates/mysdk/common_os/empty -> java_boot_libs/snapshot/jars/are/invalid/mybootlib.jar
Paul Duffinda286f42021-06-29 11:59:23 +0100194 `),
Paul Duffin7c475152021-06-09 16:17:58 +0100195 snapshotTestPreparer(checkSnapshotWithoutSource, preparerForSnapshot),
Paul Duffinc8ead412021-06-07 19:28:15 +0100196
197 // Check the behavior of the snapshot without the source.
198 snapshotTestChecker(checkSnapshotWithoutSource, func(t *testing.T, result *android.TestResult) {
199 // Make sure that the boot jars package check rule includes the dex jar retrieved from the prebuilt apex.
200 checkBootJarsPackageCheckRule(t, result, "out/soong/.intermediates/prebuilts/apex/com.android.art.deapexer/android_common/deapexer/javalib/mybootlib.jar")
201 }),
202
Paul Duffin7c475152021-06-09 16:17:58 +0100203 snapshotTestPreparer(checkSnapshotWithSourcePreferred, preparerForSnapshot),
204 snapshotTestPreparer(checkSnapshotPreferredWithSource, preparerForSnapshot),
Paul Duffina57835e2021-04-19 13:23:06 +0100205 )
Paul Duffinc8ead412021-06-07 19:28:15 +0100206
207 // Make sure that the boot jars package check rule includes the dex jar created from the source.
208 checkBootJarsPackageCheckRule(t, result, "out/soong/.intermediates/mybootlib/android_common_apex10000/aligned/mybootlib.jar")
209}
210
211// checkBootJarsPackageCheckRule checks that the supplied module is an input to the boot jars
212// package check rule.
213func checkBootJarsPackageCheckRule(t *testing.T, result *android.TestResult, expectedModule string) {
214 platformBcp := result.ModuleForTests("platform-bootclasspath", "android_common")
215 bootJarsCheckRule := platformBcp.Rule("boot_jars_package_check")
216 command := bootJarsCheckRule.RuleParams.Command
217 expectedCommandArgs := " out/soong/host/linux-x86/bin/dexdump build/soong/scripts/check_boot_jars/package_allowed_list.txt " + expectedModule + " &&"
218 android.AssertStringDoesContain(t, "boot jars package check", command, expectedCommandArgs)
Paul Duffina57835e2021-04-19 13:23:06 +0100219}
220
221func TestSnapshotWithBootClasspathFragment_Contents(t *testing.T) {
Paul Duffin4a1d4512021-03-18 10:12:26 +0000222 result := android.GroupFixturePreparers(
223 prepareForSdkTestWithJava,
Paul Duffin895c7142021-04-25 13:40:15 +0100224 java.PrepareForTestWithJavaDefaultModules,
225 java.PrepareForTestWithJavaSdkLibraryFiles,
Paul Duffina10bd3c2021-05-12 13:46:54 +0100226 java.FixtureWithLastReleaseApis("mysdklibrary", "myothersdklibrary", "mycoreplatform"),
satayevd604b212021-07-21 14:23:52 +0100227 java.FixtureConfigureApexBootJars("myapex:mybootlib", "myapex:myothersdklibrary"),
Paul Duffin7c475152021-06-09 16:17:58 +0100228 prepareForSdkTestWithApex,
229
230 // Add a platform_bootclasspath that depends on the fragment.
231 fixtureAddPlatformBootclasspathForBootclasspathFragment("myapex", "mybootclasspathfragment"),
232
Paul Duffin4a1d4512021-03-18 10:12:26 +0000233 android.FixtureWithRootAndroidBp(`
234 sdk {
235 name: "mysdk",
Paul Duffin0b28a8d2021-04-21 23:38:34 +0100236 bootclasspath_fragments: ["mybootclasspathfragment"],
Paul Duffina10bd3c2021-05-12 13:46:54 +0100237 java_sdk_libs: [
238 // This is not strictly needed as it should be automatically added to the sdk_snapshot as
239 // a java_sdk_libs module because it is used in the mybootclasspathfragment's
240 // api.stub_libs property. However, it is specified here to ensure that duplicates are
241 // correctly deduped.
242 "mysdklibrary",
243 ],
Paul Duffin4a1d4512021-03-18 10:12:26 +0000244 }
Paul Duffinf7f65da2021-03-10 15:00:46 +0000245
Paul Duffin7c475152021-06-09 16:17:58 +0100246 apex {
247 name: "myapex",
248 key: "myapex.key",
249 min_sdk_version: "2",
250 bootclasspath_fragments: ["mybootclasspathfragment"],
251 }
252
Paul Duffin0b28a8d2021-04-21 23:38:34 +0100253 bootclasspath_fragment {
254 name: "mybootclasspathfragment",
Paul Duffin7c475152021-06-09 16:17:58 +0100255 apex_available: ["myapex"],
Paul Duffina10bd3c2021-05-12 13:46:54 +0100256 contents: [
257 // This should be automatically added to the sdk_snapshot as a java_boot_libs module.
258 "mybootlib",
259 // This should be automatically added to the sdk_snapshot as a java_sdk_libs module.
260 "myothersdklibrary",
261 ],
Paul Duffin895c7142021-04-25 13:40:15 +0100262 api: {
263 stub_libs: ["mysdklibrary"],
264 },
265 core_platform_api: {
Paul Duffina10bd3c2021-05-12 13:46:54 +0100266 // This should be automatically added to the sdk_snapshot as a java_sdk_libs module.
Paul Duffin895c7142021-04-25 13:40:15 +0100267 stub_libs: ["mycoreplatform"],
268 },
Paul Duffina57835e2021-04-19 13:23:06 +0100269 }
270
271 java_library {
272 name: "mybootlib",
Paul Duffin7c475152021-06-09 16:17:58 +0100273 apex_available: ["myapex"],
Paul Duffina57835e2021-04-19 13:23:06 +0100274 srcs: ["Test.java"],
275 system_modules: "none",
276 sdk_version: "none",
Paul Duffin7c475152021-06-09 16:17:58 +0100277 min_sdk_version: "2",
Paul Duffina57835e2021-04-19 13:23:06 +0100278 compile_dex: true,
Paul Duffin7c475152021-06-09 16:17:58 +0100279 permitted_packages: ["mybootlib"],
Paul Duffin4a1d4512021-03-18 10:12:26 +0000280 }
Paul Duffin895c7142021-04-25 13:40:15 +0100281
282 java_sdk_library {
283 name: "mysdklibrary",
Paul Duffin7c475152021-06-09 16:17:58 +0100284 apex_available: ["myapex"],
Paul Duffin895c7142021-04-25 13:40:15 +0100285 srcs: ["Test.java"],
Paul Duffinf4600f62021-05-13 22:34:45 +0100286 shared_library: false,
Paul Duffin895c7142021-04-25 13:40:15 +0100287 public: {enabled: true},
Paul Duffin7c475152021-06-09 16:17:58 +0100288 min_sdk_version: "2",
Paul Duffin895c7142021-04-25 13:40:15 +0100289 }
290
291 java_sdk_library {
Paul Duffina10bd3c2021-05-12 13:46:54 +0100292 name: "myothersdklibrary",
Paul Duffin7c475152021-06-09 16:17:58 +0100293 apex_available: ["myapex"],
Paul Duffina10bd3c2021-05-12 13:46:54 +0100294 srcs: ["Test.java"],
Paul Duffinea8f8082021-06-24 13:25:57 +0100295 compile_dex: true,
Paul Duffina10bd3c2021-05-12 13:46:54 +0100296 public: {enabled: true},
Paul Duffin7c475152021-06-09 16:17:58 +0100297 min_sdk_version: "2",
298 permitted_packages: ["myothersdklibrary"],
Paul Duffina10bd3c2021-05-12 13:46:54 +0100299 }
300
301 java_sdk_library {
Paul Duffin895c7142021-04-25 13:40:15 +0100302 name: "mycoreplatform",
Paul Duffin7c475152021-06-09 16:17:58 +0100303 apex_available: ["myapex"],
Paul Duffin895c7142021-04-25 13:40:15 +0100304 srcs: ["Test.java"],
Paul Duffinea8f8082021-06-24 13:25:57 +0100305 compile_dex: true,
Paul Duffin895c7142021-04-25 13:40:15 +0100306 public: {enabled: true},
Paul Duffin7c475152021-06-09 16:17:58 +0100307 min_sdk_version: "2",
Paul Duffin895c7142021-04-25 13:40:15 +0100308 }
Paul Duffin4a1d4512021-03-18 10:12:26 +0000309 `),
310 ).RunTest(t)
Paul Duffinf7f65da2021-03-10 15:00:46 +0000311
Paul Duffin7c475152021-06-09 16:17:58 +0100312 // A preparer to update the test fixture used when processing an unpackage snapshot.
313 preparerForSnapshot := fixtureAddPrebuiltApexForBootclasspathFragment("myapex", "mybootclasspathfragment")
314
Paul Duffin36474d32021-03-12 12:19:43 +0000315 CheckSnapshot(t, result, "mysdk", "",
Paul Duffinf7f65da2021-03-10 15:00:46 +0000316 checkUnversionedAndroidBpContents(`
317// This is auto-generated. DO NOT EDIT.
318
Paul Duffin0b28a8d2021-04-21 23:38:34 +0100319prebuilt_bootclasspath_fragment {
320 name: "mybootclasspathfragment",
Paul Duffinf7f65da2021-03-10 15:00:46 +0000321 prefer: false,
322 visibility: ["//visibility:public"],
Paul Duffin7c475152021-06-09 16:17:58 +0100323 apex_available: ["myapex"],
Paul Duffina10bd3c2021-05-12 13:46:54 +0100324 contents: [
325 "mybootlib",
326 "myothersdklibrary",
327 ],
Paul Duffin895c7142021-04-25 13:40:15 +0100328 api: {
329 stub_libs: ["mysdklibrary"],
330 },
331 core_platform_api: {
332 stub_libs: ["mycoreplatform"],
333 },
Paul Duffin2fef1362021-04-15 13:32:00 +0100334 hidden_api: {
335 stub_flags: "hiddenapi/stub-flags.csv",
336 annotation_flags: "hiddenapi/annotation-flags.csv",
337 metadata: "hiddenapi/metadata.csv",
338 index: "hiddenapi/index.csv",
339 all_flags: "hiddenapi/all-flags.csv",
340 },
Paul Duffina57835e2021-04-19 13:23:06 +0100341}
342
343java_import {
344 name: "mybootlib",
345 prefer: false,
346 visibility: ["//visibility:public"],
Paul Duffin7c475152021-06-09 16:17:58 +0100347 apex_available: ["myapex"],
Paul Duffin5c211452021-07-15 12:42:44 +0100348 jars: ["java_boot_libs/snapshot/jars/are/invalid/mybootlib.jar"],
Paul Duffin869de142021-07-15 14:14:41 +0100349 permitted_packages: ["mybootlib"],
Paul Duffinf7f65da2021-03-10 15:00:46 +0000350}
Paul Duffin895c7142021-04-25 13:40:15 +0100351
352java_sdk_library_import {
Paul Duffina10bd3c2021-05-12 13:46:54 +0100353 name: "myothersdklibrary",
354 prefer: false,
355 visibility: ["//visibility:public"],
Paul Duffin7c475152021-06-09 16:17:58 +0100356 apex_available: ["myapex"],
Paul Duffinea8f8082021-06-24 13:25:57 +0100357 shared_library: true,
358 compile_dex: true,
Paul Duffin869de142021-07-15 14:14:41 +0100359 permitted_packages: ["myothersdklibrary"],
Paul Duffina10bd3c2021-05-12 13:46:54 +0100360 public: {
361 jars: ["sdk_library/public/myothersdklibrary-stubs.jar"],
362 stub_srcs: ["sdk_library/public/myothersdklibrary_stub_sources"],
363 current_api: "sdk_library/public/myothersdklibrary.txt",
364 removed_api: "sdk_library/public/myothersdklibrary-removed.txt",
365 sdk_version: "current",
366 },
367}
368
369java_sdk_library_import {
Paul Duffin895c7142021-04-25 13:40:15 +0100370 name: "mysdklibrary",
371 prefer: false,
372 visibility: ["//visibility:public"],
Paul Duffin7c475152021-06-09 16:17:58 +0100373 apex_available: ["myapex"],
Paul Duffinf4600f62021-05-13 22:34:45 +0100374 shared_library: false,
Paul Duffin895c7142021-04-25 13:40:15 +0100375 public: {
376 jars: ["sdk_library/public/mysdklibrary-stubs.jar"],
377 stub_srcs: ["sdk_library/public/mysdklibrary_stub_sources"],
378 current_api: "sdk_library/public/mysdklibrary.txt",
379 removed_api: "sdk_library/public/mysdklibrary-removed.txt",
380 sdk_version: "current",
381 },
382}
383
384java_sdk_library_import {
385 name: "mycoreplatform",
386 prefer: false,
387 visibility: ["//visibility:public"],
Paul Duffin7c475152021-06-09 16:17:58 +0100388 apex_available: ["myapex"],
Paul Duffinea8f8082021-06-24 13:25:57 +0100389 shared_library: true,
390 compile_dex: true,
Paul Duffin895c7142021-04-25 13:40:15 +0100391 public: {
392 jars: ["sdk_library/public/mycoreplatform-stubs.jar"],
393 stub_srcs: ["sdk_library/public/mycoreplatform_stub_sources"],
394 current_api: "sdk_library/public/mycoreplatform.txt",
395 removed_api: "sdk_library/public/mycoreplatform-removed.txt",
396 sdk_version: "current",
397 },
398}
Paul Duffina10bd3c2021-05-12 13:46:54 +0100399 `),
Paul Duffinf7f65da2021-03-10 15:00:46 +0000400 checkVersionedAndroidBpContents(`
401// This is auto-generated. DO NOT EDIT.
402
Paul Duffin0b28a8d2021-04-21 23:38:34 +0100403prebuilt_bootclasspath_fragment {
404 name: "mysdk_mybootclasspathfragment@current",
405 sdk_member_name: "mybootclasspathfragment",
Paul Duffinf7f65da2021-03-10 15:00:46 +0000406 visibility: ["//visibility:public"],
Paul Duffin7c475152021-06-09 16:17:58 +0100407 apex_available: ["myapex"],
Paul Duffina10bd3c2021-05-12 13:46:54 +0100408 contents: [
409 "mysdk_mybootlib@current",
410 "mysdk_myothersdklibrary@current",
411 ],
Paul Duffin895c7142021-04-25 13:40:15 +0100412 api: {
413 stub_libs: ["mysdk_mysdklibrary@current"],
414 },
415 core_platform_api: {
416 stub_libs: ["mysdk_mycoreplatform@current"],
417 },
Paul Duffin2fef1362021-04-15 13:32:00 +0100418 hidden_api: {
419 stub_flags: "hiddenapi/stub-flags.csv",
420 annotation_flags: "hiddenapi/annotation-flags.csv",
421 metadata: "hiddenapi/metadata.csv",
422 index: "hiddenapi/index.csv",
423 all_flags: "hiddenapi/all-flags.csv",
424 },
Paul Duffina57835e2021-04-19 13:23:06 +0100425}
426
427java_import {
428 name: "mysdk_mybootlib@current",
429 sdk_member_name: "mybootlib",
430 visibility: ["//visibility:public"],
Paul Duffin7c475152021-06-09 16:17:58 +0100431 apex_available: ["myapex"],
Paul Duffin5c211452021-07-15 12:42:44 +0100432 jars: ["java_boot_libs/snapshot/jars/are/invalid/mybootlib.jar"],
Paul Duffin869de142021-07-15 14:14:41 +0100433 permitted_packages: ["mybootlib"],
Paul Duffinf7f65da2021-03-10 15:00:46 +0000434}
435
Paul Duffin895c7142021-04-25 13:40:15 +0100436java_sdk_library_import {
Paul Duffina10bd3c2021-05-12 13:46:54 +0100437 name: "mysdk_myothersdklibrary@current",
438 sdk_member_name: "myothersdklibrary",
439 visibility: ["//visibility:public"],
Paul Duffin7c475152021-06-09 16:17:58 +0100440 apex_available: ["myapex"],
Paul Duffinea8f8082021-06-24 13:25:57 +0100441 shared_library: true,
442 compile_dex: true,
Paul Duffin869de142021-07-15 14:14:41 +0100443 permitted_packages: ["myothersdklibrary"],
Paul Duffina10bd3c2021-05-12 13:46:54 +0100444 public: {
445 jars: ["sdk_library/public/myothersdklibrary-stubs.jar"],
446 stub_srcs: ["sdk_library/public/myothersdklibrary_stub_sources"],
447 current_api: "sdk_library/public/myothersdklibrary.txt",
448 removed_api: "sdk_library/public/myothersdklibrary-removed.txt",
449 sdk_version: "current",
450 },
451}
452
453java_sdk_library_import {
Paul Duffin895c7142021-04-25 13:40:15 +0100454 name: "mysdk_mysdklibrary@current",
455 sdk_member_name: "mysdklibrary",
456 visibility: ["//visibility:public"],
Paul Duffin7c475152021-06-09 16:17:58 +0100457 apex_available: ["myapex"],
Paul Duffinf4600f62021-05-13 22:34:45 +0100458 shared_library: false,
Paul Duffin895c7142021-04-25 13:40:15 +0100459 public: {
460 jars: ["sdk_library/public/mysdklibrary-stubs.jar"],
461 stub_srcs: ["sdk_library/public/mysdklibrary_stub_sources"],
462 current_api: "sdk_library/public/mysdklibrary.txt",
463 removed_api: "sdk_library/public/mysdklibrary-removed.txt",
464 sdk_version: "current",
465 },
466}
467
468java_sdk_library_import {
469 name: "mysdk_mycoreplatform@current",
470 sdk_member_name: "mycoreplatform",
471 visibility: ["//visibility:public"],
Paul Duffin7c475152021-06-09 16:17:58 +0100472 apex_available: ["myapex"],
Paul Duffinea8f8082021-06-24 13:25:57 +0100473 shared_library: true,
474 compile_dex: true,
Paul Duffin895c7142021-04-25 13:40:15 +0100475 public: {
476 jars: ["sdk_library/public/mycoreplatform-stubs.jar"],
477 stub_srcs: ["sdk_library/public/mycoreplatform_stub_sources"],
478 current_api: "sdk_library/public/mycoreplatform.txt",
479 removed_api: "sdk_library/public/mycoreplatform-removed.txt",
480 sdk_version: "current",
481 },
482}
483
Paul Duffinf7f65da2021-03-10 15:00:46 +0000484sdk_snapshot {
485 name: "mysdk@current",
486 visibility: ["//visibility:public"],
Paul Duffin0b28a8d2021-04-21 23:38:34 +0100487 bootclasspath_fragments: ["mysdk_mybootclasspathfragment@current"],
Paul Duffina57835e2021-04-19 13:23:06 +0100488 java_boot_libs: ["mysdk_mybootlib@current"],
Paul Duffin895c7142021-04-25 13:40:15 +0100489 java_sdk_libs: [
Paul Duffina10bd3c2021-05-12 13:46:54 +0100490 "mysdk_myothersdklibrary@current",
Paul Duffin895c7142021-04-25 13:40:15 +0100491 "mysdk_mysdklibrary@current",
492 "mysdk_mycoreplatform@current",
493 ],
Paul Duffinf7f65da2021-03-10 15:00:46 +0000494}
Paul Duffina10bd3c2021-05-12 13:46:54 +0100495 `),
Paul Duffina57835e2021-04-19 13:23:06 +0100496 checkAllCopyRules(`
Paul Duffin2fef1362021-04-15 13:32:00 +0100497.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/stub-flags.csv -> hiddenapi/stub-flags.csv
498.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/annotation-flags.csv -> hiddenapi/annotation-flags.csv
499.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/metadata.csv -> hiddenapi/metadata.csv
500.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/index.csv -> hiddenapi/index.csv
501.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/all-flags.csv -> hiddenapi/all-flags.csv
Paul Duffin5c211452021-07-15 12:42:44 +0100502.intermediates/mysdk/common_os/empty -> java_boot_libs/snapshot/jars/are/invalid/mybootlib.jar
Paul Duffina10bd3c2021-05-12 13:46:54 +0100503.intermediates/myothersdklibrary.stubs/android_common/javac/myothersdklibrary.stubs.jar -> sdk_library/public/myothersdklibrary-stubs.jar
504.intermediates/myothersdklibrary.stubs.source/android_common/metalava/myothersdklibrary.stubs.source_api.txt -> sdk_library/public/myothersdklibrary.txt
505.intermediates/myothersdklibrary.stubs.source/android_common/metalava/myothersdklibrary.stubs.source_removed.txt -> sdk_library/public/myothersdklibrary-removed.txt
Paul Duffin895c7142021-04-25 13:40:15 +0100506.intermediates/mysdklibrary.stubs/android_common/javac/mysdklibrary.stubs.jar -> sdk_library/public/mysdklibrary-stubs.jar
507.intermediates/mysdklibrary.stubs.source/android_common/metalava/mysdklibrary.stubs.source_api.txt -> sdk_library/public/mysdklibrary.txt
508.intermediates/mysdklibrary.stubs.source/android_common/metalava/mysdklibrary.stubs.source_removed.txt -> sdk_library/public/mysdklibrary-removed.txt
509.intermediates/mycoreplatform.stubs/android_common/javac/mycoreplatform.stubs.jar -> sdk_library/public/mycoreplatform-stubs.jar
510.intermediates/mycoreplatform.stubs.source/android_common/metalava/mycoreplatform.stubs.source_api.txt -> sdk_library/public/mycoreplatform.txt
511.intermediates/mycoreplatform.stubs.source/android_common/metalava/mycoreplatform.stubs.source_removed.txt -> sdk_library/public/mycoreplatform-removed.txt
Paul Duffin7c475152021-06-09 16:17:58 +0100512`),
513 snapshotTestPreparer(checkSnapshotWithoutSource, preparerForSnapshot),
Paul Duffind061d402021-06-07 21:36:01 +0100514 snapshotTestChecker(checkSnapshotWithoutSource, func(t *testing.T, result *android.TestResult) {
515 module := result.ModuleForTests("platform-bootclasspath", "android_common")
516 var rule android.TestingBuildParams
517 rule = module.Output("out/soong/hiddenapi/hiddenapi-flags.csv")
518 java.CheckHiddenAPIRuleInputs(t, "monolithic flags", `
519 out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/hiddenapi-monolithic/annotation-flags-from-classes.csv
520 out/soong/hiddenapi/hiddenapi-stub-flags.txt
521 snapshot/hiddenapi/annotation-flags.csv
522 `, rule)
523
524 rule = module.Output("out/soong/hiddenapi/hiddenapi-unsupported.csv")
525 java.CheckHiddenAPIRuleInputs(t, "monolithic metadata", `
526 out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/hiddenapi-monolithic/metadata-from-classes.csv
527 snapshot/hiddenapi/metadata.csv
528 `, rule)
529
530 rule = module.Output("out/soong/hiddenapi/hiddenapi-index.csv")
531 java.CheckHiddenAPIRuleInputs(t, "monolithic index", `
532 out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/hiddenapi-monolithic/index-from-classes.csv
533 snapshot/hiddenapi/index.csv
534 `, rule)
Paul Duffin630b11e2021-07-15 13:35:26 +0100535
536 // Make sure that the permitted packages from the prebuilts end up in the
537 // updatable-bcp-packages.txt file.
538 rule = module.Output("updatable-bcp-packages.txt")
539 expectedContents := `'mybootlib\nmyothersdklibrary\n'`
540 android.AssertStringEquals(t, "updatable-bcp-packages.txt", expectedContents, rule.Args["content"])
Paul Duffind061d402021-06-07 21:36:01 +0100541 }),
Paul Duffin7c475152021-06-09 16:17:58 +0100542 snapshotTestPreparer(checkSnapshotWithSourcePreferred, preparerForSnapshot),
543 snapshotTestPreparer(checkSnapshotPreferredWithSource, preparerForSnapshot),
544 )
Paul Duffinf7f65da2021-03-10 15:00:46 +0000545}
Paul Duffin04b4a192021-03-18 11:05:31 +0000546
Paul Duffin51227d82021-05-18 12:54:27 +0100547// TestSnapshotWithBootClasspathFragment_Fragments makes sure that the fragments property of a
548// bootclasspath_fragment is correctly output to the sdk snapshot.
549func TestSnapshotWithBootClasspathFragment_Fragments(t *testing.T) {
550 result := android.GroupFixturePreparers(
551 prepareForSdkTestWithJava,
552 java.PrepareForTestWithJavaDefaultModules,
553 java.PrepareForTestWithJavaSdkLibraryFiles,
554 java.FixtureWithLastReleaseApis("mysdklibrary", "myothersdklibrary"),
satayevabcd5972021-08-06 17:49:46 +0100555 java.FixtureConfigureApexBootJars("someapex:mysdklibrary", "myotherapex:myotherlib"),
Paul Duffin51227d82021-05-18 12:54:27 +0100556 prepareForSdkTestWithApex,
557
558 // Some additional files needed for the myotherapex.
559 android.FixtureMergeMockFs(android.MockFS{
560 "system/sepolicy/apex/myotherapex-file_contexts": nil,
561 "myotherapex/apex_manifest.json": nil,
562 "myotherapex/Test.java": nil,
563 }),
564
565 android.FixtureAddTextFile("myotherapex/Android.bp", `
566 apex {
567 name: "myotherapex",
568 key: "myapex.key",
569 min_sdk_version: "2",
570 bootclasspath_fragments: ["myotherbootclasspathfragment"],
571 }
572
573 bootclasspath_fragment {
574 name: "myotherbootclasspathfragment",
575 apex_available: ["myotherapex"],
576 contents: [
577 "myotherlib",
578 ],
579 }
580
581 java_library {
582 name: "myotherlib",
583 apex_available: ["myotherapex"],
584 srcs: ["Test.java"],
585 min_sdk_version: "2",
586 permitted_packages: ["myothersdklibrary"],
587 compile_dex: true,
588 }
589 `),
590
591 android.FixtureWithRootAndroidBp(`
592 sdk {
593 name: "mysdk",
594 bootclasspath_fragments: ["mybootclasspathfragment"],
595 }
596
597 bootclasspath_fragment {
598 name: "mybootclasspathfragment",
599 contents: [
600 "mysdklibrary",
601 ],
602 fragments: [
603 {
604 apex: "myotherapex",
605 module: "myotherbootclasspathfragment"
606 },
607 ],
608 }
609
610 java_sdk_library {
611 name: "mysdklibrary",
612 srcs: ["Test.java"],
613 shared_library: false,
614 public: {enabled: true},
615 min_sdk_version: "2",
616 }
617 `),
618 ).RunTest(t)
619
620 // A preparer to update the test fixture used when processing an unpackage snapshot.
621 preparerForSnapshot := fixtureAddPrebuiltApexForBootclasspathFragment("myapex", "mybootclasspathfragment")
622
623 CheckSnapshot(t, result, "mysdk", "",
624 checkUnversionedAndroidBpContents(`
625// This is auto-generated. DO NOT EDIT.
626
627prebuilt_bootclasspath_fragment {
628 name: "mybootclasspathfragment",
629 prefer: false,
630 visibility: ["//visibility:public"],
631 apex_available: ["//apex_available:platform"],
632 contents: ["mysdklibrary"],
633 fragments: [
634 {
635 apex: "myotherapex",
636 module: "myotherbootclasspathfragment",
637 },
638 ],
639 hidden_api: {
640 stub_flags: "hiddenapi/stub-flags.csv",
641 annotation_flags: "hiddenapi/annotation-flags.csv",
642 metadata: "hiddenapi/metadata.csv",
643 index: "hiddenapi/index.csv",
644 all_flags: "hiddenapi/all-flags.csv",
645 },
646}
647
648java_sdk_library_import {
649 name: "mysdklibrary",
650 prefer: false,
651 visibility: ["//visibility:public"],
652 apex_available: ["//apex_available:platform"],
653 shared_library: false,
654 public: {
655 jars: ["sdk_library/public/mysdklibrary-stubs.jar"],
656 stub_srcs: ["sdk_library/public/mysdklibrary_stub_sources"],
657 current_api: "sdk_library/public/mysdklibrary.txt",
658 removed_api: "sdk_library/public/mysdklibrary-removed.txt",
659 sdk_version: "current",
660 },
661}
662 `),
663 snapshotTestPreparer(checkSnapshotWithoutSource, preparerForSnapshot),
664 snapshotTestPreparer(checkSnapshotWithSourcePreferred, preparerForSnapshot),
665 snapshotTestPreparer(checkSnapshotPreferredWithSource, preparerForSnapshot),
666 )
667}
668
Paul Duffin0b28a8d2021-04-21 23:38:34 +0100669// Test that bootclasspath_fragment works with sdk.
670func TestBasicSdkWithBootclasspathFragment(t *testing.T) {
Paul Duffin04b4a192021-03-18 11:05:31 +0000671 android.GroupFixturePreparers(
672 prepareForSdkTestWithApex,
673 prepareForSdkTestWithJava,
Paul Duffin8018e502021-05-21 19:28:09 +0100674 android.FixtureAddFile("java/mybootlib.jar", nil),
Paul Duffin04b4a192021-03-18 11:05:31 +0000675 android.FixtureWithRootAndroidBp(`
676 sdk {
677 name: "mysdk",
Paul Duffin0b28a8d2021-04-21 23:38:34 +0100678 bootclasspath_fragments: ["mybootclasspathfragment"],
Paul Duffin04b4a192021-03-18 11:05:31 +0000679 }
680
Paul Duffin0b28a8d2021-04-21 23:38:34 +0100681 bootclasspath_fragment {
682 name: "mybootclasspathfragment",
Paul Duffin04b4a192021-03-18 11:05:31 +0000683 image_name: "art",
Paul Duffin8018e502021-05-21 19:28:09 +0100684 contents: ["mybootlib"],
Paul Duffin04b4a192021-03-18 11:05:31 +0000685 apex_available: ["myapex"],
686 }
687
Paul Duffin8018e502021-05-21 19:28:09 +0100688 java_library {
689 name: "mybootlib",
690 apex_available: ["myapex"],
691 srcs: ["Test.java"],
692 system_modules: "none",
693 sdk_version: "none",
694 min_sdk_version: "1",
695 compile_dex: true,
696 }
697
Paul Duffin04b4a192021-03-18 11:05:31 +0000698 sdk_snapshot {
699 name: "mysdk@1",
Paul Duffin8018e502021-05-21 19:28:09 +0100700 bootclasspath_fragments: ["mysdk_mybootclasspathfragment@1"],
Paul Duffin04b4a192021-03-18 11:05:31 +0000701 }
702
Paul Duffin0b28a8d2021-04-21 23:38:34 +0100703 prebuilt_bootclasspath_fragment {
Paul Duffin8018e502021-05-21 19:28:09 +0100704 name: "mysdk_mybootclasspathfragment@1",
Paul Duffin0b28a8d2021-04-21 23:38:34 +0100705 sdk_member_name: "mybootclasspathfragment",
Paul Duffin04b4a192021-03-18 11:05:31 +0000706 prefer: false,
707 visibility: ["//visibility:public"],
708 apex_available: [
709 "myapex",
710 ],
711 image_name: "art",
Paul Duffin8018e502021-05-21 19:28:09 +0100712 contents: ["mysdk_mybootlib@1"],
713 }
714
715 java_import {
716 name: "mysdk_mybootlib@1",
717 sdk_member_name: "mybootlib",
718 visibility: ["//visibility:public"],
719 apex_available: ["com.android.art"],
720 jars: ["java/mybootlib.jar"],
Paul Duffin04b4a192021-03-18 11:05:31 +0000721 }
722 `),
723 ).RunTest(t)
724}
Paul Duffin7c955552021-04-19 13:23:53 +0100725
726func TestSnapshotWithBootclasspathFragment_HiddenAPI(t *testing.T) {
727 result := android.GroupFixturePreparers(
728 prepareForSdkTestWithJava,
Paul Duffin475daaf2021-05-13 00:57:55 +0100729 java.PrepareForTestWithJavaDefaultModules,
730 java.PrepareForTestWithJavaSdkLibraryFiles,
731 java.FixtureWithLastReleaseApis("mysdklibrary"),
satayevd604b212021-07-21 14:23:52 +0100732 java.FixtureConfigureApexBootJars("myapex:mybootlib"),
Paul Duffin475daaf2021-05-13 00:57:55 +0100733 prepareForSdkTestWithApex,
Paul Duffin7c475152021-06-09 16:17:58 +0100734
735 // Add a platform_bootclasspath that depends on the fragment.
736 fixtureAddPlatformBootclasspathForBootclasspathFragment("myapex", "mybootclasspathfragment"),
737
Paul Duffin7c955552021-04-19 13:23:53 +0100738 android.MockFS{
739 "my-blocked.txt": nil,
740 "my-max-target-o-low-priority.txt": nil,
741 "my-max-target-p.txt": nil,
742 "my-max-target-q.txt": nil,
743 "my-max-target-r-low-priority.txt": nil,
744 "my-removed.txt": nil,
745 "my-unsupported-packages.txt": nil,
746 "my-unsupported.txt": nil,
747 }.AddToFixture(),
748 android.FixtureWithRootAndroidBp(`
749 sdk {
750 name: "mysdk",
751 bootclasspath_fragments: ["mybootclasspathfragment"],
Paul Duffin7c955552021-04-19 13:23:53 +0100752 }
753
Paul Duffin475daaf2021-05-13 00:57:55 +0100754 apex {
755 name: "myapex",
756 key: "myapex.key",
757 min_sdk_version: "1",
758 bootclasspath_fragments: ["mybootclasspathfragment"],
759 }
760
Paul Duffin7c955552021-04-19 13:23:53 +0100761 bootclasspath_fragment {
762 name: "mybootclasspathfragment",
Paul Duffin475daaf2021-05-13 00:57:55 +0100763 apex_available: ["myapex"],
Paul Duffin7c955552021-04-19 13:23:53 +0100764 contents: ["mybootlib"],
Paul Duffin475daaf2021-05-13 00:57:55 +0100765 api: {
766 stub_libs: ["mysdklibrary"],
767 },
Paul Duffin7c955552021-04-19 13:23:53 +0100768 hidden_api: {
769 unsupported: [
770 "my-unsupported.txt",
771 ],
772 removed: [
773 "my-removed.txt",
774 ],
775 max_target_r_low_priority: [
776 "my-max-target-r-low-priority.txt",
777 ],
778 max_target_q: [
779 "my-max-target-q.txt",
780 ],
781 max_target_p: [
782 "my-max-target-p.txt",
783 ],
784 max_target_o_low_priority: [
785 "my-max-target-o-low-priority.txt",
786 ],
787 blocked: [
788 "my-blocked.txt",
789 ],
790 unsupported_packages: [
791 "my-unsupported-packages.txt",
792 ],
793 },
794 }
795
796 java_library {
797 name: "mybootlib",
Paul Duffin475daaf2021-05-13 00:57:55 +0100798 apex_available: ["myapex"],
Paul Duffin7c955552021-04-19 13:23:53 +0100799 srcs: ["Test.java"],
800 system_modules: "none",
801 sdk_version: "none",
Paul Duffin475daaf2021-05-13 00:57:55 +0100802 min_sdk_version: "1",
Paul Duffin7c955552021-04-19 13:23:53 +0100803 compile_dex: true,
Paul Duffin7c475152021-06-09 16:17:58 +0100804 permitted_packages: ["mybootlib"],
Paul Duffin7c955552021-04-19 13:23:53 +0100805 }
Paul Duffin475daaf2021-05-13 00:57:55 +0100806
807 java_sdk_library {
808 name: "mysdklibrary",
809 srcs: ["Test.java"],
810 compile_dex: true,
811 public: {enabled: true},
Paul Duffin869de142021-07-15 14:14:41 +0100812 permitted_packages: ["mysdklibrary"],
Paul Duffin475daaf2021-05-13 00:57:55 +0100813 }
Paul Duffin7c955552021-04-19 13:23:53 +0100814 `),
815 ).RunTest(t)
816
Paul Duffin7c475152021-06-09 16:17:58 +0100817 // A preparer to update the test fixture used when processing an unpackage snapshot.
818 preparerForSnapshot := fixtureAddPrebuiltApexForBootclasspathFragment("myapex", "mybootclasspathfragment")
819
Paul Duffin7c955552021-04-19 13:23:53 +0100820 CheckSnapshot(t, result, "mysdk", "",
821 checkUnversionedAndroidBpContents(`
822// This is auto-generated. DO NOT EDIT.
823
824prebuilt_bootclasspath_fragment {
825 name: "mybootclasspathfragment",
826 prefer: false,
827 visibility: ["//visibility:public"],
Paul Duffin475daaf2021-05-13 00:57:55 +0100828 apex_available: ["myapex"],
Paul Duffin7c955552021-04-19 13:23:53 +0100829 contents: ["mybootlib"],
Paul Duffin475daaf2021-05-13 00:57:55 +0100830 api: {
831 stub_libs: ["mysdklibrary"],
832 },
Paul Duffin7c955552021-04-19 13:23:53 +0100833 hidden_api: {
834 unsupported: ["hiddenapi/my-unsupported.txt"],
835 removed: ["hiddenapi/my-removed.txt"],
836 max_target_r_low_priority: ["hiddenapi/my-max-target-r-low-priority.txt"],
837 max_target_q: ["hiddenapi/my-max-target-q.txt"],
838 max_target_p: ["hiddenapi/my-max-target-p.txt"],
839 max_target_o_low_priority: ["hiddenapi/my-max-target-o-low-priority.txt"],
840 blocked: ["hiddenapi/my-blocked.txt"],
841 unsupported_packages: ["hiddenapi/my-unsupported-packages.txt"],
Paul Duffin2fef1362021-04-15 13:32:00 +0100842 stub_flags: "hiddenapi/stub-flags.csv",
843 annotation_flags: "hiddenapi/annotation-flags.csv",
844 metadata: "hiddenapi/metadata.csv",
845 index: "hiddenapi/index.csv",
846 all_flags: "hiddenapi/all-flags.csv",
Paul Duffin7c955552021-04-19 13:23:53 +0100847 },
848}
849
850java_import {
851 name: "mybootlib",
852 prefer: false,
853 visibility: ["//visibility:public"],
Paul Duffin475daaf2021-05-13 00:57:55 +0100854 apex_available: ["myapex"],
Paul Duffin5c211452021-07-15 12:42:44 +0100855 jars: ["java_boot_libs/snapshot/jars/are/invalid/mybootlib.jar"],
Paul Duffin869de142021-07-15 14:14:41 +0100856 permitted_packages: ["mybootlib"],
Paul Duffin7c955552021-04-19 13:23:53 +0100857}
Paul Duffin475daaf2021-05-13 00:57:55 +0100858
859java_sdk_library_import {
860 name: "mysdklibrary",
861 prefer: false,
862 visibility: ["//visibility:public"],
863 apex_available: ["//apex_available:platform"],
864 shared_library: true,
865 compile_dex: true,
Paul Duffin869de142021-07-15 14:14:41 +0100866 permitted_packages: ["mysdklibrary"],
Paul Duffin475daaf2021-05-13 00:57:55 +0100867 public: {
868 jars: ["sdk_library/public/mysdklibrary-stubs.jar"],
869 stub_srcs: ["sdk_library/public/mysdklibrary_stub_sources"],
870 current_api: "sdk_library/public/mysdklibrary.txt",
871 removed_api: "sdk_library/public/mysdklibrary-removed.txt",
872 sdk_version: "current",
873 },
874}
Paul Duffin7c955552021-04-19 13:23:53 +0100875`),
876 checkAllCopyRules(`
877my-unsupported.txt -> hiddenapi/my-unsupported.txt
878my-removed.txt -> hiddenapi/my-removed.txt
879my-max-target-r-low-priority.txt -> hiddenapi/my-max-target-r-low-priority.txt
880my-max-target-q.txt -> hiddenapi/my-max-target-q.txt
881my-max-target-p.txt -> hiddenapi/my-max-target-p.txt
882my-max-target-o-low-priority.txt -> hiddenapi/my-max-target-o-low-priority.txt
883my-blocked.txt -> hiddenapi/my-blocked.txt
884my-unsupported-packages.txt -> hiddenapi/my-unsupported-packages.txt
Paul Duffin2fef1362021-04-15 13:32:00 +0100885.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/stub-flags.csv -> hiddenapi/stub-flags.csv
886.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/annotation-flags.csv -> hiddenapi/annotation-flags.csv
887.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/metadata.csv -> hiddenapi/metadata.csv
888.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/index.csv -> hiddenapi/index.csv
889.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/all-flags.csv -> hiddenapi/all-flags.csv
Paul Duffin5c211452021-07-15 12:42:44 +0100890.intermediates/mysdk/common_os/empty -> java_boot_libs/snapshot/jars/are/invalid/mybootlib.jar
Paul Duffin475daaf2021-05-13 00:57:55 +0100891.intermediates/mysdklibrary.stubs/android_common/javac/mysdklibrary.stubs.jar -> sdk_library/public/mysdklibrary-stubs.jar
892.intermediates/mysdklibrary.stubs.source/android_common/metalava/mysdklibrary.stubs.source_api.txt -> sdk_library/public/mysdklibrary.txt
893.intermediates/mysdklibrary.stubs.source/android_common/metalava/mysdklibrary.stubs.source_removed.txt -> sdk_library/public/mysdklibrary-removed.txt
Paul Duffin7c955552021-04-19 13:23:53 +0100894`),
Paul Duffin7c475152021-06-09 16:17:58 +0100895 snapshotTestPreparer(checkSnapshotWithoutSource, preparerForSnapshot),
896 snapshotTestPreparer(checkSnapshotWithSourcePreferred, preparerForSnapshot),
897 snapshotTestPreparer(checkSnapshotPreferredWithSource, preparerForSnapshot),
Paul Duffin7c955552021-04-19 13:23:53 +0100898 )
899}