Merge "Create APEX variant for prebuilt_apex/apex_set" am: 2960e9bdf2
am: 70fc36a6fc
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1738034 Change-Id: I0cf928c7649040fe588ae8ff9d7db55f4f6c7610
This commit is contained in:
27
apex/apex.go
27
apex/apex.go
@@ -1046,8 +1046,9 @@ func apexMutator(mctx android.BottomUpMutatorContext) {
|
||||
|
||||
// apexBundle itself is mutated so that it and its dependencies have the same apex variant.
|
||||
// TODO(jiyong): document the reason why the VNDK APEX is an exception here.
|
||||
if a, ok := mctx.Module().(*apexBundle); ok && !a.vndkApex {
|
||||
apexBundleName := mctx.ModuleName()
|
||||
unprefixedModuleName := android.RemoveOptionalPrebuiltPrefix(mctx.ModuleName())
|
||||
if apexModuleTypeRequiresVariant(mctx.Module()) {
|
||||
apexBundleName := unprefixedModuleName
|
||||
mctx.CreateVariations(apexBundleName)
|
||||
if strings.HasPrefix(apexBundleName, "com.android.art") {
|
||||
// Create an alias from the platform variant. This is done to make
|
||||
@@ -1065,6 +1066,12 @@ func apexMutator(mctx android.BottomUpMutatorContext) {
|
||||
mctx.ModuleErrorf("base property is not set")
|
||||
return
|
||||
}
|
||||
// Workaround the issue reported in b/191269918 by using the unprefixed module name of this
|
||||
// module as the default variation to use if dependencies of this module do not have the correct
|
||||
// apex variant name. This name matches the name used to create the variations of modules for
|
||||
// which apexModuleTypeRequiresVariant return true.
|
||||
// TODO(b/191269918): Remove this workaround.
|
||||
mctx.SetDefaultDependencyVariation(&unprefixedModuleName)
|
||||
mctx.CreateVariations(apexBundleName)
|
||||
if strings.HasPrefix(apexBundleName, "com.android.art") {
|
||||
// TODO(b/183882457): See note for CreateAliasVariation above.
|
||||
@@ -1073,6 +1080,22 @@ func apexMutator(mctx android.BottomUpMutatorContext) {
|
||||
}
|
||||
}
|
||||
|
||||
// apexModuleTypeRequiresVariant determines whether the module supplied requires an apex specific
|
||||
// variant.
|
||||
func apexModuleTypeRequiresVariant(module android.Module) bool {
|
||||
if a, ok := module.(*apexBundle); ok {
|
||||
return !a.vndkApex
|
||||
}
|
||||
|
||||
// Match apex_set and prebuilt_apex. Would also match apexBundle but that is handled specially
|
||||
// above.
|
||||
if _, ok := module.(ApexInfoMutator); ok {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// See android.UpdateDirectlyInAnyApex
|
||||
// TODO(jiyong): move this to android/apex.go?
|
||||
func apexDirectlyInAnyMutator(mctx android.BottomUpMutatorContext) {
|
||||
|
Reference in New Issue
Block a user