Don't write transitive dependencies to Android-${TARGET_PRODUCT}.mk
Java libraries were writing lists of files that changed whenever
transitive dependencies changed to Android-${TARGET_PRODUCT}.mk, causing
Kati analysis to rerun whenever a dependency was changed in Soong.
In both cases, Make would immediately use the list to write a single
output file. Write the files in Soong and pass the path to the file
to Make instead, which will both reduce the size of
Android-${TARGET_PRODUCT}.mk and skip Kati analysis more often.
Bug: 309006256
Test: m checkbuild
Change-Id: I5dff16c6fb7cca8c6da927b37c612c7b1d0954e6
diff --git a/java/builder.go b/java/builder.go
index ee7e225..d03c8e5 100644
--- a/java/builder.go
+++ b/java/builder.go
@@ -264,6 +264,16 @@
Command: `${config.Zip2ZipCmd} -i ${in} -o ${out} -x 'META-INF/services/**/*'`,
CommandDeps: []string{"${config.Zip2ZipCmd}"},
})
+
+ writeCombinedProguardFlagsFileRule = pctx.AndroidStaticRule("writeCombinedProguardFlagsFileRule",
+ blueprint.RuleParams{
+ Command: `rm -f $out && ` +
+ `for f in $in; do ` +
+ ` echo && ` +
+ ` echo "# including $$f" && ` +
+ ` cat $$f; ` +
+ `done > $out`,
+ })
)
func init() {
@@ -686,6 +696,15 @@
})
}
+func writeCombinedProguardFlagsFile(ctx android.ModuleContext, outputFile android.WritablePath, files android.Paths) {
+ ctx.Build(pctx, android.BuildParams{
+ Rule: writeCombinedProguardFlagsFileRule,
+ Description: "write combined proguard flags file",
+ Inputs: files,
+ Output: outputFile,
+ })
+}
+
type classpath android.Paths
func (x *classpath) formJoinedClassPath(optName string, sep string) string {