Prepare for a type-safe OnceKey
Add an opaque OnceKey type and use it for all calls to Once in
build/soong. A future patch will convert the arguments to
Once* to OnceKey once users outside build/soong have been updated.
Test: onceper_test.go
Change-Id: Ifcb338e6e603e804e507203c9508d30ffb2df966
diff --git a/cc/library.go b/cc/library.go
index d716ffa..b4b89d2 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -968,8 +968,10 @@
return library.MutatedProperties.StubsVersion
}
+var versioningMacroNamesListKey = android.NewOnceKey("versioningMacroNamesList")
+
func versioningMacroNamesList(config android.Config) *map[string]string {
- return config.Once("versioningMacroNamesList", func() interface{} {
+ return config.Once(versioningMacroNamesListKey, func() interface{} {
m := make(map[string]string)
return &m
}).(*map[string]string)
@@ -1059,9 +1061,11 @@
}
}
+var stubVersionsKey = android.NewOnceKey("stubVersions")
+
// maps a module name to the list of stubs versions available for the module
func stubsVersionsFor(config android.Config) map[string][]string {
- return config.Once("stubVersions", func() interface{} {
+ return config.Once(stubVersionsKey, func() interface{} {
return make(map[string][]string)
}).(map[string][]string)
}