Skip to content

Commit

Permalink
pass command-line key-value pairs to batch compiler without extra hyphen
Browse files Browse the repository at this point in the history
skip unsupported "--patch-module" command-line argument

#987
  • Loading branch information
eric-milles committed Dec 9, 2019
1 parent 163e5a1 commit c37e0d3
Showing 1 changed file with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -337,20 +337,30 @@ public String[] createCommandLine(CompilerConfiguration config) throws CompilerE
}
}

String prev = null;
for (Map.Entry<String, String> entry : config.getCustomCompilerArgumentsAsMap().entrySet()) {
String key = entry.getKey();
if (startsWithHyphen(key)) {
if (key.startsWith("-")) {
if ("-javaAgentClass".equals(key)) {
setJavaAgentClass(entry.getValue());
} else if (!key.startsWith("-J")) {
args.put(key, entry.getValue());
} else {
vmArgs.add(key.substring(2));
}
} else if (!"org.osgi.framework.system.packages".equals(key)) { // GRECLIPSE-1418: ignore the system packages option
args.put("-" + key, entry.getValue());
prev = (entry.getValue() == null ? key : null);
} else {
if (prev != null && entry.getValue() == null) {
args.put(prev, key);
} else if (!"org.osgi.framework.system.packages".equals(key)) { // GRECLIPSE-1418: ignore the system packages option
args.put("-" + key, entry.getValue());
}
prev = null;
}
}
if (args.remove("--patch-module") != null) { // https://github.com/groovy/groovy-eclipse/issues/987
if (verbose) getLogger().info("Skipping unsupported command-line argument \"--patch-module\"");
}

args.putAll(composeSourceFiles(sourceFiles));

Expand Down Expand Up @@ -656,10 +666,6 @@ private static boolean isNotBlank(String str) {
return !isBlank(str);
}

private static boolean startsWithHyphen(Object key) {
return (key instanceof CharSequence && ((CharSequence) key).charAt(0) == '-');
}

/**
* Linked Hash Map implementation that logs replaced entries.
*/
Expand Down

0 comments on commit c37e0d3

Please sign in to comment.