Return-Path: Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 26203 invoked from network); 21 Jun 2000 17:34:14 -0000 Received: from fep6.mail.ozemail.net (203.2.192.123) by locus.apache.org with SMTP; 21 Jun 2000 17:34:08 -0000 Received: from cognetnt (2Cust81.tnt3.syd2.da.uu.net [63.12.149.81]) by fep6.mail.ozemail.net (8.9.0/8.6.12) with SMTP id AAA15531 for ; Thu, 22 Jun 2000 00:55:36 +1000 (EST) From: "Conor MacNeill" To: Subject: RE: [PATCH] build events Date: Thu, 22 Jun 2000 00:54:24 +1000 Message-ID: <001a01bfdb90$97437fa0$80dc1fcb@cognet.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0 In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 Importance: Normal X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N Matt, I am looking at applying your patch to support build events, which looks like a nice idea. One problem which arises is that your changes will break the NetRexxC optional task, since that task calls Project.getOutput(), which you have removed. Can you have a look at what changes need to be made to this task to work with your changes. I don't have NetRexx installed so I can't verify the task will compile anyway :-(. I think we should also look at removing the System.exit calls made by ant (we complain enough about other classes that do this :-). There are two in Main.java and one in Project.java. I think the two in Main should simply propagate the exception in place of the System.exit. The one in Project should probably be converted to a BuildException. What do you think? Conor -- Conor MacNeill Home: conor@m64.com Work: conor@cortexebusiness.com.au Web: www.cortexebusiness.com.au > -----Original Message----- > From: mpfoemme@ThoughtWorks.com [mailto:mpfoemme@ThoughtWorks.com] > Sent: Monday, 19 June 2000 12:31 > To: ant-dev@jakarta.apache.org > Subject: [PATCH] build events > > > ok, here's a first attempt to add events to Ant. The basic idea is to keep > the core build engine "clean" and free of any presentation logic, and to > make it easier to extend Ant with other features without cluttering up the > core. To do this, I've defined a BuildListener interface and added an > "addBuildListener" method to Project that can be used to register listener > objects. Listeners could be implemented to generate reports, send out > emails when the build is complete, create a bill of materials, etc... > > The only new functionality visible to the end-user is a "-listener" option > on the command line that will let you specify the name of a class. An > instance of this class will be added as a listener to the project. I've > included a listener that will generate an XML log file, which you can use > by typing the command below. I've also included a simple stylesheet to > display the generated XML: > > build -listener org.apache.tools.ant.XmlLogger > > (See attached file: events.jar) > > Matt Foemmel > ThoughtWorks, Inc. > ----- Forwarded by Matthew P Foemmel/Corporate/ThoughtWorks/US on > 06/18/2000 05:51 AM ----- > > > Matthew P > > Foemmel To: > ant-dev@jakarta.apache.org > cc: > > 06/14/2000 Subject: build > events > 05:39 PM > > > > > > > > > I've made a few changes to Ant for my project here, and I'd like some > feedback on whether its worth cleaning up and submitting as a patch. > Basically, we needed a way to generate an XML file with a summary of what > errors happened during the build. To do this cleanly, I ended up > implementing event/listener classes so that one can add listeners to a > project and be notified when various things happen. The classes look > something like: > > public class BuildEvent extends java.util.EventObject { > public Project getProject(); > public Target getTarget(); > public Task getTask(); > public Throwable getException(); > public String getMessage(); > public int getMessageLevel(); > } > > public interface BuildListener extends java.util.EventListener { > public void buildStarted(BuildEvent event); > public void buildFinished(BuildEvent event); > > public void targetStarted(BuildEvent event); > public void targetFinished(BuildEvent event); > > public void taskStarted(BuildEvent event); > public void taskFinished(BuildEvent event); > > public void messageLogged(BuildEvent event); > } > > public class Project { > public void addBuildListener(BuildListener listener); > ... > } > > Then I simply defined an XmlLogger class that dumped whatever XML I wanted > into a file, and added it as a listener to the Project. I was also able to > move all of the "user interface" code for Ant (ie all of the out.println > ()'s) into Main.java so that it was all in one place by making it a > BuildListener. The makes the rest of the code cleaner if we want to create > a gui version of Ant, say. It also makes it easy to create listeners to do > profiling, debugging, etc... > > Is this worth pursuing? >