Don't gather dist contributions from disabled entries
Without this, on internal, we see errors about duplicate ninja rules
disting files from different variants of a module to the same location
in the dist directory.
Bug: 388312357
Test: On internal, m --soong-only droid dist
Change-Id: Ia3921906ad537176d3e14342ffb5a8cd0863570b
diff --git a/android/androidmk.go b/android/androidmk.go
index 9e721e1..a69cda0 100644
--- a/android/androidmk.go
+++ b/android/androidmk.go
@@ -791,10 +791,20 @@
continue
}
if info, ok := OtherModuleProvider(ctx, mod, AndroidMkInfoProvider); ok {
+ // Deep copy the provider info since we need to modify the info later
+ info := deepCopyAndroidMkProviderInfo(info)
+ info.PrimaryInfo.fillInEntries(ctx, mod)
+ if info.PrimaryInfo.disabled() {
+ continue
+ }
if contribution := info.PrimaryInfo.getDistContributions(ctx, mod); contribution != nil {
allDistContributions = append(allDistContributions, *contribution)
}
for _, ei := range info.ExtraInfo {
+ ei.fillInEntries(ctx, mod)
+ if ei.disabled() {
+ continue
+ }
if contribution := ei.getDistContributions(ctx, mod); contribution != nil {
allDistContributions = append(allDistContributions, *contribution)
}
@@ -809,6 +819,9 @@
}
data.fillInData(ctx, mod)
+ if data.Entries.disabled() {
+ continue
+ }
if contribution := data.Entries.getDistContributions(mod); contribution != nil {
allDistContributions = append(allDistContributions, *contribution)
}
@@ -816,6 +829,9 @@
entriesList := x.AndroidMkEntries()
for _, entries := range entriesList {
entries.fillInEntries(ctx, mod)
+ if entries.disabled() {
+ continue
+ }
if contribution := entries.getDistContributions(mod); contribution != nil {
allDistContributions = append(allDistContributions, *contribution)
}