Add jarjar support
If jarjar_rules is set, pass the compiled jar through jarjar to produce a new intermediate jar. Change-Id: Ied596433fd5c49d05f07c04245f3abe8b9aadc5e
This commit is contained in:
@@ -62,6 +62,13 @@ var (
|
||||
},
|
||||
"outDir", "dxFlags")
|
||||
|
||||
jarjar = pctx.StaticRule("jarjar",
|
||||
blueprint.RuleParams{
|
||||
Command: "java -jar $jarjarCmd process $rulesFile $in $out",
|
||||
Description: "jarjar $out",
|
||||
},
|
||||
"rulesFile")
|
||||
|
||||
extractPrebuilt = pctx.StaticRule("extractPrebuilt",
|
||||
blueprint.RuleParams{
|
||||
Command: `rm -rf $outDir && unzip -qo $in -d $outDir && ` +
|
||||
@@ -80,6 +87,9 @@ func init() {
|
||||
pctx.VariableFunc("dxCmd", func(c interface{}) (string, error) {
|
||||
return c.(Config).HostBinTool("dx")
|
||||
})
|
||||
pctx.VariableFunc("jarjarCmd", func(c interface{}) (string, error) {
|
||||
return c.(Config).HostJavaTool("jarjar.jar")
|
||||
})
|
||||
}
|
||||
|
||||
type javaBuilderFlags struct {
|
||||
@@ -198,6 +208,21 @@ func TransformDexToJavaLib(ctx common.AndroidModuleContext, resources []jarSpec,
|
||||
return outputFile
|
||||
}
|
||||
|
||||
func TransformJarJar(ctx common.AndroidModuleContext, classesJar string, rulesFile string) string {
|
||||
outputFile := filepath.Join(common.ModuleOutDir(ctx), "classes-jarjar.jar")
|
||||
ctx.Build(pctx, blueprint.BuildParams{
|
||||
Rule: jarjar,
|
||||
Outputs: []string{outputFile},
|
||||
Inputs: []string{classesJar},
|
||||
Implicits: []string{"$jarjarCmd"},
|
||||
Args: map[string]string{
|
||||
"rulesFile": rulesFile,
|
||||
},
|
||||
})
|
||||
|
||||
return outputFile
|
||||
}
|
||||
|
||||
func TransformPrebuiltJarToClasses(ctx common.AndroidModuleContext,
|
||||
prebuilt string) (classJarSpec, resourceJarSpec jarSpec) {
|
||||
|
||||
|
Reference in New Issue
Block a user