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

Commit cb1af7d7 authored by Anas Sulaiman's avatar Anas Sulaiman Committed by Automerger Merge Worker
Browse files

Merge "support toggling compare mode for rbe actions" into main am: f76b3267

parents 7b83a386 f76b3267
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@ import (
	"path/filepath"
	"path/filepath"
	"regexp"
	"regexp"
	"sort"
	"sort"
	"strconv"
	"strings"
	"strings"


	"github.com/google/blueprint/proptools"
	"github.com/google/blueprint/proptools"
@@ -497,6 +498,7 @@ func metalavaCmd(ctx android.ModuleContext, rule *android.RuleBuilder, javaVersi
	if metalavaUseRbe(ctx) {
	if metalavaUseRbe(ctx) {
		rule.Remoteable(android.RemoteRuleSupports{RBE: true})
		rule.Remoteable(android.RemoteRuleSupports{RBE: true})
		execStrategy := ctx.Config().GetenvWithDefault("RBE_METALAVA_EXEC_STRATEGY", remoteexec.LocalExecStrategy)
		execStrategy := ctx.Config().GetenvWithDefault("RBE_METALAVA_EXEC_STRATEGY", remoteexec.LocalExecStrategy)
		compare, _ := strconv.ParseBool(ctx.Config().GetenvWithDefault("RBE_METALAVA_COMPARE", "false"))
		labels := map[string]string{"type": "tool", "name": "metalava"}
		labels := map[string]string{"type": "tool", "name": "metalava"}
		// TODO: metalava pool rejects these jobs
		// TODO: metalava pool rejects these jobs
		pool := ctx.Config().GetenvWithDefault("RBE_METALAVA_POOL", "java16")
		pool := ctx.Config().GetenvWithDefault("RBE_METALAVA_POOL", "java16")
@@ -505,6 +507,9 @@ func metalavaCmd(ctx android.ModuleContext, rule *android.RuleBuilder, javaVersi
			ExecStrategy:    execStrategy,
			ExecStrategy:    execStrategy,
			ToolchainInputs: []string{config.JavaCmd(ctx).String()},
			ToolchainInputs: []string{config.JavaCmd(ctx).String()},
			Platform:        map[string]string{remoteexec.PoolKey: pool},
			Platform:        map[string]string{remoteexec.PoolKey: pool},
			Compare:         compare,
			NumLocalRuns:    1,
			NumRemoteRuns:   1,
		})
		})
	}
	}


+11 −0
Original line number Original line Diff line number Diff line
@@ -15,6 +15,7 @@
package remoteexec
package remoteexec


import (
import (
	"fmt"
	"sort"
	"sort"
	"strings"
	"strings"
)
)
@@ -84,6 +85,12 @@ type REParams struct {
	// EnvironmentVariables is a list of environment variables whose values should be passed through
	// EnvironmentVariables is a list of environment variables whose values should be passed through
	// to the remote execution.
	// to the remote execution.
	EnvironmentVariables []string
	EnvironmentVariables []string
	// Boolean indicating whether to compare chosen exec strategy with local execution.
	Compare bool
	// Number of times the action should be rerun locally.
	NumLocalRuns int
	// Number of times the action should be rerun remotely.
	NumRemoteRuns int
}
}


func init() {
func init() {
@@ -135,6 +142,10 @@ func (r *REParams) wrapperArgs() string {
	}
	}
	args += " --exec_strategy=" + strategy
	args += " --exec_strategy=" + strategy


	if r.Compare && r.NumLocalRuns >= 0 && r.NumRemoteRuns >= 0 {
		args += fmt.Sprintf(" --compare=true --num_local_reruns=%d --num_remote_reruns=%d", r.NumLocalRuns, r.NumRemoteRuns)
	}

	if len(r.Inputs) > 0 {
	if len(r.Inputs) > 0 {
		args += " --inputs=" + strings.Join(r.Inputs, ",")
		args += " --inputs=" + strings.Join(r.Inputs, ",")
	}
	}