Merge changes from topic "cherrypicker-L27000030003160683:N90900030051335582" into main

* changes:
  Propagate transitive missing optional_uses_libs.
  Refactor the contruction of the manifest check inputs.
This commit is contained in:
Treehugger Robot
2024-04-16 13:35:54 +00:00
committed by Gerrit Code Review
9 changed files with 146 additions and 77 deletions

View File

@@ -843,9 +843,11 @@ func (j *Module) deps(ctx android.BottomUpMutatorContext) {
if dep != nil {
if component, ok := dep.(SdkLibraryComponentDependency); ok {
if lib := component.OptionalSdkLibraryImplementation(); lib != nil {
// Add library as optional if it's one of the optional compatibility libs.
// Add library as optional if it's one of the optional compatibility libs or it's
// explicitly listed in the optional_uses_libs property.
tag := usesLibReqTag
if android.InList(*lib, dexpreopt.OptionalCompatUsesLibs) {
if android.InList(*lib, dexpreopt.OptionalCompatUsesLibs) ||
android.InList(*lib, j.usesLibrary.usesLibraryProperties.Optional_uses_libs) {
tag = usesLibOptTag
}
ctx.AddVariationDependencies(nil, tag, *lib)
@@ -2387,6 +2389,7 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
}
addCLCFromDep(ctx, module, j.classLoaderContexts)
addMissingOptionalUsesLibsFromDep(ctx, module, &j.usesLibrary)
})
return deps
@@ -2720,3 +2723,13 @@ type ModuleWithStem interface {
}
var _ ModuleWithStem = (*Module)(nil)
type ModuleWithUsesLibrary interface {
UsesLibrary() *usesLibrary
}
func (j *Module) UsesLibrary() *usesLibrary {
return &j.usesLibrary
}
var _ ModuleWithUsesLibrary = (*Module)(nil)