Revert^2 "Add flagged api hide conditional to droidstubs"
This reverts commit 1180919dda
.
Test: go test ./java && m TARGET_PRODUCT=sdk TESTING_TARGET_RELEASE_NEXT=true nothing and inspect ninja command for generating stubs and verify the flag is included && m TARGET_PRODUCT=sdk TARGET_RELEASE=trunk_food nothing and inspect ninja command for generating stubs and verify the flag is not included
Bug: 299570421
Change-Id: I4967376c0236bad729398af80fa59b48dbab5f21
This commit is contained in:
parent
f3aa3225b6
commit
c831389625
3 changed files with 42 additions and 0 deletions
|
@ -2088,3 +2088,7 @@ func (c *deviceConfig) NextReleaseHideFlaggedApi() bool {
|
||||||
func (c *deviceConfig) ReleaseExposeFlaggedApi() bool {
|
func (c *deviceConfig) ReleaseExposeFlaggedApi() bool {
|
||||||
return Bool(c.config.productVariables.Release_expose_flagged_api)
|
return Bool(c.config.productVariables.Release_expose_flagged_api)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *deviceConfig) HideFlaggedApis() bool {
|
||||||
|
return c.NextReleaseHideFlaggedApi() && !c.ReleaseExposeFlaggedApi()
|
||||||
|
}
|
||||||
|
|
|
@ -540,6 +540,10 @@ func metalavaCmd(ctx android.ModuleContext, rule *android.RuleBuilder, javaVersi
|
||||||
// See b/285312164 for more information.
|
// See b/285312164 for more information.
|
||||||
cmd.FlagWithArg("--format-defaults ", "overloaded-method-order=source")
|
cmd.FlagWithArg("--format-defaults ", "overloaded-method-order=source")
|
||||||
|
|
||||||
|
if ctx.DeviceConfig().HideFlaggedApis() {
|
||||||
|
cmd.FlagWithArg("--hide-annotation ", "android.annotation.FlaggedApi")
|
||||||
|
}
|
||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,8 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
|
|
||||||
|
"github.com/google/blueprint/proptools"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestDroidstubs(t *testing.T) {
|
func TestDroidstubs(t *testing.T) {
|
||||||
|
@ -403,3 +405,35 @@ func TestGeneratedApiContributionVisibilityTest(t *testing.T) {
|
||||||
|
|
||||||
ctx.ModuleForTests("bar", "android_common")
|
ctx.ModuleForTests("bar", "android_common")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestDroidstubsHideFlaggedApi(t *testing.T) {
|
||||||
|
result := android.GroupFixturePreparers(
|
||||||
|
prepareForJavaTest,
|
||||||
|
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
|
||||||
|
variables.NextReleaseHideFlaggedApi = proptools.BoolPtr(true)
|
||||||
|
variables.Release_expose_flagged_api = proptools.BoolPtr(false)
|
||||||
|
}),
|
||||||
|
android.FixtureMergeMockFs(map[string][]byte{
|
||||||
|
"a/A.java": nil,
|
||||||
|
"a/current.txt": nil,
|
||||||
|
"a/removed.txt": nil,
|
||||||
|
}),
|
||||||
|
).RunTestWithBp(t, `
|
||||||
|
droidstubs {
|
||||||
|
name: "foo",
|
||||||
|
srcs: ["a/A.java"],
|
||||||
|
api_surface: "public",
|
||||||
|
check_api: {
|
||||||
|
current: {
|
||||||
|
api_file: "a/current.txt",
|
||||||
|
removed_api_file: "a/removed.txt",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
`)
|
||||||
|
|
||||||
|
m := result.ModuleForTests("foo", "android_common")
|
||||||
|
manifest := m.Output("metalava.sbox.textproto")
|
||||||
|
cmdline := String(android.RuleBuilderSboxProtoForTests(t, manifest).Commands[0].Command)
|
||||||
|
android.AssertStringDoesContain(t, "flagged api hide command not included", cmdline, "--hide-annotation android.annotation.FlaggedApi")
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue