summaryrefslogtreecommitdiff
path: root/java/droidstubs_test.go
diff options
context:
space:
mode:
author Jihoon Kang <jihoonkang@google.com> 2024-01-08 23:52:27 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2024-01-08 23:52:27 +0000
commit0f5162161d14a07b6132c33fef8d35d937cbd514 (patch)
treee6ee20d7d6bf910f509ba0b3b7b8686c0baec759 /java/droidstubs_test.go
parent8460fab92d4929b3baf9420893b73a09905cb2e3 (diff)
parent6592e87dbfe1e49b5c57ca8ead0bb48e6354e261 (diff)
Merge "Add aconfig_declarations property to droidstubs and java_sdk_library" into main
Diffstat (limited to 'java/droidstubs_test.go')
-rw-r--r--java/droidstubs_test.go43
1 files changed, 43 insertions, 0 deletions
diff --git a/java/droidstubs_test.go b/java/droidstubs_test.go
index 7bcaca1d4..5544890af 100644
--- a/java/droidstubs_test.go
+++ b/java/droidstubs_test.go
@@ -395,3 +395,46 @@ func TestDroidstubsHideFlaggedApi(t *testing.T) {
cmdline := String(android.RuleBuilderSboxProtoForTests(t, result.TestContext, manifest).Commands[0].Command)
android.AssertStringDoesContain(t, "flagged api hide command not included", cmdline, "--revert-annotation android.annotation.FlaggedApi")
}
+
+func TestAconfigDeclarations(t *testing.T) {
+ result := android.GroupFixturePreparers(
+ prepareForJavaTest,
+ android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
+ }),
+ android.FixtureMergeMockFs(map[string][]byte{
+ "a/A.java": nil,
+ "a/current.txt": nil,
+ "a/removed.txt": nil,
+ }),
+ ).RunTestWithBp(t, `
+ aconfig_declarations {
+ name: "bar",
+ package: "com.example.package",
+ srcs: [
+ "bar.aconfig",
+ ],
+ }
+ droidstubs {
+ name: "foo",
+ srcs: ["a/A.java"],
+ api_surface: "public",
+ check_api: {
+ current: {
+ api_file: "a/current.txt",
+ removed_api_file: "a/removed.txt",
+ }
+ },
+ aconfig_declarations: [
+ "bar",
+ ],
+ }
+ `)
+
+ // Check that droidstubs depend on aconfig_declarations
+ android.AssertBoolEquals(t, "foo expected to depend on bar",
+ CheckModuleHasDependency(t, result.TestContext, "foo", "android_common", "bar"), true)
+
+ m := result.ModuleForTests("foo", "android_common")
+ android.AssertStringDoesContain(t, "foo generates revert annotations file",
+ strings.Join(m.AllOutputs(), ""), "revert-annotations-exportable.txt")
+}