Merge changes Iaca95efc,I7ccd5581 am: 57fab96e01
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1526698 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I16c80afa62210ad93b2f043812f689c082ba2488
This commit is contained in:
@@ -17,6 +17,7 @@ package android
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
"github.com/google/blueprint"
|
||||||
"github.com/google/blueprint/proptools"
|
"github.com/google/blueprint/proptools"
|
||||||
@@ -74,6 +75,12 @@ type Prebuilt struct {
|
|||||||
srcsPropertyName string
|
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 {
|
func (p *Prebuilt) Name(name string) string {
|
||||||
return "prebuilt_" + name
|
return "prebuilt_" + name
|
||||||
}
|
}
|
||||||
|
35
apex/apex.go
35
apex/apex.go
@@ -728,7 +728,9 @@ type ApexBundleInfo struct {
|
|||||||
|
|
||||||
var ApexBundleInfoProvider = blueprint.NewMutatorProvider(ApexBundleInfo{}, "apex_info")
|
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
|
// 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
|
// 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
|
// 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 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
|
// The relationship between module variants and apexes is not one-to-one as variants will be
|
||||||
// shared between compatible apexes.
|
// shared between compatible apexes.
|
||||||
func apexInfoMutator(mctx android.TopDownMutatorContext) {
|
func (a *apexBundle) ApexInfoMutator(mctx android.TopDownMutatorContext) {
|
||||||
if !mctx.Module().Enabled() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
a, ok := mctx.Module().(*apexBundle)
|
|
||||||
if !ok {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// The VNDK APEX is special. For the APEX, the membership is described in a very different
|
// 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
|
// 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
|
// 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.
|
// unique apex variations for this module. See android/apex.go for more about unique apex variant.
|
||||||
// TODO(jiyong): move this to android/apex.go?
|
// TODO(jiyong): move this to android/apex.go?
|
||||||
@@ -2165,7 +2178,7 @@ func baselineApexAvailable(apex, moduleName string) bool {
|
|||||||
func normalizeModuleName(moduleName string) string {
|
func normalizeModuleName(moduleName string) string {
|
||||||
// Prebuilt modules (e.g. java_import, etc.) have "prebuilt_" prefix added by the build
|
// 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
|
// 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.") {
|
if strings.HasPrefix(moduleName, "libclang_rt.") {
|
||||||
// This module has many arch variants that depend on the product being built.
|
// This module has many arch variants that depend on the product being built.
|
||||||
// We don't want to list them all
|
// We don't want to list them all
|
||||||
|
2
cc/cc.go
2
cc/cc.go
@@ -2749,7 +2749,7 @@ func orderStaticModuleDeps(staticDeps []StaticLibraryInfo, sharedDeps []SharedLi
|
|||||||
func baseLibName(depName string) string {
|
func baseLibName(depName string) string {
|
||||||
libName := strings.TrimSuffix(depName, llndkLibrarySuffix)
|
libName := strings.TrimSuffix(depName, llndkLibrarySuffix)
|
||||||
libName = strings.TrimSuffix(libName, vendorPublicLibrarySuffix)
|
libName = strings.TrimSuffix(libName, vendorPublicLibrarySuffix)
|
||||||
libName = strings.TrimPrefix(libName, "prebuilt_")
|
libName = android.RemoveOptionalPrebuiltPrefix(libName)
|
||||||
return libName
|
return libName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user