summaryrefslogtreecommitdiff
path: root/java/java.go
diff options
context:
space:
mode:
author Nan Zhang <nanzhang@google.com> 2018-08-27 18:31:46 -0700
committer Nan Zhang <nanzhang@google.com> 2018-08-29 11:37:32 -0700
commit4c819fb59064921c2ef71fe1da489b5e3051d0d2 (patch)
treec3ca344376334a18a32686e3074977c869edfd47 /java/java.go
parentfc15390b9cfc7add859cbd77ab7309b96504d924 (diff)
Add jetifier support in Soong.
This is a blocker for droiddoc targets migration under vendor/. Test: N/A Bug: b/72552006 Change-Id: If85a0917c1ac0d88b9d5b488216a638b4dabd39f
Diffstat (limited to 'java/java.go')
-rw-r--r--java/java.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/java/java.go b/java/java.go
index 295863fe7..b911078b5 100644
--- a/java/java.go
+++ b/java/java.go
@@ -1582,6 +1582,9 @@ type ImportProperties struct {
// List of directories to remove from the jar file(s)
Exclude_dirs []string
+
+ // if set to true, run Jetifier against .jar file. Defaults to false.
+ Jetifier_enabled *bool
}
type Import struct {
@@ -1622,9 +1625,15 @@ func (j *Import) DepsMutator(ctx android.BottomUpMutatorContext) {
func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) {
jars := ctx.ExpandSources(j.properties.Jars, nil)
- outputFile := android.PathForModuleOut(ctx, "classes.jar")
+ jarName := ctx.ModuleName() + ".jar"
+ outputFile := android.PathForModuleOut(ctx, "combined", jarName)
TransformJarsToJar(ctx, outputFile, "for prebuilts", jars, android.OptionalPath{},
false, j.properties.Exclude_files, j.properties.Exclude_dirs)
+ if Bool(j.properties.Jetifier_enabled) {
+ inputFile := outputFile
+ outputFile = android.PathForModuleOut(ctx, "jetifier", jarName)
+ TransformJetifier(ctx, outputFile, inputFile)
+ }
j.combinedClasspathFile = outputFile
ctx.VisitDirectDeps(func(module android.Module) {