ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Knorr <Christian.Kn...@space.eads.net>
Subject Re: SubAnt output
Date Fri, 02 Jul 2004 07:30:00 GMT
I'm not one of the gurus but as far as I understood the mechanism the
logger has to deal with output on standard out and standard error in
addition to the builtin methods which might be called by task
implementations.
In my case we had such a tool (javac) output to standard error. To
identify the correct target the project has a hashtable to recognize its
last active task/target. The responsibility to catch standard out and
standard error is with the top-level project, so the last active task to
be found is the SubAnt task. The fix delegates this to its Ant
sub-project if it is currently active and this project can now find the
according (now correct!) task.
I don't know if timing/synchronization has to be considered when
accessing the Ant sub-project at least it works in our scenario. ;)

Hope this helps,
Christian


Dominique Devienne wrote:

> Cool. Thanks for fixing this. Even though it's a bit late, I would like this
> patch to make it to 1.6.2. Does anyone object?
> 
> But on a different note, even though I looked at the patch, I'm not sure I
> understand why adding these methods fixes the problem (as was involved in
> writing SubAnt.java initially). I would have thought that executing the
> nested Ant would have been enough to properly nest the messages.
> 
> Could someone savvy with the Ant logging mechanism explain/describe this
> mechanism and why this patch fixes the issue here!?
> 
> Christian? Conor? Stefan? Antoine? Peter? Anyone?
> 
> Thanks, --DD
> 
> -----Original Message-----
> From: Christian Knorr
> To: dev@ant.apache.org
> Sent: 7/1/2004 7:00 AM
> Subject: SubAnt output
> 
> Hi,
> 
> I am new to this list. By browsing the archives I could not find
> anything related to my problem but forgive me if it has already been
> mentioned:
> 
> In our hierarchical build structure we use the SubAnt task to delegate
> all tasks to our components specific build-scripts. In combination with
> CruiseControl we realized that the XML output generated by the XMLLogger
> does not represent a correct correlation of messages to tasks when using
> SubAnt:
> 
> Buildfile: build.xml
> <?xml version="1.0" encoding="UTF-8" ?>
> <?xml-stylesheet type="text/xsl" href="log.xsl"?>
> 
> <build error="D:\prj\test\ant\build.xml:6: Following error occured while
> executing this line
> D:\prj\test\ant\sub\build.xml:6: Compile failed; see the compiler error
> output for details." time="1 second">
> 	<target name="build" time="1 second">
> 		<task location="D:\prj\test\ant\build.xml:6: "
> name="subant" time="1 second">
> 			<message
> priority="warn"><![CDATA[D:\prj\test\ant\sub\src\Test.java:4: cannot
> resolve symbol]]></message>
> 			<message priority="warn"><![CDATA[symbol  :
> method printer ()]]></message>
> 			<message priority="warn"><![CDATA[location:
> class java.io.PrintStream]]></message>
> 			<message priority="warn"><![CDATA[
> System.out.printer();]]></message>
> 			<message priority="warn"><![CDATA[
> ^]]></message>
> 			<message priority="warn"><![CDATA[1
> error]]></message>
> 			<target name="build" time="0 seconds">
> 				<task
> location="D:\prj\test\ant\sub\build.xml:6: " name="javac" time="0
> seconds">
> 					<message
> priority="info"><![CDATA[Compiling 1 source file]]></message>
> 				</task>
> 			</target>
> 		</task>
> 	</target>
> 	<stacktrace><![CDATA[D:\prj\test\ant\build.xml:6: Following
> error occured while executing this line
> D:\prj\test\ant\sub\build.xml:6: Compile failed; see the compiler error
> output for details.
> 	at
> org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHe
> lper.java:574)
> 	at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:422)
> 	at org.apache.tools.ant.taskdefs.SubAnt.execute(SubAnt.java:219)
> 	at org.apache.tools.ant.taskdefs.SubAnt.execute(SubAnt.java:149)
> 	at
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:306)
> 	at org.apache.tools.ant.Task.perform(Task.java:401)
> 	at org.apache.tools.ant.Target.execute(Target.java:338)
> 	at org.apache.tools.ant.Target.performTasks(Target.java:365)
> 	at org.apache.tools.ant.Project.executeTarget(Project.java:1237)
> 	at
> org.apache.tools.ant.Project.executeTargets(Project.java:1094)
> 	at org.apache.tools.ant.Main.runBuild(Main.java:669)
> 	at org.apache.tools.ant.Main.startAnt(Main.java:220)
> 	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:215)
> 	at org.apache.tools.ant.launch.Launcher.main(Launcher.java:90)
> ]]></stacktrace>
> </build>
> 
> 
> Obviously all the 'message' elements should be children of the 'javac
> task' element. It seems to me that the SubAnt task does not take care of
> the new project which is being created by its child Ant tasks.
> 
> As a quick fix for us I patched the SubAnt task to work similar as the
> Ant task does. But instead of the 'project' variable I made the 'ant'
> variable a field which is only valid during execution of the associated
> project.
> 
> Please let me know if there is anything else I might have missed or if
> this is the way to go. Feel free to apply the patch (which has been
> performed on Ant 1.6.1) to the Ant sources (although I guess there is a
> much cleaner way to accomplish this).
> 
> Cheers,
> Christian
> 
> P.S.: In addition to the patch file I also added the build files to
> reproduce the erroneous behaviour.
> ___________________________________________________________
> EADS SPACE Transportation - TE 55 - Phone: +49-421-539-5673
> 
> 
>  <<subAntOutputStructure.patch>>  <<ATT37308.txt>> 
> 



-- 
___________________________________________________________
EADS SPACE Transportation - TE 55 - Phone: +49-421-539-5673


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


Mime
View raw message