Skip to content

Commit

Permalink
[GR-38587] Make CommandLineOptionOrigin detection for @argfile-use wo…
Browse files Browse the repository at this point in the history
…rk for Windows.

PullRequest: graal/11755
  • Loading branch information
olpaw committed May 11, 2022
2 parents 930d61b + 7d15ff8 commit 7bc18c8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
public abstract class OptionOrigin {

public static final OptionOrigin commandLineOptionOriginSingleton = new CommandLineOptionOrigin();
public static final String argFilePrefix = "argfile:";

public URI container() {
return null;
Expand All @@ -66,7 +67,7 @@ public List<String> getRedirectionValues(@SuppressWarnings("unused") Path values

public static OptionOrigin from(String origin) {

if (origin == null) {
if (origin == null || origin.startsWith(argFilePrefix)) {
return commandLineOptionOriginSingleton;
}

Expand All @@ -78,10 +79,6 @@ public static OptionOrigin from(String origin) {
}
throw VMError.shouldNotReachHere("Unsupported OptionOrigin: " + origin);
}
if (originURI.getScheme() == null) {
/* @argument files use path as origin */
return commandLineOptionOriginSingleton;
}
switch (originURI.getScheme()) {
case "jar":
return new JarOptionOrigin(originURI);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

import org.graalvm.compiler.options.OptionType;

import com.oracle.svm.core.option.OptionOrigin;
import com.oracle.svm.core.option.OptionUtils;
import com.oracle.svm.driver.NativeImage.ArgumentQueue;

Expand Down Expand Up @@ -319,7 +320,7 @@ public boolean consume(ArgumentQueue args) {
args.poll();
headArg = headArg.substring(1);
Path argFile = Paths.get(headArg);
NativeImage.NativeImageArgsProcessor processor = nativeImage.new NativeImageArgsProcessor(argFile.toString());
NativeImage.NativeImageArgsProcessor processor = nativeImage.new NativeImageArgsProcessor(OptionOrigin.argFilePrefix + argFile);
readArgFile(argFile).forEach(processor::accept);
List<String> leftoverArgs = processor.apply(false);
if (leftoverArgs.size() > 0) {
Expand Down

0 comments on commit 7bc18c8

Please sign in to comment.