Merge libs/ directory of imported aars into classes.jar
AARs can provide extra classes in the libs/ directory that should be treated the same as classes.jar, merge them into a single jar when extracting the AAR. Bug: 162892721 Test: m androidx.appsearch_appsearch Change-Id: I92bf46f47ce5f3dce16c42197c15ed256304fda2
This commit is contained in:
parent
2eddd06879
commit
205e91183e
11
java/aar.go
11
java/aar.go
|
@ -641,9 +641,11 @@ func (a *AARImport) DepsMutator(ctx android.BottomUpMutatorContext) {
|
|||
var unzipAAR = pctx.AndroidStaticRule("unzipAAR",
|
||||
blueprint.RuleParams{
|
||||
Command: `rm -rf $outDir && mkdir -p $outDir && ` +
|
||||
`unzip -qoDD -d $outDir $in && rm -rf $outDir/res && touch $out`,
|
||||
`unzip -qoDD -d $outDir $in && rm -rf $outDir/res && touch $out && ` +
|
||||
`${config.MergeZipsCmd} $combinedClassesJar $$(ls $outDir/classes.jar 2> /dev/null) $$(ls $outDir/libs/*.jar 2> /dev/null)`,
|
||||
CommandDeps: []string{"${config.MergeZipsCmd}"},
|
||||
},
|
||||
"outDir")
|
||||
"outDir", "combinedClassesJar")
|
||||
|
||||
func (a *AARImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
if len(a.properties.Aars) != 1 {
|
||||
|
@ -661,7 +663,7 @@ func (a *AARImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||
}
|
||||
|
||||
extractedAARDir := android.PathForModuleOut(ctx, "aar")
|
||||
a.classpathFile = extractedAARDir.Join(ctx, "classes.jar")
|
||||
a.classpathFile = extractedAARDir.Join(ctx, "classes-combined.jar")
|
||||
a.proguardFlags = extractedAARDir.Join(ctx, "proguard.txt")
|
||||
a.manifest = extractedAARDir.Join(ctx, "AndroidManifest.xml")
|
||||
|
||||
|
@ -671,7 +673,8 @@ func (a *AARImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||
Outputs: android.WritablePaths{a.classpathFile, a.proguardFlags, a.manifest},
|
||||
Description: "unzip AAR",
|
||||
Args: map[string]string{
|
||||
"outDir": extractedAARDir.String(),
|
||||
"outDir": extractedAARDir.String(),
|
||||
"combinedClassesJar": a.classpathFile.String(),
|
||||
},
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue