aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/java_tools/junitrunner
diff options
context:
space:
mode:
authorGravatar Lukacs Berki <lberki@google.com>2017-01-20 15:28:28 +0000
committerGravatar Vladimir Moskva <vladmos@google.com>2017-01-20 15:45:21 +0000
commit88eca6e4f3951fe0ee1be3306bfb85f560bc046a (patch)
treeb47c637fe623b186dea18d4e36a7bfea99846a2c /src/java_tools/junitrunner
parent0d380646da41b7533e9c56c56629b3a7b3083df7 (diff)
Fix bootstrapping in Docker images.
Turns out, we couldn't run jarjar because the Java launcher script looks for the .jars in the runfiles and build-runfiles is stubbed out during bootstrapping. The only reason why this worked at all is that sandboxing *also* doesn't work during bootstrapping but it causes the creation of symlinks that happened to be just in the right place for the Java launcher to find the .jars . The fix is: - Explicitly disable sandboxing during bootstrapping so that coincidences like this don't happen again - Pass a --javabase and --host_javabase option during the bootstrap build so that we don't need any symlinks to access to JVM - Invoke jarjar using its deploy jar instead of the launcher script. That was fun. -- PiperOrigin-RevId: 145083357 MOS_MIGRATED_REVID=145083357
Diffstat (limited to 'src/java_tools/junitrunner')
-rw-r--r--src/java_tools/junitrunner/java/com/google/testing/coverage/BUILD13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/java_tools/junitrunner/java/com/google/testing/coverage/BUILD b/src/java_tools/junitrunner/java/com/google/testing/coverage/BUILD
index 4e4b135853..c43814b832 100644
--- a/src/java_tools/junitrunner/java/com/google/testing/coverage/BUILD
+++ b/src/java_tools/junitrunner/java/com/google/testing/coverage/BUILD
@@ -96,11 +96,20 @@ genrule(
# freebsd; so disable there as well until a fixed version is in there as
# well.
# TODO(aehlig): fix and remove once a version with the fix is out.
+ #
+ # We don't invoke jarjar_bin directly because this command is invoked
+ # during bootstrapping when we don't have build-runfiles, thus no
+ # runfiles trees. The Java launcher script looks in the runfiles tree
+ # for the jars (and rightfully so), thus, invoking the binary directly
+ # won't work.
"if [[ $$(uname -a) =~ MSYS ]] || [[ $$(uname -a) =~ freebsd ]]; then",
" cp \"$(location :JacocoCoverage_deploy.jar)\" \"$@\";",
"else",
- " \"$(location //third_party/java/jarjar:jarjar_bin)\" process \"$(location :JacocoCoverage.jarjar)\" \"$(location :JacocoCoverage_deploy.jar)\" \"$@\"",
+ " \"$(JAVA)\" -jar \"$(location //third_party/java/jarjar:jarjar_bin_deploy.jar)\" process \"$(location :JacocoCoverage.jarjar)\" \"$(location :JacocoCoverage_deploy.jar)\" \"$@\"",
"fi",
]),
- tools = ["//third_party/java/jarjar:jarjar_bin"],
+ tools = [
+ "//third_party/java/jarjar:jarjar_bin_deploy.jar",
+ "//tools/defaults:jdk",
+ ],
)