summaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorwisberg <wisberg>2003-05-07 04:00:11 +0000
committerwisberg <wisberg>2003-05-07 04:00:11 +0000
commitb6948c529f5de1deb4319c3c3efe91a8bb8d81d0 (patch)
treecb2a9e62830d61808e1a5da9b727febd7205a9ff /testing
parentefd8b1a4c13bff978c43d1f30af455011ae5af0f (diff)
downloadaspectj-b6948c529f5de1deb4319c3c3efe91a8bb8d81d0.tar.gz
aspectj-b6948c529f5de1deb4319c3c3efe91a8bb8d81d0.zip
- new reuseCompiler option (but see inc-compile fresh)
- support for -ajdeCompiler, like -eclipse and -ajc - resequenced xml output - hmm
Diffstat (limited to 'testing')
-rw-r--r--testing/src/org/aspectj/testing/harness/bridge/CompilerRun.java55
1 files changed, 36 insertions, 19 deletions
diff --git a/testing/src/org/aspectj/testing/harness/bridge/CompilerRun.java b/testing/src/org/aspectj/testing/harness/bridge/CompilerRun.java
index 35a26d875..bb0b617c6 100644
--- a/testing/src/org/aspectj/testing/harness/bridge/CompilerRun.java
+++ b/testing/src/org/aspectj/testing/harness/bridge/CompilerRun.java
@@ -17,6 +17,7 @@ import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.IMessageHandler;
import org.aspectj.bridge.MessageUtil;
import org.aspectj.bridge.ReflectionFactory;
+import org.aspectj.testing.ajde.CompileCommand;
import org.aspectj.testing.run.IRunIterator;
import org.aspectj.testing.run.IRunStatus;
import org.aspectj.testing.run.WrappedRunIterator;
@@ -59,6 +60,8 @@ import java.util.ListIterator;
* </ul>
*/
public class CompilerRun implements IAjcRun {
+ static final String AJDE_COMPILER = CompileCommand.class.getName();
+
static final String[] RA_String = new String[0];
static final String[] JAR_SUFFIXES = new String[] { ".jar", ".zip" };
@@ -349,13 +352,17 @@ public class CompilerRun implements IAjcRun {
}
}
}
-
- ICommand compiler = ReflectionFactory.makeCommand(setupResult.compilerName, status);
+ ICommand compiler = spec.reuseCompiler
+ ? sandbox.getCommand(this) // throws IllegalStateException if null
+ : ReflectionFactory.makeCommand(setupResult.compilerName, status);
DirChanges dirChanges = null;
if (null == compiler) {
MessageUtil.fail(status, "unable to make compiler " + setupResult.compilerName);
return false;
} else {
+ if (setupResult.compilerName != Spec.DEFAULT_COMPILER) {
+ MessageUtil.info(status, "compiler: " + setupResult.compilerName);
+ }
if (status.aborted()) {
MessageUtil.debug(status, "aborted, but compiler valid?: " + compiler);
} else {
@@ -447,8 +454,9 @@ public class CompilerRun implements IAjcRun {
"-usejavac", "-preprocess",
"-Xlint", "-lenient", "-strict",
"-source14", "-verbose", "-emacssym",
- "-ajc", "-eclipse", "-ignoreWarnings",
-
+ "-ajc", "-eclipse", "-ajdeCompiler",
+ "-ignoreWarnings",
+ // XXX consider adding [!^]ajdeCompiler
"!usejavac", "!preprocess",
"!Xlint", "!lenient", "!strict",
"!source14", "!verbose", "!emacssym",
@@ -467,15 +475,18 @@ public class CompilerRun implements IAjcRun {
* do dirChanges, and print no chidren.
*/
private static final XMLNames NAMES = new XMLNames(XMLNames.DEFAULT,
- "title", null, null, null, "files", null, false, false, true);
+ "title", null, null, null, "files", null, null, false, false, true);
protected String compiler;
+ // use same command - see also IncCompiler.Spec.fresh
+ protected boolean reuseCompiler;
+
protected TestSetup testSetup;
protected String[] argfiles = new String[0];
protected String[] aspectpath = new String[0];
- protected String[] classpath = new String[0];
+ protected String[] classpath = new String[0]; // XXX unused
protected String[] sourceroots = new String[0];
/** src path = {suiteParentDir}/{testBaseDirOffset}/{testSrcDirOffset}/{path} */
@@ -487,6 +498,10 @@ public class CompilerRun implements IAjcRun {
compiler = DEFAULT_COMPILER;
}
+ public void setReuseCompiler(boolean reuse) {
+ this.reuseCompiler = reuse;
+ }
+
public void setCompiler(String compilerName) {
this.compiler = compilerName;
}
@@ -876,7 +891,8 @@ public class CompilerRun implements IAjcRun {
} else {
result.result = true;
}
- } else if (!ReflectionFactory.ECLIPSE.equals(result.compilerName)) {
+ } else if (!ReflectionFactory.ECLIPSE.equals(result.compilerName)
+ && !AJDE_COMPILER.equals(result.compilerName)) {
result.failureReason = "unrecognized compiler: " + result.compilerName;
} else {
badOptions = LangUtil.selectOptions(argList, Spec.INVALID_ECLIPSE_OPTIONS);
@@ -915,7 +931,10 @@ public class CompilerRun implements IAjcRun {
* @return true if this is a flag to remove from the arg list
*/
protected boolean testFlag(String arg, TestSetup result) {
- if ("-eclipse".equals(arg) || "!eclipse".equals(arg) || "^ajc".equals(arg)) {
+ if ("-ajdeCompiler".equals(arg)) {
+ result.compilerName = AJDE_COMPILER;
+ return true;
+ } else if ("-eclipse".equals(arg) || "!eclipse".equals(arg) || "^ajc".equals(arg)) {
result.compilerName = ReflectionFactory.ECLIPSE;
return true;
} else if ("-ajc".equals(arg) || "!ajc".equals(arg) || "^eclipse".equals(arg)) {
@@ -948,28 +967,26 @@ public class CompilerRun implements IAjcRun {
* @see IXmlWritable#writeXml(XMLWriter)
*/
public void writeXml(XMLWriter out) {
- // If our state is empty, we just delegate to super.
- if (DEFAULT_COMPILER.equals(compiler)
- && LangUtil.isEmpty(testSrcDirOffset)
- && LangUtil.isEmpty(argfiles)) {
- super.writeXml(out);
- return;
- }
- String attr = "";
out.startElement(xmlElementName, false);
+ if (!LangUtil.isEmpty(testSrcDirOffset)) {
+ out.printAttribute("dir", testSrcDirOffset);
+ }
+ super.writeAttributes(out);
if (!DEFAULT_COMPILER.equals(compiler)) {
out.printAttribute("compiler", compiler);
}
- if (!LangUtil.isEmpty(testSrcDirOffset)) {
- out.printAttribute("dir", testSrcDirOffset);
+ if (!reuseCompiler) {
+ out.printAttribute("reuseCompiler", "true");
}
if (!LangUtil.isEmpty(argfiles)) {
out.printAttribute("argfiles", XMLWriter.flattenFiles(argfiles));
}
+ if (!LangUtil.isEmpty(aspectpath)) {
+ out.printAttribute("aspectpath", XMLWriter.flattenFiles(argfiles));
+ }
if (!LangUtil.isEmpty(sourceroots)) {
out.printAttribute("sourceroots", XMLWriter.flattenFiles(argfiles));
}
- super.writeAttributes(out);
out.endAttributes();
if (!LangUtil.isEmpty(dirChanges)) {
DirChanges.Spec.writeXml(out, dirChanges);