Support "." in cpu and arch variant names
cortex-a53.a57 is a valid cpu variant, and needs to be translated to
cortex_a53_a57 when used as a field name. Replace
dashToUnderscoreReplacer with a replacer that also converts "." to "_".
Change-Id: I1c496249b50d8e3a8d2bd830bc890f43ad9ee29e
diff --git a/common/arch.go b/common/arch.go
index 37f7c38..1d7d0de 100644
--- a/common/arch.go
+++ b/common/arch.go
@@ -581,7 +581,7 @@
return m, allProperties
}
-var dashToUnderscoreReplacer = strings.NewReplacer("-", "_")
+var variantReplacer = strings.NewReplacer("-", "_", ".", "_")
func (a *AndroidModuleBase) appendProperties(ctx AndroidBottomUpMutatorContext,
dst, src interface{}, field, srcPrefix string) interface{} {
@@ -660,7 +660,7 @@
// key: value,
// },
// },
- v := dashToUnderscoreReplacer.Replace(arch.ArchVariant)
+ v := variantReplacer.Replace(arch.ArchVariant)
if v != "" {
field := proptools.FieldNameForProperty(v)
prefix := "arch." + t.Name + "." + v
@@ -673,7 +673,7 @@
// key: value,
// },
// },
- c := dashToUnderscoreReplacer.Replace(arch.CpuVariant)
+ c := variantReplacer.Replace(arch.CpuVariant)
if c != "" {
field := proptools.FieldNameForProperty(c)
prefix := "arch." + t.Name + "." + c