diff options
author | 2024-10-04 09:25:30 +0000 | |
---|---|---|
committer | 2024-10-04 09:25:30 +0000 | |
commit | 13e719c089d4e867f3d06d70f2ad93c283ce1081 (patch) | |
tree | 22a192bf8979060035c81907cee8e7e6f84192e1 | |
parent | f03176d9df522f9bf626118c879a17df1ace2abd (diff) | |
parent | 989ee847c8307532aa51979d5b674c9984660cea (diff) |
Merge "[Ravenwood] Allow sending additional args to Ravenizer" into main
-rw-r--r-- | java/base.go | 26 | ||||
-rw-r--r-- | java/builder.go | 9 |
2 files changed, 21 insertions, 14 deletions
diff --git a/java/base.go b/java/base.go index 32bfc17f9..fc21c44e5 100644 --- a/java/base.go +++ b/java/base.go @@ -218,11 +218,15 @@ type CommonProperties struct { // the stubs via static libs. Is_stubs_module *bool - // If true, enable the "Ravenizer" tool on the output jar. - // "Ravenizer" is a tool for Ravenwood tests, but it can also be enabled on other kinds - // of java targets. Ravenizer struct { + // If true, enable the "Ravenizer" tool on the output jar. + // "Ravenizer" is a tool for Ravenwood tests, but it can also be enabled on other kinds + // of java targets. Enabled *bool + + // If true, the "Ravenizer" tool will remove all Mockito and DexMaker + // classes from the output jar. + Strip_mockito *bool } // Contributing api surface of the stub module. Is not visible to bp modules, and should @@ -1134,8 +1138,9 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath j.exportAidlIncludeDirs = android.PathsForModuleSrc(ctx, j.deviceProperties.Aidl.Export_include_dirs) - if re := proptools.Bool(j.properties.Ravenizer.Enabled); re { - j.ravenizer.enabled = re + // Only override the original value if explicitly set + if j.properties.Ravenizer.Enabled != nil { + j.ravenizer.enabled = *j.properties.Ravenizer.Enabled } deps := j.collectDeps(ctx) @@ -1624,12 +1629,11 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath if j.ravenizer.enabled { ravenizerInput := outputFile ravenizerOutput := android.PathForModuleOut(ctx, "ravenizer", jarName) - ctx.Build(pctx, android.BuildParams{ - Rule: ravenizer, - Description: "ravenizer", - Input: ravenizerInput, - Output: ravenizerOutput, - }) + ravenizerArgs := "" + if proptools.Bool(j.properties.Ravenizer.Strip_mockito) { + ravenizerArgs = "--strip-mockito" + } + TransformRavenizer(ctx, ravenizerOutput, ravenizerInput, ravenizerArgs) outputFile = ravenizerOutput localImplementationJars = android.Paths{ravenizerOutput} completeStaticLibsImplementationJars = android.NewDepSet(android.PREORDER, localImplementationJars, nil) diff --git a/java/builder.go b/java/builder.go index 6144832b3..e5d510923 100644 --- a/java/builder.go +++ b/java/builder.go @@ -260,10 +260,10 @@ var ( ravenizer = pctx.AndroidStaticRule("ravenizer", blueprint.RuleParams{ - Command: "rm -f $out && ${ravenizer} --in-jar $in --out-jar $out", + Command: "rm -f $out && ${ravenizer} --in-jar $in --out-jar $out $ravenizerArgs", CommandDeps: []string{"${ravenizer}"}, }, - ) + "ravenizerArgs") apimapper = pctx.AndroidStaticRule("apimapper", blueprint.RuleParams{ @@ -783,12 +783,15 @@ func TransformJetifier(ctx android.ModuleContext, outputFile android.WritablePat } func TransformRavenizer(ctx android.ModuleContext, outputFile android.WritablePath, - inputFile android.Path) { + inputFile android.Path, ravenizerArgs string) { ctx.Build(pctx, android.BuildParams{ Rule: ravenizer, Description: "ravenizer", Output: outputFile, Input: inputFile, + Args: map[string]string{ + "ravenizerArgs": ravenizerArgs, + }, }) } |