Skip to content

Commit 927cfd5

Browse files
committed
Handle Windows path seps in DepsTrackingReporter
1 parent 12d60d2 commit 927cfd5

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

scala/private/phases/phase_write_executable.bzl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,16 @@ def _write_executable_windows(ctx, executable, rjars, main_class, jvm_flags, wra
8585
cpfile = ctx.actions.declare_file("%s.classpath" % ctx.label.name)
8686
ctx.actions.write(cpfile, classpath)
8787

88+
specifiedEnv = {}
89+
if hasattr(ctx.attr, "env"):
90+
specifiedEnv = ctx.attr.env
91+
8892
ctx.actions.run(
8993
outputs = [executable],
9094
inputs = [cpfile],
9195
executable = ctx.attr._exe.files_to_run.executable,
9296
arguments = [executable.path, ctx.workspace_name, java_for_exe, main_class, cpfile.path, jvm_flags_str],
93-
env = ctx.attr.env,
97+
env = specifiedEnv,
9498
mnemonic = "ExeLauncher",
9599
progress_message = "Creating exe launcher",
96100
)

src/java/io/bazel/rulesscala/scalac/reporter/DepsTrackingReporter.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
import java.util.Set;
1818
import java.util.jar.JarFile;
1919
import java.util.stream.Collectors;
20+
21+
import javax.print.attribute.standard.Severity;
22+
2023
import scala.reflect.internal.util.NoPosition$;
2124
import scala.reflect.internal.util.Position;
2225
import scala.tools.nsc.Settings;
@@ -91,6 +94,9 @@ public void info0(Position pos, String msg, Severity severity, boolean force) {
9194
private void parseOpenedJar(String msg) {
9295
String jar = msg.split(":")[1];
9396

97+
//normalize path separators (scalac passes os-specific path separators.)
98+
jar = jar.replace("\\", "/");
99+
94100
// track only jars from dependency targets
95101
// this should exclude things like rt.jar which come from JDK
96102
if (jarToTarget.containsKey(jar) || indirectJarToTarget.containsKey(jar)) {

0 commit comments

Comments
 (0)