summaryrefslogtreecommitdiff
path: root/java/base.go
diff options
context:
space:
mode:
author Makoto Onuki <omakoto@google.com> 2024-03-28 14:42:20 -0700
committer Makoto Onuki <omakoto@google.com> 2024-08-16 12:08:35 -0700
commit7ded3827a4b4dda895d2bb0b2dc3063a59ad32f7 (patch)
treec53aa75747d2880fa53b82ef68e577426d5eda24 /java/base.go
parentdd00f2de3cb65c2ad6811ad8edd34bdafdb3af82 (diff)
Run "ravenizer" on ravenwood jars
Ravenizer is a new tool to preprocess ravenwood tests. It can optionally be applied to other java targets (for analyzing them, etc). The actual tool is being implemented internally, so in AOSP, we just use a script that copies the jar file as a replacement. Test: manual -- run `m RavenwoodBivalentTest` and make sure the ravenizer log message shows up. Flag: EXEMPT host test change only Bug: 360390999 Change-Id: I6d1f81e7c425397b16c37e7c30267957097387fd
Diffstat (limited to 'java/base.go')
-rw-r--r--java/base.go28
1 files changed, 27 insertions, 1 deletions
diff --git a/java/base.go b/java/base.go
index 8a4c64d71..5b7e1dfd0 100644
--- a/java/base.go
+++ b/java/base.go
@@ -222,6 +222,13 @@ type CommonProperties struct {
// the stubs via libs, but should be set to true when the module depends on
// 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 {
+ Enabled *bool
+ }
}
// Properties that are specific to device modules. Host module factories should not add these when
@@ -558,6 +565,10 @@ type Module struct {
// List of soong module dependencies required to compile the current module.
// This information is printed out to `Dependencies` field in module_bp_java_deps.json
compileDepNames []string
+
+ ravenizer struct {
+ enabled bool
+ }
}
var _ android.InstallableModule = (*Module)(nil)
@@ -1113,7 +1124,6 @@ func (j *Module) addGeneratedSrcJars(path android.Path) {
}
func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspathJars, extraCombinedJars android.Paths) {
-
// Auto-propagating jarjar rules
jarjarProviderData := j.collectJarJarRules(ctx)
if jarjarProviderData != nil {
@@ -1130,6 +1140,10 @@ 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
+ }
+
deps := j.collectDeps(ctx)
flags := j.collectBuilderFlags(ctx, deps)
@@ -1568,6 +1582,18 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
return
}
+ 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,
+ })
+ outputFile = ravenizerOutput
+ }
+
// Check package restrictions if necessary.
if len(j.properties.Permitted_packages) > 0 {
// Time stamp file created by the package check rule.