Skip to content

Commit ac4181c

Browse files
authored
[bugfix] normalize paths to enable running external tests (#1598)
1 parent 6613ffc commit ac4181c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/java/io/bazel/rulesscala/scala_test/Runner.java

+6-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import java.io.IOException;
66
import java.nio.charset.Charset;
77
import java.nio.file.Files;
8+
import java.nio.file.Path;
89
import java.nio.file.Paths;
910
import java.util.List;
1011
import java.util.Map;
@@ -48,7 +49,9 @@ private static String[] extendFromFileArgs(String[] args) throws IOException {
4849
if (workspace == null || workspace.trim().isEmpty())
4950
throw new IllegalArgumentException(RULES_SCALA_MAIN_WS_NAME + " is null or empty.");
5051

51-
String runnerArgsFilePath = Runfiles.create().rlocation(workspace + "/" + runnerArgsFileKey);
52+
53+
Path runnerArgsUnresolvedFileLocation = Paths.get(workspace + "/" + runnerArgsFileKey).normalize();
54+
String runnerArgsFilePath = Runfiles.create().rlocation(runnerArgsUnresolvedFileLocation.toString());
5255
if (runnerArgsFilePath == null)
5356
throw new IllegalArgumentException("rlocation value is null for key: " + runnerArgsFileKey);
5457

@@ -90,7 +93,8 @@ private static void rlocateRunpathValue(String rulesWorkspace, List<String> runn
9093
String[] runpathElements = runnerArgs.get(runpathFlag + 1).split(File.pathSeparator);
9194
Runfiles runfiles = Runfiles.create();
9295
for (int i = 0; i < runpathElements.length; i++) {
93-
runpathElements[i] = runfiles.rlocation(rulesWorkspace + "/" + runpathElements[i]);
96+
Path runPathElementPath = Paths.get(rulesWorkspace + "/" + runpathElements[i]).normalize();
97+
runpathElements[i] = runfiles.rlocation(runPathElementPath.toString());
9498
}
9599
String runpath = String.join(File.separator, runpathElements);
96100
runnerArgs.set(runpathFlag + 1, runpath);

0 commit comments

Comments
 (0)