Merge "Add an allowlist for modules that have broken optional_uses_libs."

This commit is contained in:
Jiakai Zhang 2023-06-05 14:05:49 +00:00 committed by Gerrit Code Review
commit 4f8b23e8e2
4 changed files with 10 additions and 1 deletions

View file

@ -1925,6 +1925,10 @@ func (c *deviceConfig) BuildBrokenInputDir(name string) bool {
return InList(name, c.config.productVariables.BuildBrokenInputDirModules)
}
func (c *config) BuildWarningBadOptionalUsesLibsAllowlist() []string {
return c.productVariables.BuildWarningBadOptionalUsesLibsAllowlist
}
func (c *deviceConfig) GenruleSandboxing() bool {
return Bool(c.config.productVariables.GenruleSandboxing)
}

View file

@ -449,6 +449,8 @@ type productVariables struct {
BuildBrokenVendorPropertyNamespace bool `json:",omitempty"`
BuildBrokenInputDirModules []string `json:",omitempty"`
BuildWarningBadOptionalUsesLibsAllowlist []string `json:",omitempty"`
BuildDebugfsRestrictionsEnabled bool `json:",omitempty"`
RequiresInsecureExecmemForSwiftshader bool `json:",omitempty"`

View file

@ -1396,7 +1396,7 @@ func (u *usesLibrary) deps(ctx android.BottomUpMutatorContext, addCompatDeps boo
func (u *usesLibrary) presentOptionalUsesLibs(ctx android.BaseModuleContext) []string {
optionalUsesLibs := android.FilterListPred(u.usesLibraryProperties.Optional_uses_libs, func(s string) bool {
exists := ctx.OtherModuleExists(s)
if !exists {
if !exists && !android.InList(ctx.ModuleName(), ctx.Config().BuildWarningBadOptionalUsesLibsAllowlist()) {
fmt.Printf("Warning: Module '%s' depends on non-existing optional_uses_libs '%s'\n", ctx.ModuleName(), s)
}
return exists

View file

@ -2644,6 +2644,9 @@ func TestUsesLibraries(t *testing.T) {
prepareForJavaTest,
PrepareForTestWithJavaSdkLibraryFiles,
FixtureWithLastReleaseApis("runtime-library", "foo", "quuz", "qux", "bar", "fred"),
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
variables.BuildWarningBadOptionalUsesLibsAllowlist = []string{"app", "prebuilt"}
}),
).RunTestWithBp(t, bp)
app := result.ModuleForTests("app", "android_common")