Add jetifier support in Soong.
This is a blocker for droiddoc targets migration under vendor/.
Test: N/A
Bug: b/72552006
Change-Id: If85a0917c1ac0d88b9d5b488216a638b4dabd39f
diff --git a/java/aar.go b/java/aar.go
index e6a412c..175e794 100644
--- a/java/aar.go
+++ b/java/aar.go
@@ -375,6 +375,9 @@
Static_libs []string
Libs []string
+
+ // if set to true, run Jetifier against .aar file. Defaults to false.
+ Jetifier_enabled *bool
}
type AARImport struct {
@@ -456,7 +459,14 @@
return
}
- aar := android.PathForModuleSrc(ctx, a.properties.Aars[0])
+ aarName := ctx.ModuleName() + ".aar"
+ var aar android.Path
+ aar = android.PathForModuleSrc(ctx, a.properties.Aars[0])
+ if Bool(a.properties.Jetifier_enabled) {
+ inputFile := aar
+ aar = android.PathForModuleOut(ctx, "jetifier", aarName)
+ TransformJetifier(ctx, aar.(android.WritablePath), inputFile)
+ }
extractedAARDir := android.PathForModuleOut(ctx, "aar")
extractedResDir := extractedAARDir.Join(ctx, "res")