summaryrefslogtreecommitdiff
path: root/java/platform_bootclasspath_test.go
diff options
context:
space:
mode:
authorPaul Duffin <paulduffin@google.com>2021-04-12 17:24:36 +0100
committerPaul Duffin <paulduffin@google.com>2021-04-14 18:54:29 +0100
commit00b2bfdea57286232ac6c7ec36742d95c9d7a04e (patch)
tree820915dace9c1b4f9a9a345dc6aa856fcf0b767a /java/platform_bootclasspath_test.go
parent9e7bfdae31f8b3bb16a7cb30a19f20881d9dec8f (diff)
Move hidden API index file rule to platform_bootclasspath
This change moves the monolithic hidden API index file creation rule from the hiddenAPIIndexSingleton into the platform_bootclasspath. It also moves the corresponding test from java/hiddenapi_singleton_test.go to java/platform_bootclasspath_test.go. Bug: 179354495 Test: verified that the out/soong/hiddenapi/... files are unchanged by this change Change-Id: Ia295d0f7ae9b51ea816f16921aa42339ed91704e
Diffstat (limited to 'java/platform_bootclasspath_test.go')
-rw-r--r--java/platform_bootclasspath_test.go59
1 files changed, 59 insertions, 0 deletions
diff --git a/java/platform_bootclasspath_test.go b/java/platform_bootclasspath_test.go
index c740911f1..9e0235bf6 100644
--- a/java/platform_bootclasspath_test.go
+++ b/java/platform_bootclasspath_test.go
@@ -172,3 +172,62 @@ func TestPlatformBootclasspath_Dist(t *testing.T) {
android.AssertStringEquals(t, "platform dist goals phony", ".PHONY: droidcore\n", goals[0])
android.AssertStringEquals(t, "platform dist goals call", "$(call dist-for-goals,droidcore,out/soong/hiddenapi/hiddenapi-flags.csv:hiddenapi-flags.csv)\n", android.StringRelativeToTop(result.Config, goals[1]))
}
+
+func TestPlatformBootclasspath_HiddenAPIMonolithicIndexFile(t *testing.T) {
+ result := android.GroupFixturePreparers(
+ hiddenApiFixtureFactory,
+ PrepareForTestWithJavaSdkLibraryFiles,
+ FixtureWithLastReleaseApis("bar"),
+ FixtureConfigureBootJars("platform:foo", "platform:bar"),
+ ).RunTestWithBp(t, `
+ java_library {
+ name: "foo",
+ srcs: ["a.java"],
+ compile_dex: true,
+
+ hiddenapi_additional_annotations: [
+ "foo-hiddenapi-annotations",
+ ],
+ }
+
+ java_library {
+ name: "foo-hiddenapi-annotations",
+ srcs: ["a.java"],
+ compile_dex: true,
+ }
+
+ java_import {
+ name: "foo",
+ jars: ["a.jar"],
+ compile_dex: true,
+ prefer: false,
+ }
+
+ java_sdk_library {
+ name: "bar",
+ srcs: ["a.java"],
+ compile_dex: true,
+ }
+
+ platform_bootclasspath {
+ name: "myplatform-bootclasspath",
+ }
+ `)
+
+ platformBootclasspath := result.ModuleForTests("myplatform-bootclasspath", "android_common")
+ indexRule := platformBootclasspath.Rule("platform-bootclasspath-monolithic-hiddenapi-index")
+ CheckHiddenAPIRuleInputs(t, `
+.intermediates/bar/android_common/hiddenapi/index.csv
+.intermediates/foo/android_common/hiddenapi/index.csv
+`,
+ indexRule)
+
+ // Make sure that the foo-hiddenapi-annotations.jar is included in the inputs to the rules that
+ // creates the index.csv file.
+ foo := result.ModuleForTests("foo", "android_common")
+ indexParams := foo.Output("hiddenapi/index.csv")
+ CheckHiddenAPIRuleInputs(t, `
+.intermediates/foo-hiddenapi-annotations/android_common/javac/foo-hiddenapi-annotations.jar
+.intermediates/foo/android_common/javac/foo.jar
+`, indexParams)
+}