diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaSemantics.java | 4 | ||||
-rwxr-xr-x | src/test/shell/bazel/bazel_java_test.sh | 9 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaSemantics.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaSemantics.java index 7c132f6620..f5fa1ff7ae 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaSemantics.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaSemantics.java @@ -183,9 +183,7 @@ public class BazelJavaSemantics implements JavaSemantics { String workspaceName = ruleContext.getWorkspaceName(); final String workspacePrefix = workspaceName + (workspaceName.isEmpty() ? "" : "/"); final boolean isRunfilesEnabled = ruleContext.getConfiguration().runfilesEnabled(); - if (!isRunfilesEnabled) { - arguments.add(Substitution.of("%runfiles_manifest_only%", "1")); - } + arguments.add(Substitution.of("%runfiles_manifest_only%", isRunfilesEnabled ? "" : "1")); arguments.add(Substitution.of("%workspace_prefix%", workspacePrefix)); arguments.add(Substitution.of("%javabin%", javaExecutable)); arguments.add(Substitution.of("%needs_runfiles%", diff --git a/src/test/shell/bazel/bazel_java_test.sh b/src/test/shell/bazel/bazel_java_test.sh index df84b7f21f..48af5a90b4 100755 --- a/src/test/shell/bazel/bazel_java_test.sh +++ b/src/test/shell/bazel/bazel_java_test.sh @@ -105,6 +105,15 @@ function test_build_hello_world() { bazel build //java/main:main &> $TEST_log || fail "build failed" } +# Runfiles is disabled by default on Windows, but we can test it on Unix by +# adding flag --experimental_enable_runfiles=0 +function test_build_and_run_hello_world_without_runfiles() { + write_hello_library_files + + bazel run --experimental_enable_runfiles=0 //java/main:main &> $TEST_log || fail "build failed" + expect_log "Hello, Library!;Hello, World!" +} + function test_errorprone_error_fails_build_by_default() { write_hello_library_files # Trigger an error-prone error by comparing two arrays via #equals(). |