diff options
author | wisberg <wisberg> | 2002-12-18 21:34:30 +0000 |
---|---|---|
committer | wisberg <wisberg> | 2002-12-18 21:34:30 +0000 |
commit | 7cd6a97ee6a8884c4114a64265a21d3847aece7a (patch) | |
tree | 83badfc23f62717d64f83d4d132e0dcc44395ec3 /taskdefs | |
parent | 3d7434255e7af84b6a6298d598200f793976f1b8 (diff) | |
download | aspectj-7cd6a97ee6a8884c4114a64265a21d3847aece7a.tar.gz aspectj-7cd6a97ee6a8884c4114a64265a21d3847aece7a.zip |
handling messages like the new taskdef, printing as we go and rendering user-visible exceptions using Main
Diffstat (limited to 'taskdefs')
-rw-r--r-- | taskdefs/src/org/aspectj/tools/ant/taskdefs/Ajc10.java | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/taskdefs/src/org/aspectj/tools/ant/taskdefs/Ajc10.java b/taskdefs/src/org/aspectj/tools/ant/taskdefs/Ajc10.java index cacf88627..d65a4fd44 100644 --- a/taskdefs/src/org/aspectj/tools/ant/taskdefs/Ajc10.java +++ b/taskdefs/src/org/aspectj/tools/ant/taskdefs/Ajc10.java @@ -17,10 +17,12 @@ import org.apache.tools.ant.types.*; import org.apache.tools.ant.types.Path; import org.aspectj.bridge.AbortException; import org.aspectj.bridge.IMessage; +import org.aspectj.bridge.IMessageHandler; import org.aspectj.bridge.IMessageHolder; import org.aspectj.bridge.MessageHandler; import org.aspectj.bridge.MessageUtil; import org.aspectj.tools.ajc.Main; +import org.aspectj.tools.ajc.Main.MessagePrinter; import org.apache.tools.ant.taskdefs.*; import org.apache.tools.ant.taskdefs.compilers.*; import java.io.*; @@ -65,6 +67,7 @@ public class Ajc10 extends MatchingTask { private List argfiles; private boolean fork; private boolean failonerror; + private boolean verbose; private String encoding; private String source; @@ -87,6 +90,7 @@ public class Ajc10 extends MatchingTask { public void setVerbose(boolean verbose) { // javac-also eajc-also docDone setif(verbose, "-verbose"); + this.verbose = verbose; } public void setVersion(boolean version) { // javac-also eajc-also docDone @@ -574,7 +578,17 @@ public class Ajc10 extends MatchingTask { protected int spoon() throws BuildException { //if (version) version(null); int result = -1; - IMessageHolder holder = new MessageHandler(); + final IMessageHolder holder; + { + MessageHandler handler = new MessageHandler(); + if (!verbose) { + handler.ignore(IMessage.INFO); + } + final IMessageHandler delegate + = verbose ? MessagePrinter.VERBOSE: MessagePrinter.TERSE; + handler.setInterceptor(delegate); + holder = handler; + } try { String[] args = cmd.getCommandline(); // XXX avoid rendering if not verbosely logging? @@ -609,15 +623,22 @@ public class Ajc10 extends MatchingTask { } } if (null != t) { - t.printStackTrace(); - throw new BuildException("Couldn't create compiler!", - t, location); + // t.printStackTrace(); // let recipient print + throw new BuildException("Compiler failure", t, location); } } finally { - if (0 < holder.numMessages(null, true)) { - MessageUtil.print(System.err, holder, ""); - } - // XXX handle ABORT messages by throwing? + // now printing messages as we go, above +// IMessage.Kind level = (verbose ? IMessage.INFO : IMessage.WARNING); +// if (0 < holder.numMessages(level, true)) { +// final String prefix = ""; +// final boolean printSummary = false; +// MessageUtil.print(System.err, +// holder, +// prefix, +// MessageUtil.MESSAGE_ALL, +// (verbose ? MessageUtil.PICK_INFO_PLUS : MessageUtil.PICK_WARNING_PLUS), +// printSummary); +// } } return result; } |