Don't generate aapt2 srcjars when using resource processor

When using resource processor the R.class files are generated
directly, and the R.java files generated by aapt2 are unused.  These
files can huge, reaching 500 MB for some modules and 76 GB across
all modules for a checkbuild on internal main.  They will be deleted
after zipping into srcjars after Ie5143e1e4b36ca1f4e45b001d79aca5379063517,
but we can skip generating them completely for modules where resource
processor is used.

Bug: 284023594
Bug: 294285775
Test: m checkbuild
Change-Id: If5e3fd1d25c6c7860898776ecdd392be8850c17c
This commit is contained in:
Colin Cross
2023-08-02 15:49:00 -07:00
parent 3b1e71c958
commit f3b7bada56
3 changed files with 73 additions and 34 deletions

View File

@@ -1022,7 +1022,13 @@ func (a *AndroidApp) OutputFiles(tag string) (android.Paths, error) {
case ".aapt.proguardOptionsFile":
return []android.Path{a.proguardOptionsFile}, nil
case ".aapt.srcjar":
return []android.Path{a.aaptSrcJar}, nil
if a.aaptSrcJar != nil {
return []android.Path{a.aaptSrcJar}, nil
}
case ".aapt.jar":
if a.rJar != nil {
return []android.Path{a.rJar}, nil
}
case ".export-package.apk":
return []android.Path{a.exportPackage}, nil
}