aboutsummaryrefslogtreecommitdiff
path: root/cc/sdk.go
diff options
context:
space:
mode:
Diffstat (limited to 'cc/sdk.go')
-rw-r--r--cc/sdk.go16
1 files changed, 13 insertions, 3 deletions
diff --git a/cc/sdk.go b/cc/sdk.go
index 5dd44d8b8..f375ce828 100644
--- a/cc/sdk.go
+++ b/cc/sdk.go
@@ -57,6 +57,9 @@ func (sdkTransitionMutator) Split(ctx android.BaseModuleContext) []string {
}
func (sdkTransitionMutator) OutgoingTransition(ctx android.OutgoingTransitionContext, sourceVariation string) string {
+ if _, ok := ctx.DepTag().(android.UsesUnbundledVariantDepTag); ok {
+ return "sdk"
+ }
return sourceVariation
}
@@ -78,8 +81,15 @@ func (sdkTransitionMutator) IncomingTransition(ctx android.IncomingTransitionCon
}
}
}
-
- if ctx.IsAddingDependency() {
+ _, usesUnbundledVariantDepTag := ctx.DepTag().(android.UsesUnbundledVariantDepTag)
+ // If we've reached this point, the module doesn't have an sdk variant. If we're adding
+ // a dependency, we want to pass the sdk variant through to cause a missing dependency error,
+ // so that sdk modules can't depend on non-sdk modules and smuggle the use of private apis.
+ // However, when the unbundled_builder depends on modules, it wants to prefer the sdk variant
+ // but fall back to non-sdk if it doesn't exist. It's ok in this case because the
+ // unbundled_builder is just a module for disting other modules, it doesn't have any code of its
+ // own.
+ if ctx.IsAddingDependency() && !usesUnbundledVariantDepTag {
return incomingVariation
} else {
return ""
@@ -114,7 +124,7 @@ func (sdkTransitionMutator) Mutate(ctx android.BottomUpMutatorContext, variation
ccModule.Properties.PreventInstall = true
}
- if ctx.Config().UnbundledBuildApps() {
+ if ctx.Config().HasUnbundledBuildApps() {
if variation == "" {
// For an unbundled apps build, hide the platform variant from Make
// so that other Make modules don't link against it, but against the