ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simeon Fitch <meta...@yahoo.com>
Subject RE: Why does the echo task output to System.out? (Was: RE: [submi t] I ntegration of Ant into Visual Age for Java)
Date Sat, 18 Nov 2000 01:37:52 GMT

--- Jose  Alberto Fernandez <JFernandez@viquity.com> wrote:
> Replying to my own message.
> 
> I think the real problem demonstrated by <echo> is the fact that ANT was
> not
> defined with embbeding in mind. 

I agree whole heartedly! ;-) But I think we are heading in the right
direction (and I'm waiting with great anticipation for duncan's offering).

> For example we should not be considering
> System.out as the standard output of ANT, instead we should provide
> an API that allows associating a standard output with an executing
> project:
> 
> 	Project p = ProjectFactory.createProject(.....);
> 	p.setOut(gui.getConsole());
>       p.execute().

Actually, I much prefer the model we have now, where a log message results
in a BuildEvent being generated containting the contents of the message.
Then in command line mode you do what is done now, which is to create a
listener that dumps the events to System.out. And in GUI mode I register a
listener associated with the console and dump the output to the window (if
it passes the filtering criteria. The console also much rather have the
context that the BuildEvent brings with it as it can be used for smart
behavior, from context sensitive colorization or IDE interaction.

> 
> <echo>'s code should be:
> 
> 	project.getOut().print(message);

I think in the long run the BuildEvent approch provides us with more
flexibility and control:

        BuildEvent e = new BuildEvent(message, loglevel);
        fireEvent(e);
        if(output != null) {
           output.write(message);
        }

sim



__________________________________________________
Do You Yahoo!?
Yahoo! Calendar - Get organized for the holidays!
http://calendar.yahoo.com/

Mime
View raw message