Merge "Translate --custom-package aapt2 flag for ResourceProcessorBusyBox" into main
This commit is contained in:
17
java/aar.go
17
java/aar.go
@@ -544,7 +544,7 @@ func (a *aapt) buildActions(ctx android.ModuleContext, opts aaptBuildActionOptio
|
|||||||
|
|
||||||
if a.useResourceProcessorBusyBox() {
|
if a.useResourceProcessorBusyBox() {
|
||||||
rJar := android.PathForModuleOut(ctx, "busybox/R.jar")
|
rJar := android.PathForModuleOut(ctx, "busybox/R.jar")
|
||||||
resourceProcessorBusyBoxGenerateBinaryR(ctx, rTxt, a.mergedManifestFile, rJar, staticDeps, a.isLibrary)
|
resourceProcessorBusyBoxGenerateBinaryR(ctx, rTxt, a.mergedManifestFile, rJar, staticDeps, a.isLibrary, a.aaptProperties.Aaptflags)
|
||||||
aapt2ExtractExtraPackages(ctx, extraPackages, rJar)
|
aapt2ExtractExtraPackages(ctx, extraPackages, rJar)
|
||||||
transitiveRJars = append(transitiveRJars, rJar)
|
transitiveRJars = append(transitiveRJars, rJar)
|
||||||
a.rJar = rJar
|
a.rJar = rJar
|
||||||
@@ -604,7 +604,7 @@ var resourceProcessorBusyBox = pctx.AndroidStaticRule("resourceProcessorBusyBox"
|
|||||||
// using Bazel's ResourceProcessorBusyBox tool, which is faster than compiling the R.java files and
|
// using Bazel's ResourceProcessorBusyBox tool, which is faster than compiling the R.java files and
|
||||||
// supports producing classes for static dependencies that only include resources from that dependency.
|
// supports producing classes for static dependencies that only include resources from that dependency.
|
||||||
func resourceProcessorBusyBoxGenerateBinaryR(ctx android.ModuleContext, rTxt, manifest android.Path,
|
func resourceProcessorBusyBoxGenerateBinaryR(ctx android.ModuleContext, rTxt, manifest android.Path,
|
||||||
rJar android.WritablePath, transitiveDeps transitiveAarDeps, isLibrary bool) {
|
rJar android.WritablePath, transitiveDeps transitiveAarDeps, isLibrary bool, aaptFlags []string) {
|
||||||
|
|
||||||
var args []string
|
var args []string
|
||||||
var deps android.Paths
|
var deps android.Paths
|
||||||
@@ -621,6 +621,17 @@ func resourceProcessorBusyBoxGenerateBinaryR(ctx android.ModuleContext, rTxt, ma
|
|||||||
args = append(args, "--finalFields=false")
|
args = append(args, "--finalFields=false")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for i, arg := range aaptFlags {
|
||||||
|
const AAPT_CUSTOM_PACKAGE = "--custom-package"
|
||||||
|
if strings.HasPrefix(arg, AAPT_CUSTOM_PACKAGE) {
|
||||||
|
pkg := strings.TrimSpace(strings.TrimPrefix(arg, AAPT_CUSTOM_PACKAGE))
|
||||||
|
if pkg == "" && i+1 < len(aaptFlags) {
|
||||||
|
pkg = aaptFlags[i+1]
|
||||||
|
}
|
||||||
|
args = append(args, "--packageForR "+pkg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
deps = append(deps, rTxt, manifest)
|
deps = append(deps, rTxt, manifest)
|
||||||
|
|
||||||
ctx.Build(pctx, android.BuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
@@ -1194,7 +1205,7 @@ func (a *AARImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
linkFlags, linkDeps, nil, overlayRes, transitiveAssets, nil, nil)
|
linkFlags, linkDeps, nil, overlayRes, transitiveAssets, nil, nil)
|
||||||
|
|
||||||
a.rJar = android.PathForModuleOut(ctx, "busybox/R.jar")
|
a.rJar = android.PathForModuleOut(ctx, "busybox/R.jar")
|
||||||
resourceProcessorBusyBoxGenerateBinaryR(ctx, a.rTxt, a.manifest, a.rJar, nil, true)
|
resourceProcessorBusyBoxGenerateBinaryR(ctx, a.rTxt, a.manifest, a.rJar, nil, true, nil)
|
||||||
|
|
||||||
aapt2ExtractExtraPackages(ctx, a.extraAaptPackagesFile, a.rJar)
|
aapt2ExtractExtraPackages(ctx, a.extraAaptPackagesFile, a.rJar)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user