Merge "Run "ravenizer" on ravenwood jars" into main am: 08e76d9591
am: 099f466484
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3225782 Change-Id: I86a2ae6db5c7a1bb5300a8a057dac5f29d072158 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
28
java/base.go
28
java/base.go
@@ -219,6 +219,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
|
||||
@@ -555,6 +562,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 {
|
||||
@@ -1128,6 +1138,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)
|
||||
|
||||
@@ -1550,6 +1564,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.
|
||||
|
@@ -258,6 +258,13 @@ var (
|
||||
},
|
||||
)
|
||||
|
||||
ravenizer = pctx.AndroidStaticRule("ravenizer",
|
||||
blueprint.RuleParams{
|
||||
Command: "rm -f $out && ${ravenizer} --in-jar $in --out-jar $out",
|
||||
CommandDeps: []string{"${ravenizer}"},
|
||||
},
|
||||
)
|
||||
|
||||
zipalign = pctx.AndroidStaticRule("zipalign",
|
||||
blueprint.RuleParams{
|
||||
Command: "if ! ${config.ZipAlign} -c -p 4 $in > /dev/null; then " +
|
||||
@@ -307,6 +314,7 @@ func init() {
|
||||
pctx.Import("android/soong/java/config")
|
||||
|
||||
pctx.HostBinToolVariable("aconfig", "aconfig")
|
||||
pctx.HostBinToolVariable("ravenizer", "ravenizer")
|
||||
pctx.HostBinToolVariable("keep-flagged-apis", "keep-flagged-apis")
|
||||
}
|
||||
|
||||
@@ -765,6 +773,16 @@ func TransformJetifier(ctx android.ModuleContext, outputFile android.WritablePat
|
||||
})
|
||||
}
|
||||
|
||||
func TransformRavenizer(ctx android.ModuleContext, outputFile android.WritablePath,
|
||||
inputFile android.Path) {
|
||||
ctx.Build(pctx, android.BuildParams{
|
||||
Rule: ravenizer,
|
||||
Description: "ravenizer",
|
||||
Output: outputFile,
|
||||
Input: inputFile,
|
||||
})
|
||||
}
|
||||
|
||||
func GenerateMainClassManifest(ctx android.ModuleContext, outputFile android.WritablePath, mainClass string) {
|
||||
android.WriteFileRule(ctx, outputFile, "Main-Class: "+mainClass+"\n")
|
||||
}
|
||||
|
@@ -143,6 +143,9 @@ func (r *ravenwoodTest) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
HostTemplate: "${RavenwoodTestConfigTemplate}",
|
||||
})
|
||||
|
||||
// Always enable Ravenizer for ravenwood tests.
|
||||
r.Library.ravenizer.enabled = true
|
||||
|
||||
r.Library.GenerateAndroidBuildActions(ctx)
|
||||
|
||||
// Start by depending on all files installed by dependencies
|
||||
|
Reference in New Issue
Block a user