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.
Bug: 153698496
Test: m
Change-Id: Id576c4318d9d69246a4a7e2fb4145d5fd2ab9416
diff --git a/cc/library.go b/cc/library.go
index c7488ee..46cccb0 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -1486,10 +1486,18 @@
}
}
-// 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()
normalizeVersions(mctx, versions)
@@ -1525,7 +1533,7 @@
}
if genrule, ok := mctx.Module().(*genrule.Module); ok {
if _, ok := genrule.Extra.(*GenruleExtraProperties); ok {
- if !genrule.InRecovery() {
+ if VersionVariantAvailable(genrule) {
mctx.CreateVariations("")
return
}