Merge "Add annotations.zip support to java_sdk_library" am: 86da9c6a3d am: 52b99b10f5 am: 40ef0e9141 am: 9ef920bcb1 am: ee9ab003bb

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1832255

Change-Id: I10e4e4c5188f0a0297ee2baa1b5cf4a1b0f234a9
This commit is contained in:
Anton Hansson
2021-09-23 10:41:47 +00:00
committed by Automerger Merge Worker
5 changed files with 112 additions and 5 deletions

View File

@@ -317,12 +317,37 @@ func TestJavaSdkLibrary_DoNotAccessImplWhenItIsNotBuilt(t *testing.T) {
}
}
func TestJavaSdkLibrary_UseSourcesFromAnotherSdkLibrary(t *testing.T) {
func TestJavaSdkLibrary_AccessOutputFiles(t *testing.T) {
android.GroupFixturePreparers(
prepareForJavaTest,
PrepareForTestWithJavaSdkLibraryFiles,
FixtureWithLastReleaseApis("foo"),
).RunTestWithBp(t, `
java_sdk_library {
name: "foo",
srcs: ["a.java"],
api_packages: ["foo"],
annotations_enabled: true,
public: {
enabled: true,
},
}
java_library {
name: "bar",
srcs: ["b.java", ":foo{.public.stubs.source}"],
java_resources: [":foo{.public.annotations.zip}"],
}
`)
}
func TestJavaSdkLibrary_AccessOutputFiles_NoAnnotations(t *testing.T) {
android.GroupFixturePreparers(
prepareForJavaTest,
PrepareForTestWithJavaSdkLibraryFiles,
FixtureWithLastReleaseApis("foo"),
).
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(`module "bar" variant "android_common": path dependency ":foo{.public.annotations.zip}": annotations.zip not available for api scope public`)).
RunTestWithBp(t, `
java_sdk_library {
name: "foo",
srcs: ["a.java"],
@@ -335,6 +360,7 @@ func TestJavaSdkLibrary_UseSourcesFromAnotherSdkLibrary(t *testing.T) {
java_library {
name: "bar",
srcs: ["b.java", ":foo{.public.stubs.source}"],
java_resources: [":foo{.public.annotations.zip}"],
}
`)
}
@@ -398,6 +424,7 @@ func TestJavaSdkLibraryImport_AccessOutputFiles(t *testing.T) {
stub_srcs: ["a.java"],
current_api: "api/current.txt",
removed_api: "api/removed.txt",
annotations: "x/annotations.zip",
},
}
@@ -407,6 +434,7 @@ func TestJavaSdkLibraryImport_AccessOutputFiles(t *testing.T) {
java_resources: [
":foo{.public.api.txt}",
":foo{.public.removed-api.txt}",
":foo{.public.annotations.zip}",
],
}
`)