Merge changes from topic "far-dep-exists" into sc-dev
* changes:
Check for product variant in addition to core variant.
Plumb through OtherModuleFarDependencyVariantExists from blueprint.
diff --git a/android/module.go b/android/module.go
index 69572dd..f745a4a 100644
--- a/android/module.go
+++ b/android/module.go
@@ -165,13 +165,20 @@
// OtherModuleDependencyVariantExists returns true if a module with the
// specified name and variant exists. The variant must match the given
// variations. It must also match all the non-local variations of the current
- // module. In other words, it checks for the module AddVariationDependencies
+ // module. In other words, it checks for the module that AddVariationDependencies
// would add a dependency on with the same arguments.
OtherModuleDependencyVariantExists(variations []blueprint.Variation, name string) bool
+ // OtherModuleFarDependencyVariantExists returns true if a module with the
+ // specified name and variant exists. The variant must match the given
+ // variations, but not the non-local variations of the current module. In
+ // other words, it checks for the module that AddFarVariationDependencies
+ // would add a dependency on with the same arguments.
+ OtherModuleFarDependencyVariantExists(variations []blueprint.Variation, name string) bool
+
// OtherModuleReverseDependencyVariantExists returns true if a module with the
// specified name exists with the same variations as the current module. In
- // other words, it checks for the module AddReverseDependency would add a
+ // other words, it checks for the module that AddReverseDependency would add a
// dependency on with the same argument.
OtherModuleReverseDependencyVariantExists(name string) bool
@@ -2022,6 +2029,9 @@
func (b *baseModuleContext) OtherModuleDependencyVariantExists(variations []blueprint.Variation, name string) bool {
return b.bp.OtherModuleDependencyVariantExists(variations, name)
}
+func (b *baseModuleContext) OtherModuleFarDependencyVariantExists(variations []blueprint.Variation, name string) bool {
+ return b.bp.OtherModuleFarDependencyVariantExists(variations, name)
+}
func (b *baseModuleContext) OtherModuleReverseDependencyVariantExists(name string) bool {
return b.bp.OtherModuleReverseDependencyVariantExists(name)
}
diff --git a/cc/snapshot_prebuilt.go b/cc/snapshot_prebuilt.go
index 0b1147e..a7351a9 100644
--- a/cc/snapshot_prebuilt.go
+++ b/cc/snapshot_prebuilt.go
@@ -454,13 +454,30 @@
}
func (p *baseSnapshotDecorator) setSnapshotAndroidMkSuffix(ctx android.ModuleContext) {
- if ctx.OtherModuleDependencyVariantExists([]blueprint.Variation{
- {Mutator: "image", Variation: android.CoreVariation},
- }, ctx.Module().(*Module).BaseModuleName()) {
+ coreVariations := append(ctx.Target().Variations(), blueprint.Variation{
+ Mutator: "image",
+ Variation: android.CoreVariation})
+
+ if ctx.OtherModuleFarDependencyVariantExists(coreVariations, ctx.Module().(*Module).BaseModuleName()) {
p.baseProperties.Androidmk_suffix = p.image.moduleNameSuffix()
- } else {
- p.baseProperties.Androidmk_suffix = ""
+ return
}
+
+ // If there is no matching core variation, there could still be a
+ // product variation, for example if a module is product specific and
+ // vendor available. In that case, we also want to add the androidmk
+ // suffix.
+
+ productVariations := append(ctx.Target().Variations(), blueprint.Variation{
+ Mutator: "image",
+ Variation: ProductVariationPrefix + ctx.DeviceConfig().PlatformVndkVersion()})
+
+ if ctx.OtherModuleFarDependencyVariantExists(productVariations, ctx.Module().(*Module).BaseModuleName()) {
+ p.baseProperties.Androidmk_suffix = p.image.moduleNameSuffix()
+ return
+ }
+
+ p.baseProperties.Androidmk_suffix = ""
}
// Call this with a module suffix after creating a snapshot module, such as