}
}
- List javaArgList = parser.getUnparsedArgs();
+ List javaArgList = new ArrayList();
+
// disable all special eclipse warnings by default
//??? might want to instead override getDefaultOptions()
- javaArgList.add(0, "-warn:none");
- if (javaArgList.size() != 0) {
+ javaArgList.add("-warn:none");
+
+ // these next four lines are some nonsense to fool the eclipse batch compiler
+ // without these it will go searching for reasonable values from properties
+ //TODO fix org.eclipse.jdt.internal.compiler.batch.Main so this hack isn't needed
+ javaArgList.add("-classpath");
+ javaArgList.add(System.getProperty("user.dir"));
+ javaArgList.add("-bootclasspath");
+ javaArgList.add(System.getProperty("user.dir"));
+
+ javaArgList.addAll(parser.getUnparsedArgs());
+
+// if (javaArgList.size() != 0) {
super.configure((String[])javaArgList.toArray(new String[javaArgList.size()]));
- }
+// }
if (buildConfig.getSourceRoots() != null) {
for (Iterator i = buildConfig.getSourceRoots().iterator(); i.hasNext(); ) {
}
addExtDirs(extdirs, ret);
- if ((classpaths == null || classpaths.length == 0) ||
- (classpaths != null && classpaths[0] == ".")) {
+ if (parser.classpath == null) {
//??? this puts the compiler's classes on the classpath
//??? this is ajc-1.0 compatible
addClasspath(System.getProperty("java.class.path", ""), ret);
} else {
- ret.addAll(Arrays.asList(classpaths));
+ addClasspath(parser.classpath, ret);
}
//??? eclipse seems to put outdir on the classpath
// !!! extract error handling to be common so that the IDEs can use it
private class AjcConfigParser extends ConfigParser {
- private String bootclasspath = null;
+ private String bootclasspath = null;
+ private String classpath = null;
private String extdirs = null;
private List unparsedArgs = new ArrayList();
private AjBuildConfig buildConfig;
if (args.size() > nextArgIndex) {
bootclasspath = ((ConfigParser.Arg)args.get(nextArgIndex)).getValue();
args.remove(args.get(nextArgIndex));
- } else {
- showError("-bootclasspath requires classpath entries");
- }
+ } else {
+ showError("-bootclasspath requires classpath entries");
+ }
+ } else if (arg.equals("-classpath")) {
+ if (args.size() > nextArgIndex) {
+ classpath = ((ConfigParser.Arg)args.get(nextArgIndex)).getValue();
+ args.remove(args.get(nextArgIndex));
+ } else {
+ showError("-classpath requires classpath entries");
+ }
} else if (arg.equals("-extdirs")) {
if (args.size() > nextArgIndex) {
extdirs = ((ConfigParser.Arg)args.get(nextArgIndex)).getValue();
// error on directory unless -d, -{boot}classpath, or -extdirs
} else if (arg.equals("-d")) {
dirLookahead(arg, args, nextArgIndex);
- } else if (arg.equals("-classpath")) {
- dirLookahead(arg, args, nextArgIndex);
- } else if (arg.equals("-bootclasspath")) {
- dirLookahead(arg, args, nextArgIndex);
- } else if (arg.equals("-extdirs")) {
- dirLookahead(arg, args, nextArgIndex);
+// } else if (arg.equals("-classpath")) {
+// dirLookahead(arg, args, nextArgIndex);
+// } else if (arg.equals("-bootclasspath")) {
+// dirLookahead(arg, args, nextArgIndex);
+// } else if (arg.equals("-extdirs")) {
+// dirLookahead(arg, args, nextArgIndex);
} else if (new File(arg).isDirectory()) {
showError("dir arg not permitted: " + arg);
} else {
config.getClasspath().contains("2.jar"));
config = parser.genBuildConfig(new String[] { "-1.3" }, messageWriter);
- err = parser.getOtherMessages(true);
+ // these errors are deffered to the compiler now
+ //err = parser.getOtherMessages(true);
//!!!assertTrue(err, null == err);
assertTrue(
config.getClasspath().toString(),
config = parser.genBuildConfig(new String[] {
"-classpath", ENTRY, "-1.4" }, messageWriter);
- err = parser.getOtherMessages(true);
- assertTrue("expected errors for missing jars", null != err);
+ // these errors are deffered to the compiler now
+ //err = parser.getOtherMessages(true);
+ //assertTrue("expected errors for missing jars", null != err);
assertTrue(
config.getClasspath().toString(),
config.getClasspath().contains("1.jar"));
package org.aspectj.ajdt.internal.compiler.batch;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import org.aspectj.ajdt.ajc.AjdtCommand;
import org.aspectj.bridge.ICommand;
+import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.MessageHandler;
/**
runCompiler(args, new int[] {2});
}
+ public void testMissingJarError() {
+ List args = new ArrayList();
+
+ args.add("-d");
+ args.add("out");
+
+ args.add("-classpath");
+ args.add("../runtime/bin;../lib/junit/junit.jar;../testing-client/bin;not_found_anywhere.jar");
+ args.add("testdata/src1/ThisAndModifiers.java");
+
+ ICommand command = new AjdtCommand();
+ MessageHandler myHandler = new MessageHandler();
+ //myHandler.setInterceptor(org.aspectj.tools.ajc.Main.MessagePrinter.TERSE);
+ boolean result = command.runCommand((String[])args.toArray(new String[args.size()]), myHandler);
+
+ //System.err.println("messages: " + Arrays.asList(myHandler.getMessages(IMessage.INFO, true)));
+ // DON'T yet have a way of testing that we actually got a particular info message
+ assertEquals("only info for missing jar", 0, myHandler.getErrors().length);
+
+ }
public void testMissingRuntimeError() {
List args = new ArrayList();
args.add("-classpath");
args.add("../lib/junit/junit.jar;../testing-client/bin");
- args.add("testdata/src1/Xlint.java");
+ args.add("testdata/src1/ThisAndModifiers.java");
ICommand command = new AjdtCommand();
MessageHandler myHandler = new MessageHandler();