for (File srcFile : compileList) {
log(srcFile.getAbsolutePath());
}
}
Path classpath = getClasspath() != null ? getClasspath() : new Path(getProject());
// extract joint options, some get pushed up...
List<String> jointOptions = new ArrayList<String>();
if (jointCompilation) {
RuntimeConfigurable rc = javac.getRuntimeConfigurableWrapper();
for (Iterator i = rc.getAttributeMap().entrySet().iterator(); i.hasNext();) {
final Map.Entry e = (Map.Entry) i.next();
final String key = e.getKey().toString();
final String value = getProject().replaceProperties(e.getValue().toString());
if (key.contains("debug")) {
String level = "";
if (javac.getDebugLevel() != null) {
level = ":" + javac.getDebugLevel();
}
jointOptions.add("-Fg" + level);
} else if (key.contains("debugLevel")) {
// ignore, taken care of in debug
} else if ((key.contains("nowarn"))
|| (key.contains("verbose"))
|| (key.contains("deprecation"))) {
// false is default, so something to do only in true case
if ("on".equalsIgnoreCase(value) || "true".equalsIgnoreCase(value) || "yes".equalsIgnoreCase("value"))
jointOptions.add("-F" + key);
} else if (key.contains("classpath")) {
classpath.add(javac.getClasspath());
} else if ((key.contains("depend"))
|| (key.contains("extdirs"))
|| (key.contains("encoding"))
|| (key.contains("source"))
|| (key.contains("target"))
|| (key.contains("verbose"))) { // TODO remove extra verbose?
jointOptions.add("-J" + key + "=" + value);
} else {
log("The option " + key + " cannot be set on the contained <javac> element. The option will be ignored", Project.MSG_WARN);
}
// includes? excludes?
}
// ant's <javac> supports nested <compilerarg value=""> elements (there can be multiple of them)
// for additional options to be passed to javac.
Enumeration children = rc.getChildren();
while (children.hasMoreElements()) {
RuntimeConfigurable childrc = (RuntimeConfigurable) children.nextElement();
if (childrc.getElementTag().equals("compilerarg")) {
for (Iterator i = childrc.getAttributeMap().entrySet().iterator(); i.hasNext();) {
final Map.Entry e = (Map.Entry) i.next();
final String key = e.getKey().toString();
if (key.equals("value")) {
final String value = getProject().replaceProperties(e.getValue().toString());
StringTokenizer st = new StringTokenizer(value, " ");
while (st.hasMoreTokens()) {
String optionStr = st.nextToken();
jointOptions.add(optionStr.replace("-X", "-FX"));
}
}
}
}
}
}
String separator = System.getProperty("file.separator");
List<String> commandLineList = new ArrayList<String>();
if (fork) {
String javaHome;
if (forkJDK != null) {
javaHome = forkJDK.getPath();
} else {
javaHome = System.getProperty("java.home");
}
if (includeAntRuntime) {
classpath.addExisting((new Path(getProject())).concatSystemClasspath("last"));
}
if (includeJavaRuntime) {
classpath.addJavaRuntime();
}
commandLineList.add(javaHome + separator + "bin" + separator + "java");
commandLineList.add("-classpath");
commandLineList.add(classpath.toString());
final String fileEncodingProp = System.getProperty("file.encoding");
if ((fileEncodingProp != null) && !fileEncodingProp.equals("")) {
commandLineList.add("-Dfile.encoding=" + fileEncodingProp);
}
if (targetBytecode != null) {
commandLineList.add("-Dgroovy.target.bytecode=" + targetBytecode);
}
if ((memoryInitialSize != null) && !memoryInitialSize.equals("")) {
commandLineList.add("-Xms" + memoryInitialSize);
}
if ((memoryMaximumSize != null) && !memoryMaximumSize.equals("")) {
commandLineList.add("-Xmx" + memoryMaximumSize);
}
if (!"*.groovy".equals(getScriptExtension())) {
String tmpExtension = getScriptExtension();
if (tmpExtension.startsWith("*.")) tmpExtension = tmpExtension.substring(1);
commandLineList.add("-Dgroovy.default.scriptExtension=" + tmpExtension);
}
commandLineList.add("org.codehaus.groovy.tools.FileSystemCompiler");
}
commandLineList.add("--classpath");
commandLineList.add(classpath.toString());
if (jointCompilation) {
commandLineList.add("-j");
commandLineList.addAll(jointOptions);
}
commandLineList.add("-d");