Propagate permitted packages to sdk snapshot

Previously, permitted_packages were not copied to the sdk snapshot.
This change corrects that.

Bug: 193763688
Test: m nothing
      - Added unit tests, which all failed and then fixed the tests.
Merged-In: I4560987f746f78c0ae706058195b6db4bea438aa
Change-Id: I4560987f746f78c0ae706058195b6db4bea438aa
(cherry picked from commit 869de147ab)
This commit is contained in:
Paul Duffin
2021-07-15 14:14:41 +01:00
parent fa20b187dc
commit 7b3e10a1c2
4 changed files with 40 additions and 0 deletions

View File

@@ -346,6 +346,7 @@ java_import {
visibility: ["//visibility:public"],
apex_available: ["myapex"],
jars: ["java/mybootlib.jar"],
permitted_packages: ["mybootlib"],
}
java_sdk_library_import {
@@ -355,6 +356,7 @@ java_sdk_library_import {
apex_available: ["myapex"],
shared_library: true,
compile_dex: true,
permitted_packages: ["myothersdklibrary"],
public: {
jars: ["sdk_library/public/myothersdklibrary-stubs.jar"],
stub_srcs: ["sdk_library/public/myothersdklibrary_stub_sources"],
@@ -428,6 +430,7 @@ java_import {
visibility: ["//visibility:public"],
apex_available: ["myapex"],
jars: ["java/mybootlib.jar"],
permitted_packages: ["mybootlib"],
}
java_sdk_library_import {
@@ -437,6 +440,7 @@ java_sdk_library_import {
apex_available: ["myapex"],
shared_library: true,
compile_dex: true,
permitted_packages: ["myothersdklibrary"],
public: {
jars: ["sdk_library/public/myothersdklibrary-stubs.jar"],
stub_srcs: ["sdk_library/public/myothersdklibrary_stub_sources"],
@@ -677,6 +681,7 @@ func TestSnapshotWithBootclasspathFragment_HiddenAPI(t *testing.T) {
srcs: ["Test.java"],
compile_dex: true,
public: {enabled: true},
permitted_packages: ["mysdklibrary"],
}
`),
).RunTest(t)
@@ -720,6 +725,7 @@ java_import {
visibility: ["//visibility:public"],
apex_available: ["myapex"],
jars: ["java/mybootlib.jar"],
permitted_packages: ["mybootlib"],
}
java_sdk_library_import {
@@ -729,6 +735,7 @@ java_sdk_library_import {
apex_available: ["//apex_available:platform"],
shared_library: true,
compile_dex: true,
permitted_packages: ["mysdklibrary"],
public: {
jars: ["sdk_library/public/mysdklibrary-stubs.jar"],
stub_srcs: ["sdk_library/public/mysdklibrary_stub_sources"],