Did you try the -emacs option which was designed
to suppress stuff just for the purposes of
playing nicely with emacs?
mcclain wrote:
>
> Hi all.
>
> I'm new to this whole open source thing, but i've been using ant for a
> bit, and it doesn't play well with vim's emacs output parsing stuff, due
> to the extraneous stuff tacked on ahead of and before the compiler
> output. instead of bitching, i wrote a TerseLogger.java and made a
> patch based on the 9.19 nightly, both of which are attached.
>
> one architectural thing i should mention, is that i was somewhat annoyed
> by the necessity of having to pass this in from the command line, but
> after taking a peek at the init code, the project data is not parsed at
> the point that the log listeners are added. imho, log listeners should
> be added after the project data is populated, so they can be specified
> in the build.xml file. ant related config file errors shouldn't wind up
> in my editors parser anyway. in general, there seems to be alot of
> extra text being tacked onto the compiler output *outside* of the
> logging system (name of config file, "build.xml:24: Compile failed,
> messages should have been provided." etc), which makes trying to alter
> the logging system kind of a pain, since chances are you don't want that
> info. my $.02 on that.
>
> a note on the patch: it seems to me alot of people might like to
> subclass DefaultLogger instead of implementing the somewhat onerous
> BuildLogger interface, so that's why the visibility change. at least
> make an adapter or something.
>
> cheers, and thanks for making ant.
>
> --
> M. Looney
> Lead Programmer
> WebHelp.com
>
> ------------------------------------------------------------------------
> --- DefaultLogger.orig Tue Sep 19 00:03:20 2000
> +++ DefaultLogger.java Tue Sep 19 14:25:37 2000
> @@ -62,16 +62,16 @@
> * any messages that get logged.
> */
> public class DefaultLogger implements BuildLogger {
> - private static int LEFT_COLUMN_SIZE = 12;
> + protected static int LEFT_COLUMN_SIZE = 12;
>
> - private PrintStream out;
> - private PrintStream err;
> - private int msgOutputLevel;
> + protected PrintStream out;
> + protected PrintStream err;
> + protected int msgOutputLevel;
> private long startTime = System.currentTimeMillis();
>
> private static String lSep = System.getProperty("line.separator");
>
> - private boolean emacsMode = false;
> + protected boolean emacsMode = false;
>
> /**
> * Set the msgOutputLevel this logger is to respond to.
>
> ------------------------------------------------------------------------
> /*
> * The Apache Software License, Version 1.1
> *
> * Copyright (c) 1999 The Apache Software Foundation. All rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or without
> * modification, are permitted provided that the following conditions
> * are met:
> *
> * 1. Redistributions of source code must retain the above copyright
> * notice, this list of conditions and the following disclaimer.
> *
> * 2. Redistributions in binary form must reproduce the above copyright
> * notice, this list of conditions and the following disclaimer in
> * the documentation and/or other materials provided with the
> * distribution.
> *
> * 3. The end-user documentation included with the redistribution, if
> * any, must include the following acknowlegement:
> * "This product includes software developed by the
> * Apache Software Foundation (http://www.apache.org/)."
> * Alternately, this acknowlegement may appear in the software itself,
> * if and wherever such third-party acknowlegements normally appear.
> *
> * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
> * Foundation" must not be used to endorse or promote products derived
> * from this software without prior written permission. For written
> * permission, please contact [EMAIL PROTECTED]
> *
> * 5. Products derived from this software may not be called "Apache"
> * nor may "Apache" appear in their names without prior written
> * permission of the Apache Group.
> *
> * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
> * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
> * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
> * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
> * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> * SUCH DAMAGE.
> * ====================================================================
> *
> * This software consists of voluntary contributions made by many
> * individuals on behalf of the Apache Software Foundation. For more
> * information on the Apache Software Foundation, please see
> * <http://www.apache.org/>.
> */
>
> package org.apache.tools.ant;
>
> import java.io.*;
>
> /**
> * Writes more terse output.
> * @author [EMAIL PROTECTED]
> */
> public class TerseLogger extends DefaultLogger {
>
>
> /**
> * Prints any errors the occured during the build.
> */
> public void buildFinished(BuildEvent event) {
> Throwable error = event.getException();
> if (error != null) {
> if (error instanceof BuildException) {
> err.println(error.toString());
> Throwable nested = ((BuildException)error).getException();
> if (nested != null) {
> nested.printStackTrace(err);
> }
> }else {
> error.printStackTrace(err);
> }
> }
> }
>
> /**
> Does nothing.
> */
> public void targetStarted(BuildEvent event) {
> //noop this.
> }
>
> /**
> Prints out terse errors that emacs/vi can understand and jump to.
> */
> public void messageLogged(BuildEvent event) {
> PrintStream logTo = event.getPriority() == Project.MSG_ERR ? err :
> out;
> // Filter out messages based on priority
> if (event.getPriority() <= msgOutputLevel) {
> // Print out the name of the task if we're in one
> if (event.getTask() != null) {
> String name = event.getTask().getTaskName();
> if (!emacsMode) {
> String msg="";
> for (int i = 0; i < (LEFT_COLUMN_SIZE - msg.length());
> i++) {
> logTo.print(" ");
> }
> logTo.print(msg);
> }
> }
> // Print the message
> logTo.println(event.getMessage());
> }
> }
>
> }