Support transitive proguard specs in android_library_import
Add support for android_library_import to propagate the proguard specs
from its static dependencies.
Bug: 326265727
Test: TestExportedProguardFlagFiles
Change-Id: I174c1d7937a529958f8d240214b279062ef74868
diff --git a/java/base.go b/java/base.go
index be286fe..838574d 100644
--- a/java/base.go
+++ b/java/base.go
@@ -1757,10 +1757,7 @@
return android.InList("androidx.compose.runtime_runtime", j.properties.Static_libs)
}
-func (j *Module) collectProguardSpecInfo(ctx android.ModuleContext) ProguardSpecInfo {
- transitiveUnconditionalExportedFlags := []*android.DepSet[android.Path]{}
- transitiveProguardFlags := []*android.DepSet[android.Path]{}
-
+func collectDepProguardSpecInfo(ctx android.ModuleContext) (transitiveProguardFlags, transitiveUnconditionalExportedFlags []*android.DepSet[android.Path]) {
ctx.VisitDirectDeps(func(m android.Module) {
depProguardInfo, _ := android.OtherModuleProvider(ctx, m, ProguardSpecInfoProvider)
depTag := ctx.OtherModuleDependencyTag(m)
@@ -1775,6 +1772,12 @@
}
})
+ return transitiveProguardFlags, transitiveUnconditionalExportedFlags
+}
+
+func (j *Module) collectProguardSpecInfo(ctx android.ModuleContext) ProguardSpecInfo {
+ transitiveProguardFlags, transitiveUnconditionalExportedFlags := collectDepProguardSpecInfo(ctx)
+
directUnconditionalExportedFlags := android.Paths{}
proguardFlagsForThisModule := android.PathsForModuleSrc(ctx, j.dexProperties.Optimize.Proguard_flags_files)
exportUnconditionally := proptools.Bool(j.dexProperties.Optimize.Export_proguard_flags_files)