Skip version mutator for host/ramdisk/recovery
"version" mutator creates stubs variants for "cc" libraries with
"stubs.versions". These stubs are for APEX-APEX or APEX-Platform
boundaries.
For host/ramdisk/recovery variants, stubs are not necessary.
Exempt-From-Owner-Approval: cp from internal
Bug: 153698496
Test: m
Merged-In: Id576c4318d9d69246a4a7e2fb4145d5fd2ab9416
Change-Id: Id576c4318d9d69246a4a7e2fb4145d5fd2ab9416
(cherry picked from commit c40b5193fe
)
This commit is contained in:
@@ -1528,10 +1528,18 @@ func createVersionVariations(mctx android.BottomUpMutatorContext, versions []str
|
||||
}
|
||||
}
|
||||
|
||||
// Version mutator splits a module into the mandatory non-stubs variant
|
||||
func VersionVariantAvailable(module interface {
|
||||
Host() bool
|
||||
InRamdisk() bool
|
||||
InRecovery() bool
|
||||
}) bool {
|
||||
return !module.Host() && !module.InRamdisk() && !module.InRecovery()
|
||||
}
|
||||
|
||||
// VersionMutator splits a module into the mandatory non-stubs variant
|
||||
// (which is unnamed) and zero or more stubs variants.
|
||||
func VersionMutator(mctx android.BottomUpMutatorContext) {
|
||||
if library, ok := mctx.Module().(LinkableInterface); ok && !library.InRecovery() {
|
||||
if library, ok := mctx.Module().(LinkableInterface); ok && VersionVariantAvailable(library) {
|
||||
if library.CcLibrary() && library.BuildSharedVariant() && len(library.StubsVersions()) > 0 {
|
||||
versions := library.StubsVersions()
|
||||
checkVersions(mctx, versions)
|
||||
@@ -1567,7 +1575,7 @@ func VersionMutator(mctx android.BottomUpMutatorContext) {
|
||||
}
|
||||
if genrule, ok := mctx.Module().(*genrule.Module); ok {
|
||||
if _, ok := genrule.Extra.(*GenruleExtraProperties); ok {
|
||||
if !genrule.InRecovery() {
|
||||
if VersionVariantAvailable(genrule) {
|
||||
mctx.CreateVariations("")
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user