summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/lint.go10
-rw-r--r--java/system_modules_test.go10
2 files changed, 13 insertions, 7 deletions
diff --git a/java/lint.go b/java/lint.go
index 5940eac61..9f677db3a 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
@@ -417,6 +422,7 @@ func (l *linter) lint(ctx android.ModuleContext) {
"ANDROID_SDK_HOME",
"SDK_ANNOTATIONS",
"LINT_OPTS",
+ "LANG",
},
Platform: map[string]string{remoteexec.PoolKey: pool},
}).NoVarTemplate(ctx.Config()))
diff --git a/java/system_modules_test.go b/java/system_modules_test.go
index 44049ee6b..abcd186f1 100644
--- a/java/system_modules_test.go
+++ b/java/system_modules_test.go
@@ -20,7 +20,7 @@ import (
"android/soong/android"
)
-func normalizedPathsToHeaderJars(result *android.TestResult, moduleNames ...string) []string {
+func getModuleHeaderJarsAsNormalizedPaths(result *android.TestResult, moduleNames ...string) []string {
paths := []string{}
for _, moduleName := range moduleNames {
module := result.Module(moduleName, "android_common")
@@ -57,7 +57,7 @@ func TestJavaSystemModules(t *testing.T) {
sourceInputs := sourceSystemModules.Rule("jarsTosystemModules").Inputs
// The expected paths are the header jars from the source input modules.
- expectedSourcePaths := normalizedPathsToHeaderJars(result, "system-module1", "system-module2")
+ expectedSourcePaths := getModuleHeaderJarsAsNormalizedPaths(result, "system-module1", "system-module2")
result.AssertArrayString("source system modules inputs", expectedSourcePaths, result.NormalizePathsForTesting(sourceInputs))
}
@@ -84,7 +84,7 @@ func TestJavaSystemModulesImport(t *testing.T) {
prebuiltInputs := prebuiltSystemModules.Rule("jarsTosystemModules").Inputs
// The expected paths are the header jars from the renamed prebuilt input modules.
- expectedPrebuiltPaths := normalizedPathsToHeaderJars(result, "system-module1", "system-module2")
+ expectedPrebuiltPaths := getModuleHeaderJarsAsNormalizedPaths(result, "system-module1", "system-module2")
result.AssertArrayString("renamed prebuilt system modules inputs", expectedPrebuiltPaths, result.NormalizePathsForTesting(prebuiltInputs))
}
@@ -99,7 +99,7 @@ func TestJavaSystemModulesMixSourceAndPrebuilt(t *testing.T) {
sourceInputs := sourceSystemModules.Rule("jarsTosystemModules").Inputs
// The expected paths are the header jars from the source input modules.
- expectedSourcePaths := normalizedPathsToHeaderJars(result, "system-module1", "system-module2")
+ expectedSourcePaths := getModuleHeaderJarsAsNormalizedPaths(result, "system-module1", "system-module2")
result.AssertArrayString("source system modules inputs", expectedSourcePaths, result.NormalizePathsForTesting(sourceInputs))
// check the existence of the renamed prebuilt module
@@ -107,6 +107,6 @@ func TestJavaSystemModulesMixSourceAndPrebuilt(t *testing.T) {
prebuiltInputs := prebuiltSystemModules.Rule("jarsTosystemModules").Inputs
// The expected paths are the header jars from the renamed prebuilt input modules.
- expectedPrebuiltPaths := normalizedPathsToHeaderJars(result, "prebuilt_system-module1", "prebuilt_system-module2")
+ expectedPrebuiltPaths := getModuleHeaderJarsAsNormalizedPaths(result, "prebuilt_system-module1", "prebuilt_system-module2")
result.AssertArrayString("prebuilt system modules inputs", expectedPrebuiltPaths, result.NormalizePathsForTesting(prebuiltInputs))
}