Merge changes Iaca95efc,I7ccd5581 am: 57fab96e01 am: 3645404e1c am: 777bf29f3b

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1526698

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I4dc62c5042f18edc7741c949868c9654e5e70202
This commit is contained in:
Paul Duffin 2020-12-14 14:07:01 +00:00 committed by Automerger Merge Worker
commit 4707f03be8
3 changed files with 32 additions and 12 deletions

View File

@ -17,6 +17,7 @@ package android
import (
"fmt"
"reflect"
"strings"
"github.com/google/blueprint"
"github.com/google/blueprint/proptools"
@ -74,6 +75,12 @@ type Prebuilt struct {
srcsPropertyName string
}
// RemoveOptionalPrebuiltPrefix returns the result of removing the "prebuilt_" prefix from the
// supplied name if it has one, or returns the name unmodified if it does not.
func RemoveOptionalPrebuiltPrefix(name string) string {
return strings.TrimPrefix(name, "prebuilt_")
}
func (p *Prebuilt) Name(name string) string {
return "prebuilt_" + name
}

View File

@ -728,7 +728,9 @@ type ApexBundleInfo struct {
var ApexBundleInfoProvider = blueprint.NewMutatorProvider(ApexBundleInfo{}, "apex_info")
// apexInfoMutator is responsible for collecting modules that need to have apex variants. They are
var _ ApexInfoMutator = (*apexBundle)(nil)
// ApexInfoMutator is responsible for collecting modules that need to have apex variants. They are
// identified by doing a graph walk starting from an apexBundle. Basically, all the (direct and
// indirect) dependencies are collected. But a few types of modules that shouldn't be included in
// the apexBundle (e.g. stub libraries) are not collected. Note that a single module can be depended
@ -739,15 +741,7 @@ var ApexBundleInfoProvider = blueprint.NewMutatorProvider(ApexBundleInfo{}, "ape
// The apexMutator uses that list to create module variants for the apexes to which it belongs.
// The relationship between module variants and apexes is not one-to-one as variants will be
// shared between compatible apexes.
func apexInfoMutator(mctx android.TopDownMutatorContext) {
if !mctx.Module().Enabled() {
return
}
a, ok := mctx.Module().(*apexBundle)
if !ok {
return
}
func (a *apexBundle) ApexInfoMutator(mctx android.TopDownMutatorContext) {
// The VNDK APEX is special. For the APEX, the membership is described in a very different
// way. There is no dependency from the VNDK APEX to the VNDK libraries. Instead, VNDK
@ -826,6 +820,25 @@ func apexInfoMutator(mctx android.TopDownMutatorContext) {
})
}
type ApexInfoMutator interface {
// ApexInfoMutator implementations must call BuildForApex(ApexInfo) on any modules that are
// depended upon by an apex and which require an apex specific variant.
ApexInfoMutator(android.TopDownMutatorContext)
}
// apexInfoMutator delegates the work of identifying which modules need an ApexInfo and apex
// specific variant to modules that support the ApexInfoMutator.
func apexInfoMutator(mctx android.TopDownMutatorContext) {
if !mctx.Module().Enabled() {
return
}
if a, ok := mctx.Module().(ApexInfoMutator); ok {
a.ApexInfoMutator(mctx)
return
}
}
// apexUniqueVariationsMutator checks if any dependencies use unique apex variations. If so, use
// unique apex variations for this module. See android/apex.go for more about unique apex variant.
// TODO(jiyong): move this to android/apex.go?
@ -2165,7 +2178,7 @@ func baselineApexAvailable(apex, moduleName string) bool {
func normalizeModuleName(moduleName string) string {
// Prebuilt modules (e.g. java_import, etc.) have "prebuilt_" prefix added by the build
// system. Trim the prefix for the check since they are confusing
moduleName = strings.TrimPrefix(moduleName, "prebuilt_")
moduleName = android.RemoveOptionalPrebuiltPrefix(moduleName)
if strings.HasPrefix(moduleName, "libclang_rt.") {
// This module has many arch variants that depend on the product being built.
// We don't want to list them all

View File

@ -2749,7 +2749,7 @@ func orderStaticModuleDeps(staticDeps []StaticLibraryInfo, sharedDeps []SharedLi
func baseLibName(depName string) string {
libName := strings.TrimSuffix(depName, llndkLibrarySuffix)
libName = strings.TrimSuffix(libName, vendorPublicLibrarySuffix)
libName = strings.TrimPrefix(libName, "prebuilt_")
libName = android.RemoveOptionalPrebuiltPrefix(libName)
return libName
}