diff options
Diffstat (limited to 'java/droidstubs_test.go')
-rw-r--r-- | java/droidstubs_test.go | 43 |
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") +} |