Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
Expand Down Expand Up @@ -140,6 +141,7 @@ private Map<String, String> getCompilerArguments(CompilerConfiguration config) {
}

compilerArguments = config.getCustomCompilerArgumentsAsMap();
Map<String, String> ca2 = new HashMap<String, String>();

Iterator<String> i = compilerArguments.keySet().iterator();

Expand All @@ -151,12 +153,15 @@ private Map<String, String> getCompilerArguments(CompilerConfiguration config) {
i.remove();
String k = arr[0];
v = arr[1];
compilerArguments.put(k, v);
// compilerArguments.put(k, v);
ca2.put(k, v);
if (config.isDebug()) {
System.out.println("transforming argument from " + orig + " to " + k + " = [" + v + "]");
System.out.println(
"internal splitting of argument '" + orig + "' to key '" + k + "', value '" + v + "'");
}
}
}
compilerArguments.putAll(ca2);

config.setCustomCompilerArgumentsAsMap(compilerArguments);

Expand Down Expand Up @@ -389,11 +394,12 @@ private String[] buildCompilerArguments(CompilerConfiguration config, String[] s
throws CompilerException {
List<String> args = new ArrayList<>();

if (config.isDebug()) {
args.add("/debug+");
} else {
args.add("/debug-");
}
// plugin parameter is no the same as the compiler option! so replaced
// if (config.isDebug()) {
// args.add("/debug+");
// } else {
// args.add("/debug-");
// }

// config.isShowWarnings()
// config.getSourceVersion()
Expand Down Expand Up @@ -433,12 +439,14 @@ private String[] buildCompilerArguments(CompilerConfiguration config, String[] s
}
}

// TODO: include all user compiler arguments and not only some!

Map<String, String> compilerArguments = getCompilerArguments(config);

// ----------------------------------------------------------------------
// Main class
// ----------------------------------------------------------------------

Map<String, String> compilerArguments = getCompilerArguments(config);

String mainClass = compilerArguments.get("-main");

if (!StringUtils.isEmpty(mainClass)) {
Expand All @@ -457,7 +465,17 @@ private String[] buildCompilerArguments(CompilerConfiguration config, String[] s
}

// ----------------------------------------------------------------------
// Nowarn option
// Debug option (full, pdbonly...)
// ----------------------------------------------------------------------

String debug = compilerArguments.get("-debug");

if (!StringUtils.isEmpty(debug)) {
args.add("/debug:" + debug);
}

// ----------------------------------------------------------------------
// Nowarn option (w#1,w#2...)
// ----------------------------------------------------------------------

String nowarn = compilerArguments.get("-nowarn");
Expand Down Expand Up @@ -489,7 +507,7 @@ private String[] buildCompilerArguments(CompilerConfiguration config, String[] s
}

// ----------------------------------------------------------------------
// Target - type of assembly to produce, lib,exe,winexe etc...
// Target - type of assembly to produce: library,exe,winexe...
// ----------------------------------------------------------------------

String target = compilerArguments.get("-target");
Expand All @@ -505,7 +523,7 @@ private String[] buildCompilerArguments(CompilerConfiguration config, String[] s
// ----------------------------------------------------------------------
String nologo = compilerArguments.get("-nologo");

if (!StringUtils.isEmpty(nologo)) {
if (!StringUtils.isEmpty(nologo) && !"false".equals(nologo.toLowerCase())) {
args.add("/nologo");
}

Expand All @@ -514,7 +532,7 @@ private String[] buildCompilerArguments(CompilerConfiguration config, String[] s
// ----------------------------------------------------------------------
String unsafe = compilerArguments.get("-unsafe");

if (!StringUtils.isEmpty(unsafe) && unsafe.equals("true")) {
if (!StringUtils.isEmpty(unsafe) && "true".equals(unsafe.toLowerCase())) {
args.add("/unsafe");
}

Expand All @@ -532,8 +550,8 @@ private String[] buildCompilerArguments(CompilerConfiguration config, String[] s
// ----------------------------------------------------------------------
String utf8output = compilerArguments.get("-utf8output");

if (!StringUtils.isEmpty(utf8output)) {
args.add("/utf8output:");
if (!StringUtils.isEmpty(utf8output) && !"false".equals(utf8output)) {
args.add("/utf8output");
}

// ----------------------------------------------------------------------
Expand All @@ -548,6 +566,10 @@ private String[] buildCompilerArguments(CompilerConfiguration config, String[] s
args.add(sourceFile);
}

if (config.isDebug()) {
System.out.println("built compiler arguments:" + args);
}

return args.toArray(new String[args.size()]);
}

Expand Down Expand Up @@ -759,7 +781,7 @@ protected static Set<String> getSourceFilesForSourceRoot(CompilerConfiguration c

if (excludes != null && !excludes.isEmpty()) {
String[] exclStrs = excludes.toArray(new String[excludes.size()]);
scanner.setIncludes(exclStrs);
scanner.setExcludes(exclStrs);

This comment was marked as resolved.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do too but did not find a way to create a second pull request while the first one was still opened...

This comment was marked as outdated.

This comment was marked as resolved.

}

scanner.scan();
Expand Down
Loading