summaryrefslogtreecommitdiff
path: root/apex/apex.go
diff options
context:
space:
mode:
Diffstat (limited to 'apex/apex.go')
-rw-r--r--apex/apex.go68
1 files changed, 26 insertions, 42 deletions
diff --git a/apex/apex.go b/apex/apex.go
index bc91407a7..cb8449c5a 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -358,6 +358,8 @@ type overridableProperties struct {
// be removed from PRODUCT_PACKAGES.
Overrides []string
+ Multilib apexMultilibProperties
+
// Logging parent value.
Logging_parent string
@@ -735,39 +737,25 @@ func (a *apexBundle) combineProperties(ctx android.BottomUpMutatorContext) {
// suffix indicates the vndk version for vendor/product if vndk is enabled.
// getImageVariation can simply join the result of this function to get the
// image variation name.
-func (a *apexBundle) getImageVariationPair(deviceConfig android.DeviceConfig) (string, string) {
+func (a *apexBundle) getImageVariationPair() (string, string) {
if a.vndkApex {
- return cc.VendorVariationPrefix, a.vndkVersion(deviceConfig)
+ return cc.VendorVariationPrefix, a.vndkVersion()
}
prefix := android.CoreVariation
- vndkVersion := ""
- if deviceConfig.VndkVersion() != "" {
- if a.SocSpecific() || a.DeviceSpecific() {
- prefix = cc.VendorVariationPrefix
- vndkVersion = deviceConfig.VndkVersion()
- } else if a.ProductSpecific() {
- prefix = cc.ProductVariationPrefix
- vndkVersion = deviceConfig.PlatformVndkVersion()
- }
- } else {
- if a.SocSpecific() || a.DeviceSpecific() {
- prefix = cc.VendorVariation
- } else if a.ProductSpecific() {
- prefix = cc.ProductVariation
- }
- }
- if vndkVersion == "current" {
- vndkVersion = deviceConfig.PlatformVndkVersion()
+ if a.SocSpecific() || a.DeviceSpecific() {
+ prefix = cc.VendorVariation
+ } else if a.ProductSpecific() {
+ prefix = cc.ProductVariation
}
- return prefix, vndkVersion
+ return prefix, ""
}
// getImageVariation returns the image variant name for this apexBundle. In most cases, it's simply
// android.CoreVariation, but gets complicated for the vendor APEXes and the VNDK APEX.
-func (a *apexBundle) getImageVariation(ctx android.BottomUpMutatorContext) string {
- prefix, vndkVersion := a.getImageVariationPair(ctx.DeviceConfig())
+func (a *apexBundle) getImageVariation() string {
+ prefix, vndkVersion := a.getImageVariationPair()
return prefix + vndkVersion
}
@@ -777,7 +765,7 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) {
// each target os/architectures, appropriate dependencies are selected by their
// target.<os>.multilib.<type> groups and are added as (direct) dependencies.
targets := ctx.MultiTargets()
- imageVariation := a.getImageVariation(ctx)
+ imageVariation := a.getImageVariation()
a.combineProperties(ctx)
@@ -1310,30 +1298,26 @@ func apexMutator(mctx android.BottomUpMutatorContext) {
}
// apexBundle itself is mutated so that it and its dependencies have the same apex variant.
- if ai, ok := mctx.Module().(ApexInfoMutator); ok && apexModuleTypeRequiresVariant(ai) {
- apexBundleName := ai.ApexVariationName()
+ // Note that a default variation "" is also created as an alias, and the default dependency
+ // variation is set to the default variation. This is to allow an apex to depend on another
+ // module which is outside of the apex. This is because the dependent module is not mutated
+ // for this apex variant.
+ createApexVariation := func(apexBundleName string) {
+ defaultVariation := ""
+ mctx.SetDefaultDependencyVariation(&defaultVariation)
mctx.CreateVariations(apexBundleName)
- if strings.HasPrefix(apexBundleName, "com.android.art") {
- // Create an alias from the platform variant. This is done to make
- // test_for dependencies work for modules that are split by the APEX
- // mutator, since test_for dependencies always go to the platform variant.
- // This doesn't happen for normal APEXes that are disjunct, so only do
- // this for the overlapping ART APEXes.
- // TODO(b/183882457): Remove this if the test_for functionality is
- // refactored to depend on the proper APEX variants instead of platform.
- mctx.CreateAliasVariation("", apexBundleName)
- }
+ mctx.CreateAliasVariation(defaultVariation, apexBundleName)
+ }
+
+ if ai, ok := mctx.Module().(ApexInfoMutator); ok && apexModuleTypeRequiresVariant(ai) {
+ createApexVariation(ai.ApexVariationName())
} else if o, ok := mctx.Module().(*OverrideApex); ok {
apexBundleName := o.GetOverriddenModuleName()
if apexBundleName == "" {
mctx.ModuleErrorf("base property is not set")
return
}
- mctx.CreateVariations(apexBundleName)
- if strings.HasPrefix(apexBundleName, "com.android.art") {
- // TODO(b/183882457): See note for CreateAliasVariation above.
- mctx.CreateAliasVariation("", apexBundleName)
- }
+ createApexVariation(apexBundleName)
}
}
@@ -1538,7 +1522,7 @@ func (a *apexBundle) AddSanitizerDependencies(ctx android.BottomUpMutatorContext
// TODO(jiyong): move this info (the sanitizer name, the lib name, etc.) to cc/sanitize.go
// Keep only the mechanism here.
if sanitizerName == "hwaddress" && strings.HasPrefix(a.Name(), "com.android.runtime") {
- imageVariation := a.getImageVariation(ctx)
+ imageVariation := a.getImageVariation()
for _, target := range ctx.MultiTargets() {
if target.Arch.ArchType.Multilib == "lib64" {
addDependenciesForNativeModules(ctx, ApexNativeDependencies{