From 6e55584a671f57a75d87b1c688620777dcdf0db9 Mon Sep 17 00:00:00 2001 From: Geoff Mishkin Date: Sat, 4 May 2019 23:42:34 -0400 Subject: [PATCH 1/2] Make class path work on Windows --- scala/private/rule_impls.bzl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scala/private/rule_impls.bzl b/scala/private/rule_impls.bzl index fe3a536d3..16b23abb1 100644 --- a/scala/private/rule_impls.bzl +++ b/scala/private/rule_impls.bzl @@ -603,7 +603,7 @@ def _write_executable(ctx, rjars, main_class, jvm_flags, wrapper, use_jacoco): ) if use_jacoco and _coverage_replacements_provider.is_enabled(ctx): - classpath = ":".join( + classpath = ctx.configuration.host_path_separator.join( ["${RUNPATH}%s" % (j.short_path) for j in rjars.to_list() + ctx.files._jacocorunner + ctx.files._lcov_merger], ) jacoco_metadata_file = ctx.actions.declare_file( @@ -637,7 +637,7 @@ def _write_executable(ctx, rjars, main_class, jvm_flags, wrapper, use_jacoco): else: # RUNPATH is defined here: # https://github.com/bazelbuild/bazel/blob/0.4.5/src/main/java/com/google/devtools/build/lib/bazel/rules/java/java_stub_template.txt#L227 - classpath = ":".join( + classpath = ctx.configuration.host_path_separator.join( ["${RUNPATH}%s" % (j.short_path) for j in rjars.to_list()], ) ctx.actions.expand_template( From 1a884423a6d11743d02363c7ac3ebf7c00f3060c Mon Sep 17 00:00:00 2001 From: Geoff Mishkin Date: Sun, 5 May 2019 00:06:17 -0400 Subject: [PATCH 2/2] Make sure class path gets quoted to escape semicolons --- scala/private/rule_impls.bzl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scala/private/rule_impls.bzl b/scala/private/rule_impls.bzl index 16b23abb1..d9f29cba0 100644 --- a/scala/private/rule_impls.bzl +++ b/scala/private/rule_impls.bzl @@ -618,7 +618,7 @@ def _write_executable(ctx, rjars, main_class, jvm_flags, wrapper, use_jacoco): template = template, output = ctx.outputs.executable, substitutions = { - "%classpath%": classpath, + "%classpath%": "\"%s\"" % classpath, "%javabin%": javabin, "%jarbin%": _jar_path_based_on_java_bin(ctx), "%jvm_flags%": jvm_flags, @@ -644,7 +644,7 @@ def _write_executable(ctx, rjars, main_class, jvm_flags, wrapper, use_jacoco): template = template, output = ctx.outputs.executable, substitutions = { - "%classpath%": classpath, + "%classpath%": "\"%s\"" % classpath, "%java_start_class%": main_class, "%javabin%": javabin, "%jarbin%": _jar_path_based_on_java_bin(ctx),