package org.aspectj.ajde.internal;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
+
import org.aspectj.ajde.Ajde;
import org.aspectj.ajde.BuildOptionsAdapter;
import org.aspectj.ajde.BuildProgressMonitor;
import org.aspectj.ajde.ProjectPropertiesAdapter;
import org.aspectj.ajde.TaskListManager;
import org.aspectj.ajdt.ajc.AjdtCommand;
+import org.aspectj.ajdt.ajc.BuildArgParser;
import org.aspectj.ajdt.internal.core.builder.AjBuildConfig;
import org.aspectj.ajdt.internal.core.builder.AjBuildManager;
import org.aspectj.bridge.AbortException;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.StringTokenizer;
-
public class CompilerAdapter {
private Map optionsMap;
String[] args = new String[] { "@" + config.getAbsolutePath() };
CountingMessageHandler counter
= CountingMessageHandler.makeCountingMessageHandler(messageHandler);
- AjBuildConfig local = AjdtCommand.genBuildConfig(args, counter);
+ BuildArgParser parser = new BuildArgParser();
+ AjBuildConfig local = parser.genBuildConfig(args, counter, false);
+
if (counter.hasErrors()) {
return null;
- }
+ }
+
local.setConfigFile(config);
// -- get globals, treat as defaults used if no local values
}
return false;
}
-
+
/**
* This creates a build configuration for the arguments.
* Errors reported to the handler:
AjBuildConfig config = parser.genBuildConfig(args, handler);
String message = parser.getOtherMessages(true);
- if (null != message) {
+ if (null != message) {
IMessage.Kind kind = inferKind(message);
IMessage m = new Message(message, kind, null, null);
handler.handleMessage(m);
public BuildArgParser() {
this(new StringPrintWriter(new StringWriter()));
}
-
+
+ /**
+ * Generate build configuration for the input args,
+ * passing to handler any error messages.
+ * @param args the String[] arguments for the build configuration
+ * @param handler the IMessageHandler handler for any errors
+ * @return AjBuildConfig per args,
+ * which will be invalid unless there are no handler errors.
+ */
+ public AjBuildConfig genBuildConfig(String[] args, IMessageHandler handler) {
+ return genBuildConfig(args, handler, true);
+ }
+
/**
* Generate build configuration for the input args,
* passing to handler any error messages.
* @param args the String[] arguments for the build configuration
* @param handler the IMessageHandler handler for any errors
+ * @param setClasspath determines if the classpath should be parsed and set on the build configuration
* @return AjBuildConfig per args,
* which will be invalid unless there are no handler errors.
*/
- public AjBuildConfig genBuildConfig(String[] args, IMessageHandler handler) {
+ public AjBuildConfig genBuildConfig(String[] args, IMessageHandler handler, boolean setClasspath) {
AjBuildConfig buildConfig = new AjBuildConfig();
try {
// sets filenames to be non-null in order to make sure that file paramters are ignored
buildConfig.setOutputDir(new File(destinationPath));
}
- buildConfig.setClasspath(getClasspath(parser));
+ if (setClasspath) {
+ buildConfig.setClasspath(getClasspath(parser));
+ }
if (incrementalMode
&& (0 == buildConfig.getSourceRoots().size())) {