diff --git a/android/makevars.go b/android/makevars.go index 366bb6b61..2c2fb6f3c 100644 --- a/android/makevars.go +++ b/android/makevars.go @@ -92,10 +92,6 @@ func RegisterMakeVarsProvider(pctx PackageContext, provider MakeVarsProvider) { /////////////////////////////////////////////////////////////////////////////// -func init() { - RegisterSingletonType("makevars", makeVarsSingletonFunc) -} - func makeVarsSingletonFunc() Singleton { return &makeVarsSingleton{} } diff --git a/android/register.go b/android/register.go index 6c88af11e..10e14fe02 100644 --- a/android/register.go +++ b/android/register.go @@ -99,5 +99,9 @@ func (ctx *Context) Register() { registerMutators(ctx.Context, preArch, preDeps, postDeps) + // Register makevars after other singletons so they can export values through makevars + ctx.RegisterSingletonType("makevars", SingletonFactoryAdaptor(makeVarsSingletonFunc)) + + // Register env last so that it can track all used environment variables ctx.RegisterSingletonType("env", SingletonFactoryAdaptor(EnvSingleton)) }