Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 13e719c0 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "[Ravenwood] Allow sending additional args to Ravenizer" into main

parents f03176d9 989ee847
Loading
Loading
Loading
Loading
+15 −11
Original line number Diff line number Diff line
@@ -218,11 +218,15 @@ type CommonProperties struct {
	// the stubs via static libs.
	Is_stubs_module *bool

	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.
	Ravenizer struct {
		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)
+6 −3
Original line number Diff line number Diff line
@@ -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,
		},
	})
}