From 9b93af488bfa5f3560284ea6f4215fc263ab8ff6 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Wed, 10 Mar 2021 10:40:58 -0800 Subject: [PATCH] Default lint RBE to local exec strategy Match other tools by defaulting to local exec strategy. Also use the local absolute path when using the local exec strategy. Bug: 181681346 Test: m USE_RBE=true RBE_LINT=true Test: m USE_RBE=true RBE_LINT=true RBE_LINT_EXEC_STRATEGY=remote Change-Id: I1d6d20ec69663b99d6d9af1d8e5e67b48a5cd050 --- java/lint.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/java/lint.go b/java/lint.go index 5940eac61..f8a518054 100644 --- a/java/lint.go +++ b/java/lint.go @@ -189,6 +189,10 @@ type lintPaths struct { remoteRSPInputs android.Paths } +func lintRBEExecStrategy(ctx android.ModuleContext) string { + return ctx.Config().GetenvWithDefault("RBE_LINT_EXEC_STRATEGY", remoteexec.LocalExecStrategy) +} + func (l *linter) writeLintProjectXML(ctx android.ModuleContext, rule *android.RuleBuilder) lintPaths { var deps android.Paths var remoteInputs android.Paths @@ -280,7 +284,8 @@ func (l *linter) writeLintProjectXML(ctx android.ModuleContext, rule *android.Ru cmd.FlagForEachArg("--extra_checks_jar ", l.extraLintCheckJars.Strings()) trackInputDependency(l.extraLintCheckJars...) - if ctx.Config().UseRBE() && ctx.Config().IsEnvTrue("RBE_LINT") { + if ctx.Config().UseRBE() && ctx.Config().IsEnvTrue("RBE_LINT") && + lintRBEExecStrategy(ctx) != remoteexec.LocalExecStrategy { // TODO(b/181912787): remove these and use "." instead. cmd.FlagWithArg("--root_dir ", "/b/f/w") } else { @@ -391,7 +396,7 @@ func (l *linter) lint(ctx android.ModuleContext) { pool := ctx.Config().GetenvWithDefault("RBE_LINT_POOL", "java16") // TODO(b/181912787): this should be local fallback once the hack that passes /b/f/w in project.xml // is removed. - execStrategy := ctx.Config().GetenvWithDefault("RBE_LINT_EXEC_STRATEGY", remoteexec.RemoteExecStrategy) + execStrategy := lintRBEExecStrategy(ctx) labels := map[string]string{"type": "tool", "name": "lint"} rule.Remoteable(android.RemoteRuleSupports{RBE: true}) remoteInputs := lintPaths.remoteInputs