Pass --remove-tools-declarations to manifest merger
Manifest merger needs --remove-tools-declarations to match Gradle behavior. Bug: 112607039 Test: m checkbuild Change-Id: Id93bcaeaf03770a4acd2e1fdf44e418f55540dd3
This commit is contained in:
@@ -206,7 +206,7 @@ func (a *aapt) buildActions(ctx android.ModuleContext, sdkContext sdkContext, ex
|
||||
a.transitiveManifestPaths = append(android.Paths{manifestPath}, transitiveStaticLibManifests...)
|
||||
|
||||
if len(transitiveStaticLibManifests) > 0 {
|
||||
a.mergedManifestFile = manifestMerger(ctx, manifestPath, transitiveStaticLibManifests)
|
||||
a.mergedManifestFile = manifestMerger(ctx, manifestPath, transitiveStaticLibManifests, a.isLibrary)
|
||||
if !a.isLibrary {
|
||||
// Only use the merged manifest for applications. For libraries, the transitive closure of manifests
|
||||
// will be propagated to the final application and merged there. The merged manifest for libraries is
|
||||
|
@@ -36,10 +36,10 @@ var manifestFixerRule = pctx.AndroidStaticRule("manifestFixer",
|
||||
|
||||
var manifestMergerRule = pctx.AndroidStaticRule("manifestMerger",
|
||||
blueprint.RuleParams{
|
||||
Command: `${config.ManifestMergerCmd} --main $in $libs --out $out`,
|
||||
Command: `${config.ManifestMergerCmd} $args --main $in $libs --out $out`,
|
||||
CommandDeps: []string{"${config.ManifestMergerCmd}"},
|
||||
},
|
||||
"libs")
|
||||
"args", "libs")
|
||||
|
||||
// Uses manifest_fixer.py to inject minSdkVersion, etc. into an AndroidManifest.xml
|
||||
func manifestFixer(ctx android.ModuleContext, manifest android.Path, sdkContext sdkContext,
|
||||
@@ -97,7 +97,15 @@ func manifestFixer(ctx android.ModuleContext, manifest android.Path, sdkContext
|
||||
return fixedManifest
|
||||
}
|
||||
|
||||
func manifestMerger(ctx android.ModuleContext, manifest android.Path, staticLibManifests android.Paths) android.Path {
|
||||
func manifestMerger(ctx android.ModuleContext, manifest android.Path, staticLibManifests android.Paths,
|
||||
isLibrary bool) android.Path {
|
||||
|
||||
var args string
|
||||
if !isLibrary {
|
||||
// Follow Gradle's behavior, only pass --remove-tools-declarations when merging app manifests.
|
||||
args = "--remove-tools-declarations"
|
||||
}
|
||||
|
||||
mergedManifest := android.PathForModuleOut(ctx, "manifest_merger", "AndroidManifest.xml")
|
||||
ctx.Build(pctx, android.BuildParams{
|
||||
Rule: manifestMergerRule,
|
||||
@@ -107,6 +115,7 @@ func manifestMerger(ctx android.ModuleContext, manifest android.Path, staticLibM
|
||||
Output: mergedManifest,
|
||||
Args: map[string]string{
|
||||
"libs": android.JoinWithPrefix(staticLibManifests.Strings(), "--libs "),
|
||||
"args": args,
|
||||
},
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user