From 4c819fb59064921c2ef71fe1da489b5e3051d0d2 Mon Sep 17 00:00:00 2001 From: Nan Zhang Date: Mon, 27 Aug 2018 18:31:46 -0700 Subject: Add jetifier support in Soong. This is a blocker for droiddoc targets migration under vendor/. Test: N/A Bug: b/72552006 Change-Id: If85a0917c1ac0d88b9d5b488216a638b4dabd39f --- java/java.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'java/java.go') 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) { -- cgit v1.2.3-59-g8ed1b