ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Bayer \(abayer\)" <aba...@cisco.com>
Subject FW: Reporting build success/failure in <ant>/<subant>'s output log file?
Date Wed, 02 May 2007 18:58:27 GMT
Hi all -
	I sent this to the user list, but the dev list might be a better
audience. Thanks.

Andrew Bayer 

-----Original Message-----
From: Andrew Bayer (abayer) 
Sent: Tuesday, May 01, 2007 10:36 AM
To: user@ant.apache.org
Subject: Reporting build success/failure in <ant>/<subant>'s output log
file?

Hi -
	I'm working on a project that builds a number of subprojects in
a dynamically-determined order, based on some information we define in
properties. The problem I'm running into is in logging the subprojects -
<ant> (and therefore <subant>) hardcodes its subproject's build listener
as DefaultLogger at log level INFO. In a perfect world, I'd like to be
able to set that log level myself, but the more significant issue is
that I can't just look at the subproject's logfile and see whether it
failed or passed. The subprojects are not just Java - we have macro'd
wrappers around calls to InstallShield and Visual Studio on Windows,
among other things - so it's not like there's an easy pattern to look
for in case of failure.

	In an earlier incarnation of this project, I extended Ant.java
and basically rewrote it to use a custom-set log level, to return
properties (like ant-contrib's <antfetch>, but also allowing for
wildcards), to use a failonerror attribute like <subant>, and to run
newProject.fireBuildFinished after executing the subproject, so that we
got either BUILD SUCCESSFUL or BUILD FAILED in the subproject's log
file. I got the older version of the project working with Ant 1.7, but
it was an ugly and painful process that I'd really like to avoid having
to go through again when Ant changes down the road. The new version no
longer needs the returned properties, and now that I understand <subant>
better, I think I can use that instead of <ant> and get the failonerror
behavior that way. That leaves only the custom log level and getting
BUILD SUCCESSFUL/BUILD FAILED in the subproject's logs to go.

	I see that fireSubBuildFinished is called in <ant>, but since
the subproject's listener is hardcoded as DefaultLogger, that doesn't do
anything - I can use my own listener for the main project and report the
subproject's results in the main project's logfile, but I really want to
have that go into the subproject's logfile - we have a bunch of other
tools for reporting, integrating with our build management system,
working with an external distribution tool, etc that get run as
subprojects. The subprojects know how to get at the logfiles for the
other subprojects (through the information we're storing in
globally-defined properties), and can therefore determine which
subprojects have failed or passed just by finding the logfile for a
subproject and looking for BUILD SUCCESSFUL/BUILD FAILED. 

	Is there any way to do this without having to subclass Ant.java?
I'm not married to the output being BUILD SUCCESSFUL or BUILD FAILED
specifically - any pass/fail string that I can do a regexp for would be
sufficient. Any help/advice/etc anyone could provide would be greatly
appreciated. Thank you!

Andrew Bayer

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message