Do not allow duplicate deapexer dependencies.
Without these errors, the last encountered deapexer would silently be
used. However with PRODUCT_INSTALL_APEXES there will only be deapexer
for installable APEXes, and we can assume only a single installable
APEX exists for each APEX variant, so make it an error if it isn't the
case.
Corresponding to http://ag/15156931.
Test: m nothing SOONG_CONFIG_art_module_source_build=true
Test: m nothing SOONG_CONFIG_art_module_source_build=false
Test: m nothing SOONG_CONFIG_art_module_source_build=false
with installable:true for the com.android.art.debug prebuilt APEX -
check that it fails with an "ambiguous duplicate deapexer" error
Bug: 192006406
Bug: 192542393
Change-Id: I44566fd26b12f82a8a67fe4a69e56303460756d0
diff --git a/android/deapexer.go b/android/deapexer.go
index bed6574..265f531 100644
--- a/android/deapexer.go
+++ b/android/deapexer.go
@@ -143,12 +143,16 @@
}
// 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 {