Skip to content

Commit

Permalink
[bugfix] normalize paths to enable running external tests (#1598)
Browse files Browse the repository at this point in the history
  • Loading branch information
joeljeske authored Aug 26, 2024
1 parent 6613ffc commit ac4181c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/java/io/bazel/rulesscala/scala_test/Runner.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -48,7 +49,9 @@ private static String[] extendFromFileArgs(String[] args) throws IOException {
if (workspace == null || workspace.trim().isEmpty())
throw new IllegalArgumentException(RULES_SCALA_MAIN_WS_NAME + " is null or empty.");

String runnerArgsFilePath = Runfiles.create().rlocation(workspace + "/" + runnerArgsFileKey);

Path runnerArgsUnresolvedFileLocation = Paths.get(workspace + "/" + runnerArgsFileKey).normalize();
String runnerArgsFilePath = Runfiles.create().rlocation(runnerArgsUnresolvedFileLocation.toString());
if (runnerArgsFilePath == null)
throw new IllegalArgumentException("rlocation value is null for key: " + runnerArgsFileKey);

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

0 comments on commit ac4181c

Please sign in to comment.