aboutsummaryrefslogtreecommitdiffstats
path: root/apex
diff options
context:
space:
mode:
authorJiyong Park <jiyong@google.com>2019-02-20 22:23:29 +0900
committerJiyong Park <jiyong@google.com>2019-02-20 22:26:21 +0900
commit37eb8bbb3a59388473c62abe1e1884c8095edef7 (patch)
treedb51ebb459233754f398d48c41a25bc503ef8632 /apex
parente0233a5bdd560ad567dc716990ab17c3fe0c5a4f (diff)
downloadbuild_soong-37eb8bbb3a59388473c62abe1e1884c8095edef7.tar.gz
build_soong-37eb8bbb3a59388473c62abe1e1884c8095edef7.tar.bz2
build_soong-37eb8bbb3a59388473c62abe1e1884c8095edef7.zip
Export make vars using MakeVars method
ed023eca73ff120de15cbd9f0ebfb9c9af5cdcd6 introduced a new (better) way of exporting make vars from singletone. apex_keys_text singletone is switched to the new method. Test: inspect out/soong/make_vars-<target>.mk Check SOONG_SOONG_APEX_KEYS_FILE is set Change-Id: Ia218852ba9ae40070cb6c99340d97e0c77d19841
Diffstat (limited to 'apex')
-rw-r--r--apex/key.go25
1 files changed, 8 insertions, 17 deletions
diff --git a/apex/key.go b/apex/key.go
index 4c83861b..5d7c2fa3 100644
--- a/apex/key.go
+++ b/apex/key.go
@@ -29,7 +29,6 @@ var String = proptools.String
func init() {
android.RegisterModuleType("apex_key", apexKeyFactory)
android.RegisterSingletonType("apex_keys_text", apexKeysTextFactory)
- android.RegisterMakeVarsProvider(pctx, apexKeysFileProvider)
}
type apexKey struct {
@@ -108,11 +107,12 @@ func (m *apexKey) AndroidMk() android.AndroidMkData {
////////////////////////////////////////////////////////////////////////
// apex_keys_text
-type apexKeysText struct{}
+type apexKeysText struct {
+ output android.OutputPath
+}
func (s *apexKeysText) GenerateBuildActions(ctx android.SingletonContext) {
- output := android.PathForOutput(ctx, "apexkeys.txt")
- *apexKeysFile(ctx.Config()) = output.String()
+ s.output = android.PathForOutput(ctx, "apexkeys.txt")
var filecontent strings.Builder
ctx.VisitAllModules(func(module android.Module) {
if m, ok := module.(android.Module); ok && !m.Enabled() {
@@ -131,27 +131,18 @@ func (s *apexKeysText) GenerateBuildActions(ctx android.SingletonContext) {
})
ctx.Build(pctx, android.BuildParams{
Rule: android.WriteFile,
- Description: "apex_keys.txt",
- Output: output,
+ Description: "apexkeys.txt",
+ Output: s.output,
Args: map[string]string{
"content": filecontent.String(),
},
})
}
-var apexKeysFileKey = android.NewOnceKey("apexKeysFile")
-
-func apexKeysFile(config android.Config) *string {
- return config.Once(apexKeysFileKey, func() interface{} {
- str := ""
- return &str
- }).(*string)
-}
-
func apexKeysTextFactory() android.Singleton {
return &apexKeysText{}
}
-func apexKeysFileProvider(ctx android.MakeVarsContext) {
- ctx.Strict("SOONG_APEX_KEYS_FILE", *apexKeysFile(ctx.Config()))
+func (s *apexKeysText) MakeVars(ctx android.MakeVarsContext) {
+ ctx.Strict("SOONG_APEX_KEYS_FILE", s.output.String())
}