aboutsummaryrefslogtreecommitdiffstats
path: root/java/java.go
diff options
context:
space:
mode:
authorNan Zhang <nanzhang@google.com>2018-08-30 15:28:46 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2018-08-30 15:28:46 +0000
commitb69575b1f697edae9f9b78765d50c8117d21f7d1 (patch)
treeae920ffcea361b58a44022897a2dc7a3b443c112 /java/java.go
parent8a9900a75f091aa57d303e6483eb2c873b68b13a (diff)
parent4c819fb59064921c2ef71fe1da489b5e3051d0d2 (diff)
downloadandroid_build_soong-b69575b1f697edae9f9b78765d50c8117d21f7d1.tar.gz
android_build_soong-b69575b1f697edae9f9b78765d50c8117d21f7d1.tar.bz2
android_build_soong-b69575b1f697edae9f9b78765d50c8117d21f7d1.zip
Merge "Add jetifier support in Soong."
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 295863fe..b911078b 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) {