gant output (javac in this case)

View: New views
1 Messages — Rating Filter:   Alert me  

gant output (javac in this case)

by Eric Van Dewoestine :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This was mentioned in GANT-77[1], but since that ticket has been
closed I figured I'd pose this on the mailing list.

When using the javac ant task from gant, compiler output does not
retain the task prefix notation.

Example running with straight gant:

    [javac] Compiling 1 source file to /foo/bar
/foo/bar/Baz.java:10: <identifier> expected
  pivate static void main(String[] args){
        ^
1 error

Example running from within ant (note the [gant] prefix instead of
[javac]):

    [javac] Compiling 1 source file to /foo/bar
     [gant] /foo/bar/Baz.java:10: <identifier> expected
     [gant]   pivate static void main(String[] args){
     [gant]         ^
     [gant] 1 error


I was able to resolve the output for both of these scenarios by adding
the following code (copied from ant's Main.java) to the
processTargets(String,List<String>) method of gant/Gant.groovy:

System.setOut(new PrintStream(new DemuxOutputStream(binding.ant.project, false)));
System.setErr(new PrintStream(new DemuxOutputStream(binding.ant.project, true)));

After adding those the output renders as follows:

Straight gant and from ant:

    [javac] Compiling 1 source file to /foo/bar
    [javac] /foo/bar/Baz.java:10: <identifier> expected
    [javac]   pivate static void main(String[] args){
    [javac]         ^
    [javac] 1 error


[1] http://jira.codehaus.org/browse/GANT-77

--
eric

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email