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/builder.go b/java/builder.go
index 68fba86..c645ee2 100644
--- a/java/builder.go
+++ b/java/builder.go
@@ -121,6 +121,13 @@
 			CommandDeps: []string{"${config.JavaCmd}", "${config.JarjarCmd}", "$rulesFile"},
 		},
 		"rulesFile")
+
+	jetifier = pctx.AndroidStaticRule("jetifier",
+		blueprint.RuleParams{
+			Command:     "${config.JavaCmd} -jar ${config.JetifierJar} -l error -o $out -i $in",
+			CommandDeps: []string{"${config.JavaCmd}", "${config.JetifierJar}"},
+		},
+	)
 )
 
 func init() {
@@ -371,6 +378,16 @@
 	})
 }
 
+func TransformJetifier(ctx android.ModuleContext, outputFile android.WritablePath,
+	inputFile android.Path) {
+	ctx.Build(pctx, android.BuildParams{
+		Rule:        jetifier,
+		Description: "jetifier",
+		Output:      outputFile,
+		Input:       inputFile,
+	})
+}
+
 type classpath []android.Path
 
 func (x *classpath) FormJavaClassPath(optName string) string {