Merge "Do not allow duplicate deapexer dependencies." am: d7c3fc0ae0 am: 49df6778ca am: 6bec093e48

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1752641

Change-Id: I079dd1a7666520e69f47b7819ee6977ba6e770fe
This commit is contained in:
Martin Stjernholm
2021-12-13 16:51:07 +00:00
committed by Automerger Merge Worker
3 changed files with 114 additions and 16 deletions

View File

@@ -143,12 +143,16 @@ type RequiresFilesFromPrebuiltApexTag interface {
}
// FindDeapexerProviderForModule searches through the direct dependencies of the current context
// module for a DeapexerTag dependency and returns its DeapexerInfo. If there is an error then it is
// reported with ctx.ModuleErrorf and nil is returned.
// module for a DeapexerTag dependency and returns its DeapexerInfo. If a single nonambiguous
// deapexer module isn't found then errors are reported with ctx.ModuleErrorf and nil is returned.
func FindDeapexerProviderForModule(ctx ModuleContext) *DeapexerInfo {
var di *DeapexerInfo
ctx.VisitDirectDepsWithTag(DeapexerTag, func(m Module) {
p := ctx.OtherModuleProvider(m, DeapexerProvider).(DeapexerInfo)
if di != nil {
ctx.ModuleErrorf("Multiple installable prebuilt APEXes provide ambiguous deapexers: %s and %s",
di.ApexModuleName(), p.ApexModuleName())
}
di = &p
})
if di != nil {