Add method to determine variations from a Target
The arch variants are hardcoded in every module type. Refactor
them out into a Target.Variations() method in preparation for
splitting the arch mutator into two, which will require using
different variations.
Test: m checkbuild
Change-Id: I28ef7cd5168095ac888fe77f04e27f9ad81978c0
diff --git a/android/arch.go b/android/arch.go
index 348b064..5887744 100644
--- a/android/arch.go
+++ b/android/arch.go
@@ -22,9 +22,12 @@
"strconv"
"strings"
+ "github.com/google/blueprint"
"github.com/google/blueprint/proptools"
)
+const COMMON_VARIANT = "common"
+
var (
archTypeList []ArchType
@@ -36,7 +39,7 @@
X86_64 = newArch("x86_64", "lib64")
Common = ArchType{
- Name: "common",
+ Name: COMMON_VARIANT,
}
)
@@ -702,11 +705,23 @@
}
func (target Target) String() string {
- variant := ""
+ return target.ArchVariation()
+}
+
+func (target Target) ArchVariation() string {
+ var variation string
if target.NativeBridge {
- variant = "native_bridge_"
+ variation = "native_bridge_"
}
- return target.Os.String() + "_" + variant + target.Arch.String()
+ variation += target.Arch.String()
+
+ return target.Os.String() + "_" + variation
+}
+
+func (target Target) Variations() []blueprint.Variation {
+ return []blueprint.Variation{
+ {Mutator: "arch", Variation: target.ArchVariation()},
+ }
}
// archMutator splits a module into a variant for each Target requested by the module. Target selection