Allow overriding android_library_import manifests
Some of the androidx libraries have a transformed manifest alongside that needs to be used to avoid introducing extra androidx.startup provider entries. Add a manifest property that allows overriding the manifest provided by the aar file. Bug: 336549758 Test: examine PermissionController.apk Ignore-AOSP-First: submitting in topic with internal CL Merged-In: I5c8daf810d2fde9a150cbfe48b4f4216f5d1ba0d Change-Id: I5c8daf810d2fde9a150cbfe48b4f4216f5d1ba0d
This commit is contained in:
committed by
Android Build Cherrypicker Worker
parent
473b3557f1
commit
21ed4694c5
17
java/aar.go
17
java/aar.go
@@ -971,6 +971,9 @@ type AARImportProperties struct {
|
|||||||
// will be passed transitively through android_libraries to an android_app.
|
// will be passed transitively through android_libraries to an android_app.
|
||||||
//TODO(b/241138093) evaluate whether we can have this flag default to true for Bazel conversion
|
//TODO(b/241138093) evaluate whether we can have this flag default to true for Bazel conversion
|
||||||
Extract_jni *bool
|
Extract_jni *bool
|
||||||
|
|
||||||
|
// If set, overrides the manifest extracted from the AAR with the provided path.
|
||||||
|
Manifest *string `android:"path"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type AARImport struct {
|
type AARImport struct {
|
||||||
@@ -993,7 +996,7 @@ type AARImport struct {
|
|||||||
exportPackage android.WritablePath
|
exportPackage android.WritablePath
|
||||||
transitiveAaptResourcePackagesFile android.Path
|
transitiveAaptResourcePackagesFile android.Path
|
||||||
extraAaptPackagesFile android.WritablePath
|
extraAaptPackagesFile android.WritablePath
|
||||||
manifest android.WritablePath
|
manifest android.Path
|
||||||
assetsPackage android.WritablePath
|
assetsPackage android.WritablePath
|
||||||
rTxt android.WritablePath
|
rTxt android.WritablePath
|
||||||
rJar android.WritablePath
|
rJar android.WritablePath
|
||||||
@@ -1169,7 +1172,15 @@ func (a *AARImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
jarName := ctx.ModuleName() + ".jar"
|
jarName := ctx.ModuleName() + ".jar"
|
||||||
extractedAARDir := android.PathForModuleOut(ctx, "aar")
|
extractedAARDir := android.PathForModuleOut(ctx, "aar")
|
||||||
classpathFile := extractedAARDir.Join(ctx, jarName)
|
classpathFile := extractedAARDir.Join(ctx, jarName)
|
||||||
a.manifest = extractedAARDir.Join(ctx, "AndroidManifest.xml")
|
|
||||||
|
extractedManifest := extractedAARDir.Join(ctx, "AndroidManifest.xml")
|
||||||
|
providedManifest := android.OptionalPathForModuleSrc(ctx, a.properties.Manifest)
|
||||||
|
if providedManifest.Valid() {
|
||||||
|
a.manifest = providedManifest.Path()
|
||||||
|
} else {
|
||||||
|
a.manifest = extractedManifest
|
||||||
|
}
|
||||||
|
|
||||||
a.rTxt = extractedAARDir.Join(ctx, "R.txt")
|
a.rTxt = extractedAARDir.Join(ctx, "R.txt")
|
||||||
a.assetsPackage = android.PathForModuleOut(ctx, "assets.zip")
|
a.assetsPackage = android.PathForModuleOut(ctx, "assets.zip")
|
||||||
a.proguardFlags = extractedAARDir.Join(ctx, "proguard.txt")
|
a.proguardFlags = extractedAARDir.Join(ctx, "proguard.txt")
|
||||||
@@ -1190,7 +1201,7 @@ func (a *AARImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
ctx.Build(pctx, android.BuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: unzipAAR,
|
Rule: unzipAAR,
|
||||||
Input: a.aarPath,
|
Input: a.aarPath,
|
||||||
Outputs: android.WritablePaths{classpathFile, a.proguardFlags, a.manifest, a.assetsPackage, a.rTxt},
|
Outputs: android.WritablePaths{classpathFile, a.proguardFlags, extractedManifest, a.assetsPackage, a.rTxt},
|
||||||
Description: "unzip AAR",
|
Description: "unzip AAR",
|
||||||
Args: map[string]string{
|
Args: map[string]string{
|
||||||
"outDir": extractedAARDir.String(),
|
"outDir": extractedAARDir.String(),
|
||||||
|
Reference in New Issue
Block a user