Merge "Run "ravenizer" on ravenwood jars" into main

This commit is contained in:
Treehugger Robot
2024-08-16 22:16:41 +00:00
committed by Gerrit Code Review
3 changed files with 48 additions and 1 deletions

View File

@@ -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)
@@ -1116,7 +1127,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 {
@@ -1133,6 +1143,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)
@@ -1555,6 +1569,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.