Merge "Add jetifier support to android_library_import" am: ff8838cb86
am: 43dea5e3d8
am: f5005f5adb
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1451138 Change-Id: Ib2e2ec400c28b2a5d4cf467823fb3ac64c74179d
This commit is contained in:
30
java/aar.go
30
java/aar.go
@@ -607,6 +607,22 @@ type AARImport struct {
|
|||||||
exportedStaticPackages android.Paths
|
exportedStaticPackages android.Paths
|
||||||
|
|
||||||
hideApexVariantFromMake bool
|
hideApexVariantFromMake bool
|
||||||
|
|
||||||
|
aarPath android.Path
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ android.OutputFileProducer = (*AARImport)(nil)
|
||||||
|
|
||||||
|
// For OutputFileProducer interface
|
||||||
|
func (a *AARImport) OutputFiles(tag string) (android.Paths, error) {
|
||||||
|
switch tag {
|
||||||
|
case ".aar":
|
||||||
|
return []android.Path{a.aarPath}, nil
|
||||||
|
case "":
|
||||||
|
return []android.Path{a.classpathFile}, nil
|
||||||
|
default:
|
||||||
|
return nil, fmt.Errorf("unsupported module reference tag %q", tag)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *AARImport) sdkVersion() sdkSpec {
|
func (a *AARImport) sdkVersion() sdkSpec {
|
||||||
@@ -714,12 +730,12 @@ func (a *AARImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
a.hideApexVariantFromMake = !ctx.Provider(android.ApexInfoProvider).(android.ApexInfo).IsForPlatform()
|
a.hideApexVariantFromMake = !ctx.Provider(android.ApexInfoProvider).(android.ApexInfo).IsForPlatform()
|
||||||
|
|
||||||
aarName := ctx.ModuleName() + ".aar"
|
aarName := ctx.ModuleName() + ".aar"
|
||||||
var aar android.Path
|
a.aarPath = android.PathForModuleSrc(ctx, a.properties.Aars[0])
|
||||||
aar = android.PathForModuleSrc(ctx, a.properties.Aars[0])
|
|
||||||
if Bool(a.properties.Jetifier) {
|
if Bool(a.properties.Jetifier) {
|
||||||
inputFile := aar
|
inputFile := a.aarPath
|
||||||
aar = android.PathForModuleOut(ctx, "jetifier", aarName)
|
a.aarPath = android.PathForModuleOut(ctx, "jetifier", aarName)
|
||||||
TransformJetifier(ctx, aar.(android.WritablePath), inputFile)
|
TransformJetifier(ctx, a.aarPath.(android.WritablePath), inputFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
extractedAARDir := android.PathForModuleOut(ctx, "aar")
|
extractedAARDir := android.PathForModuleOut(ctx, "aar")
|
||||||
@@ -729,7 +745,7 @@ func (a *AARImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
|
|
||||||
ctx.Build(pctx, android.BuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: unzipAAR,
|
Rule: unzipAAR,
|
||||||
Input: aar,
|
Input: a.aarPath,
|
||||||
Outputs: android.WritablePaths{a.classpathFile, a.proguardFlags, a.manifest},
|
Outputs: android.WritablePaths{a.classpathFile, a.proguardFlags, a.manifest},
|
||||||
Description: "unzip AAR",
|
Description: "unzip AAR",
|
||||||
Args: map[string]string{
|
Args: map[string]string{
|
||||||
@@ -743,7 +759,7 @@ func (a *AARImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
compileFlags := []string{"--pseudo-localize"}
|
compileFlags := []string{"--pseudo-localize"}
|
||||||
compiledResDir := android.PathForModuleOut(ctx, "flat-res")
|
compiledResDir := android.PathForModuleOut(ctx, "flat-res")
|
||||||
flata := compiledResDir.Join(ctx, "gen_res.flata")
|
flata := compiledResDir.Join(ctx, "gen_res.flata")
|
||||||
aapt2CompileZip(ctx, flata, aar, "res", compileFlags)
|
aapt2CompileZip(ctx, flata, a.aarPath, "res", compileFlags)
|
||||||
|
|
||||||
a.exportPackage = android.PathForModuleOut(ctx, "package-res.apk")
|
a.exportPackage = android.PathForModuleOut(ctx, "package-res.apk")
|
||||||
// the subdir "android" is required to be filtered by package names
|
// the subdir "android" is required to be filtered by package names
|
||||||
|
Reference in New Issue
Block a user