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
This commit is contained in:
Colin Cross
2023-11-21 15:13:56 -08:00
parent 80117e6c4f
commit 312634eb0f
7 changed files with 91 additions and 50 deletions

View File

@@ -264,6 +264,16 @@ var (
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 TransformZipAlign(ctx android.ModuleContext, outputFile android.WritablePat
})
}
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 {