diff --git a/apex/key.go b/apex/key.go index 4c83861b2..5d7c2fa34 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()) }