Use local variations for versionsMutator
Use local variations and an alias for the "" variation for versionMutator. Local variations are used here because the variation of one module doesn't affect the variation it should depend on - a module with variation version:29 will manually link against dependencies with the correct version variation, and don't need it to be automatically resolved. The alias allows other modules to depend on a module mutated by the version mutator without specifying the version: "" variation. This allows removing the variation on genrule modules. The motiviation here is to make sure versionMutator calls AliasVariation, which will allow the previous linkageMutator to also use AliasVariation. Bug: 162437057 Test: no change to build.ninja, make_vars-aosp_crosshatch.mk, Android-aosp_crosshatch.mk or late-aosp_crosshatch.mk Change-Id: Ibb030cc4334e47511b8ab5bc3eb8a5ae39ad0023
This commit is contained in:
parent
2eddd06879
commit
094faa5b26
|
@ -28,7 +28,6 @@ import (
|
|||
|
||||
"android/soong/android"
|
||||
"android/soong/cc/config"
|
||||
"android/soong/genrule"
|
||||
)
|
||||
|
||||
type LibraryProperties struct {
|
||||
|
@ -1559,13 +1558,14 @@ func createVersionVariations(mctx android.BottomUpMutatorContext, versions []str
|
|||
// "" is for the non-stubs variant
|
||||
versions = append([]string{""}, versions...)
|
||||
|
||||
modules := mctx.CreateVariations(versions...)
|
||||
modules := mctx.CreateLocalVariations(versions...)
|
||||
for i, m := range modules {
|
||||
if versions[i] != "" {
|
||||
m.(LinkableInterface).SetBuildStubs()
|
||||
m.(LinkableInterface).SetStubsVersions(versions[i])
|
||||
}
|
||||
}
|
||||
mctx.AliasVariation("")
|
||||
}
|
||||
|
||||
func VersionVariantAvailable(module interface {
|
||||
|
@ -1600,7 +1600,7 @@ func VersionMutator(mctx android.BottomUpMutatorContext) {
|
|||
if c, ok := library.(*Module); ok && c.IsStubs() {
|
||||
stubsVersionsLock.Lock()
|
||||
defer stubsVersionsLock.Unlock()
|
||||
// For LLNDK llndk_library, we borrow vstubs.ersions from its implementation library.
|
||||
// For LLNDK llndk_library, we borrow stubs.versions from its implementation library.
|
||||
// Since llndk_library has dependency to its implementation library,
|
||||
// we can safely access stubsVersionsFor() with its baseModuleName.
|
||||
versions := stubsVersionsFor(mctx.Config())[c.BaseModuleName()]
|
||||
|
@ -1611,17 +1611,10 @@ func VersionMutator(mctx android.BottomUpMutatorContext) {
|
|||
return
|
||||
}
|
||||
|
||||
mctx.CreateVariations("")
|
||||
mctx.CreateLocalVariations("")
|
||||
mctx.AliasVariation("")
|
||||
return
|
||||
}
|
||||
if genrule, ok := mctx.Module().(*genrule.Module); ok {
|
||||
if _, ok := genrule.Extra.(*GenruleExtraProperties); ok {
|
||||
if VersionVariantAvailable(genrule) {
|
||||
mctx.CreateVariations("")
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// maybeInjectBoringSSLHash adds a rule to run bssl_inject_hash on the output file if the module has the
|
||||
|
|
Loading…
Reference in New Issue