Merge "Remove version_selector mutator" am: 7f5b4e3229
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2060089 Change-Id: If6a21b33e7fcf3c9732b0220a15018114c9b5603 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
3
cc/cc.go
3
cc/cc.go
@@ -48,7 +48,6 @@ func RegisterCCBuildComponents(ctx android.RegistrationContext) {
|
|||||||
ctx.BottomUp("vndk", VndkMutator).Parallel()
|
ctx.BottomUp("vndk", VndkMutator).Parallel()
|
||||||
ctx.BottomUp("link", LinkageMutator).Parallel()
|
ctx.BottomUp("link", LinkageMutator).Parallel()
|
||||||
ctx.BottomUp("test_per_src", TestPerSrcMutator).Parallel()
|
ctx.BottomUp("test_per_src", TestPerSrcMutator).Parallel()
|
||||||
ctx.BottomUp("version_selector", versionSelectorMutator).Parallel()
|
|
||||||
ctx.BottomUp("version", versionMutator).Parallel()
|
ctx.BottomUp("version", versionMutator).Parallel()
|
||||||
ctx.BottomUp("begin", BeginMutator).Parallel()
|
ctx.BottomUp("begin", BeginMutator).Parallel()
|
||||||
ctx.BottomUp("sysprop_cc", SyspropMutator).Parallel()
|
ctx.BottomUp("sysprop_cc", SyspropMutator).Parallel()
|
||||||
@@ -2117,7 +2116,7 @@ func AddSharedLibDependenciesWithVersions(ctx android.BottomUpMutatorContext, mo
|
|||||||
|
|
||||||
variations = append([]blueprint.Variation(nil), variations...)
|
variations = append([]blueprint.Variation(nil), variations...)
|
||||||
|
|
||||||
if version != "" && CanBeOrLinkAgainstVersionVariants(mod) {
|
if version != "" && canBeOrLinkAgainstVersionVariants(mod) {
|
||||||
// Version is explicitly specified. i.e. libFoo#30
|
// Version is explicitly specified. i.e. libFoo#30
|
||||||
variations = append(variations, blueprint.Variation{Mutator: "version", Variation: version})
|
variations = append(variations, blueprint.Variation{Mutator: "version", Variation: version})
|
||||||
if tag, ok := depTag.(libraryDependencyTag); ok {
|
if tag, ok := depTag.(libraryDependencyTag); ok {
|
||||||
|
@@ -2344,7 +2344,7 @@ func createPerApiVersionVariations(mctx android.BottomUpMutatorContext, minSdkVe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func CanBeOrLinkAgainstVersionVariants(module interface {
|
func canBeOrLinkAgainstVersionVariants(module interface {
|
||||||
Host() bool
|
Host() bool
|
||||||
InRamdisk() bool
|
InRamdisk() bool
|
||||||
InVendorRamdisk() bool
|
InVendorRamdisk() bool
|
||||||
@@ -2352,15 +2352,14 @@ func CanBeOrLinkAgainstVersionVariants(module interface {
|
|||||||
return !module.Host() && !module.InRamdisk() && !module.InVendorRamdisk()
|
return !module.Host() && !module.InRamdisk() && !module.InVendorRamdisk()
|
||||||
}
|
}
|
||||||
|
|
||||||
func CanBeVersionVariant(module interface {
|
func canBeVersionVariant(module interface {
|
||||||
Host() bool
|
Host() bool
|
||||||
InRamdisk() bool
|
InRamdisk() bool
|
||||||
InVendorRamdisk() bool
|
InVendorRamdisk() bool
|
||||||
InRecovery() bool
|
|
||||||
CcLibraryInterface() bool
|
CcLibraryInterface() bool
|
||||||
Shared() bool
|
Shared() bool
|
||||||
}) bool {
|
}) bool {
|
||||||
return CanBeOrLinkAgainstVersionVariants(module) &&
|
return canBeOrLinkAgainstVersionVariants(module) &&
|
||||||
module.CcLibraryInterface() && module.Shared()
|
module.CcLibraryInterface() && module.Shared()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2371,37 +2370,41 @@ func moduleLibraryInterface(module blueprint.Module) libraryInterface {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// versionSelector normalizes the versions in the Stubs.Versions property into MutatedProperties.AllStubsVersions.
|
// setStubsVersions normalizes the versions in the Stubs.Versions property into MutatedProperties.AllStubsVersions.
|
||||||
func versionSelectorMutator(mctx android.BottomUpMutatorContext) {
|
func setStubsVersions(mctx android.BottomUpMutatorContext, library libraryInterface, module *Module) {
|
||||||
if library := moduleLibraryInterface(mctx.Module()); library != nil && CanBeVersionVariant(mctx.Module().(*Module)) {
|
if !library.buildShared() || !canBeVersionVariant(module) {
|
||||||
if library.buildShared() {
|
return
|
||||||
versions := library.stubsVersions(mctx)
|
|
||||||
if len(versions) > 0 {
|
|
||||||
normalizeVersions(mctx, versions)
|
|
||||||
if mctx.Failed() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// Set the versions on the pre-mutated module so they can be read by any llndk modules that
|
|
||||||
// depend on the implementation library and haven't been mutated yet.
|
|
||||||
library.setAllStubsVersions(versions)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
versions := library.stubsVersions(mctx)
|
||||||
|
if len(versions) <= 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
normalizeVersions(mctx, versions)
|
||||||
|
if mctx.Failed() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// Set the versions on the pre-mutated module so they can be read by any llndk modules that
|
||||||
|
// depend on the implementation library and haven't been mutated yet.
|
||||||
|
library.setAllStubsVersions(versions)
|
||||||
}
|
}
|
||||||
|
|
||||||
// versionMutator splits a module into the mandatory non-stubs variant
|
// versionMutator splits a module into the mandatory non-stubs variant
|
||||||
// (which is unnamed) and zero or more stubs variants.
|
// (which is unnamed) and zero or more stubs variants.
|
||||||
func versionMutator(mctx android.BottomUpMutatorContext) {
|
func versionMutator(mctx android.BottomUpMutatorContext) {
|
||||||
if library := moduleLibraryInterface(mctx.Module()); library != nil && CanBeVersionVariant(mctx.Module().(*Module)) {
|
if mctx.Os() != android.Android {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
m, ok := mctx.Module().(*Module)
|
||||||
|
if library := moduleLibraryInterface(mctx.Module()); library != nil && canBeVersionVariant(m) {
|
||||||
|
setStubsVersions(mctx, library, m)
|
||||||
|
|
||||||
createVersionVariations(mctx, library.allStubsVersions())
|
createVersionVariations(mctx, library.allStubsVersions())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if m, ok := mctx.Module().(*Module); ok {
|
if ok {
|
||||||
if m.SplitPerApiLevel() && m.IsSdkVariant() {
|
if m.SplitPerApiLevel() && m.IsSdkVariant() {
|
||||||
if mctx.Os() != android.Android {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
createPerApiVersionVariations(mctx, m.MinSdkVersion())
|
createPerApiVersionVariations(mctx, m.MinSdkVersion())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user