Merge "Always use aapt2 --no-static-lib-packages" into main am: 308d64ed72

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2962085

Change-Id: Ida814c476605753b7e43cd90ba5a8e52b9bad0a1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Colin Cross
2024-02-14 20:33:57 +00:00
committed by Automerger Merge Worker

View File

@@ -416,17 +416,11 @@ func (a *aapt) buildActions(ctx android.ModuleContext, opts aaptBuildActionOptio
linkFlags = append(linkFlags, "--static-lib")
}
linkFlags = append(linkFlags, "--no-static-lib-packages")
if a.isLibrary && a.useResourceProcessorBusyBox(ctx) {
// When building an android_library using ResourceProcessorBusyBox the resources are merged into
// package-res.apk with --merge-only, but --no-static-lib-packages is not used so that R.txt only
// contains resources from this library.
// When building an android_library using ResourceProcessorBusyBox pass --merge-only to skip resource
// references validation until the final app link step when all static libraries are present.
linkFlags = append(linkFlags, "--merge-only")
} else {
// When building and app or when building an android_library without ResourceProcessorBusyBox
// --no-static-lib-packages is used to put all the resources into the app. If ResourceProcessorBusyBox
// is used then the app's R.txt will be post-processed along with the R.txt files from dependencies to
// sort resources into the right packages in R.class.
linkFlags = append(linkFlags, "--no-static-lib-packages")
}
packageRes := android.PathForModuleOut(ctx, "package-res.apk")
@@ -1179,6 +1173,7 @@ func (a *AARImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
"--static-lib",
"--merge-only",
"--auto-add-overlay",
"--no-static-lib-packages",
}
linkFlags = append(linkFlags, "--manifest "+a.manifest.String())