summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2024-06-26 13:04:56 -0700
committer Colin Cross <ccross@android.com> 2024-07-11 16:59:34 -0700
commit77c5e9f9d4ce2570918936b0f77237c30ae18a11 (patch)
tree8ce85932036622dea95c7e05a8f62a70bdac5aa8
parente1a8555581d4939882f94f4270d03a0d24ee93f3 (diff)
Don't forward apex dependencies to platform when they are added later
IncomingApexTransition normally returns "" for modules that have no apex variation so that apex variations can depend on non-apex variations, for example for NDK libraries. addDependencyOntoApexModulePair uses OtherModuleDependencyVariantExists to decide whether to add a dependency on a module in an apex. If IncomingApexTransition returns "" then OtherModuleDependencyVariantExists will always return true. Return the incoming variation when addding dependencies after the apex transition mutator has already run. Bug: 319288033 Flag: EXEMPT bugfix Test: all soong tests pass with later patches applied Change-Id: Iec40c3be2ed04dca16a9fa6fa0a1c31056b536a8
-rw-r--r--android/apex.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/android/apex.go b/android/apex.go
index 683e50162..ecab8e3fe 100644
--- a/android/apex.go
+++ b/android/apex.go
@@ -610,9 +610,15 @@ func IncomingApexTransition(ctx IncomingTransitionContext, incomingVariation str
return ""
}
- // If this module has no apex variations the use the platform variation.
if len(apexInfos) == 0 {
- return ""
+ if ctx.IsAddingDependency() {
+ // If this module has no apex variations we can't do any mapping on the incoming variation, just return it
+ // and let the caller get a "missing variant" error.
+ return incomingVariation
+ } else {
+ // If this module has no apex variations the use the platform variation.
+ return ""
+ }
}
// Convert the list of apex infos into from the AllApexInfoProvider into the merged list