Collect dist contributions from makeVarsInitProviders
Modules can export make vars not only using `MakeVars(...)`, but also
using `RegisterMakeVarsProvider(...)`. This change adds support for
soong only build to collect dist contributions added via custom
functions that are registed via `RegisterMakeVarsProvider(...)`.
Test: m droid dist --soong-only
Bug: 394365683
Change-Id: If5560ca32f2136ee41d24e2f6c08ad8ec954e5d6
diff --git a/android/androidmk.go b/android/androidmk.go
index cf1589d..72c3819 100644
--- a/android/androidmk.go
+++ b/android/androidmk.go
@@ -762,6 +762,17 @@
func (c *androidMkSingleton) soongOnlyBuildActions(ctx SingletonContext, mods []blueprint.Module) {
allDistContributions, moduleInfoJSONs := getSoongOnlyDataFromMods(ctx, mods)
+ for _, provider := range makeVarsInitProviders {
+ mctx := &makeVarsContext{
+ SingletonContext: ctx,
+ pctx: provider.pctx,
+ }
+ provider.call(mctx)
+ if contribution := getMakeVarsDistContributions(mctx); contribution != nil {
+ allDistContributions = append(allDistContributions, *contribution)
+ }
+ }
+
// Build module-info.json. Only in builds with HasDeviceProduct(), as we need a named
// device to have a TARGET_OUT folder.
if ctx.Config().HasDeviceProduct() {