Re: Fetch properties with name matching to a regular expression
Thank You Jeffrey.. this is exactly what I am looking far.. -- View this message in context: http://www.nabble.com/Fetch-properties-with-name-matching-to-a-regular-expression-tp25250557p25252566.html Sent from the Ant - Dev mailing list archive at Nabble.com. - To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org For additional commands, e-mail: dev-h...@ant.apache.org
Re: PropertyHelper API
Yes, I think that I added the null return to allow local properties. Peter On Tue, Sep 1, 2009 at 1:08 PM, Matt Bensongudnabr...@yahoo.com wrote: --- On Tue, 9/1/09, Stefan Bodewig bode...@apache.org wrote: From: Stefan Bodewig bode...@apache.org Subject: PropertyHelper API To: dev@ant.apache.org Date: Tuesday, September 1, 2009, 4:59 AM Hi I'm trying to grok the changes to the PropertyHelper in order to document them for 1.8.0 - and maybe to suggest throwing in some more built-in delegates, but that's for a different thread. From what I understand: The default PropertyHelper splits its work into several steps that can be delegated to custom implementations. These steps are: * finding a property reference inside a string. The delegate interface is oata.property.PropertyExpander. There are two built-in expanders, one that finds ${foo} positions the parser after the '}' and says here is property foo' and one that finds $$, positions the parser after the second $ (actually at the second $) and says no property to be seen here. This is the interface I'd implement if I wanted a completely different property syntax. I'd also need to implement it if I wanted to allow nested properties ${${foo}} since the default PropertyExpander doesn't balance braces. Note that the props antlib does provide a NestedPropertyExpander, so you're right on track. * mapping a property to a value The delegate interface is oata.PropertyHelper.PropertyEvaluator. There are two built-in implementations, one implements local properties and one implements the toString: protocol, i.e. ${toString:some-refid} = find-reference-in-project.toString() This is the interface I'd implement if I - want to provide a different protocol like toString: - want to provide a different storage for properties, this would be the reading part of it. Normal project properties are not implemented via PropertyEvaluator but implemented via fallback mechanisms in the default PropertyHelper implementation. PropertyEvaluator can return Object but it will be turned into a String unless the whole string that was expanded is consumed by the property (i.e. ${foo} can become an Object while ${foo} bar van not). PropertyEvaluator can return an instance of the magical oata.property.NullReturn class which means I really really mean it when I say the property expands to null because simply returning null means I don't know this property. * storing the value for a property somewhere The delegate interface is oata.PropertyHelper.PropertySetter. The only built-in implementation is for local properties. This is the interface I'd implement if I - want to provide a different storage for properties, this would be the writing part of it. Normal project properties are not implemented via PropertySetter but implemented via fallback mechanisms in the default PropertyHelper implementation. PropertySetter returns a flag indicating whether it has consumed the property - otherwise the other delegates are consulted and ultimately the fallback to project properties is used. The properthelper task can be used to register custom delegates. Delegates are used in LIFO order that is custom delegates are able to override built-in delegates. Is this correct and somewhat complete (Matt?)? The NullReturn thing, IIRC, was added by Peter. But I think you're correct about it. Everything else sounds correct and complete as well; my proverbial hat is off to you for having compiled this comprehensive piece of documentation. -Matt Stefan - To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org For additional commands, e-mail: dev-h...@ant.apache.org - To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org For additional commands, e-mail: dev-h...@ant.apache.org - To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org For additional commands, e-mail: dev-h...@ant.apache.org
how to call a predefined target or macroin build.xml from Custom Ant task
Hi, I am looking to call a Macro defined in the project though custom task. Similarly calling of target. Both macro and target are defined the build.xml and my java based custom task should be able to call it with min overhead.. i.e with the same overhead as calling the macro from build.xml or calling one target from other either by depends. Regards, Raja Nagendra Kumar, C.T.O www.tejasoft.com -- View this message in context: http://www.nabble.com/how-to-call-a-predefined-target-or-macroin-build.xml-from-Custom-Ant-task-tp25260761p25260761.html Sent from the Ant - Dev mailing list archive at Nabble.com. - To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org For additional commands, e-mail: dev-h...@ant.apache.org
Peformance Task usage from custom task
Hi, Is it possible to set the performance monitoring as described in http://antelope.tigris.org/nonav/docs/manual/bk03ch27.html (i.e enable and disable such data collection) from a custom ant tasks java code. My need to enable monitoring only during the execution of the custom task and remove it once that is executed. Also, I am not interested to change the ant launch time parameters as this would impact entire build completion and not ideal for our needs. Regards, Raja Nagendra Kumar, C.T.O www.tejasoft.com -- View this message in context: http://www.nabble.com/Peformance-Task-usage-from-custom-task-tp25260860p25260860.html Sent from the Ant - Dev mailing list archive at Nabble.com. - To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org For additional commands, e-mail: dev-h...@ant.apache.org
Re: Peformance Task usage from custom task
From a custom task, you have access to a Project object, which has both add and remove build listener methods, which means you should be able to add and remove listeners on the fly. I haven't tried this, but I don't see why it wouldn't work. Dale On Wed, Sep 2, 2009 at 10:24 AM, Raja Nagendra Kumarnagendra.r...@tejasoft.com wrote: Hi, Is it possible to set the performance monitoring as described in http://antelope.tigris.org/nonav/docs/manual/bk03ch27.html (i.e enable and disable such data collection) from a custom ant tasks java code. My need to enable monitoring only during the execution of the custom task and remove it once that is executed. Also, I am not interested to change the ant launch time parameters as this would impact entire build completion and not ideal for our needs. Regards, Raja Nagendra Kumar, C.T.O www.tejasoft.com -- View this message in context: http://www.nabble.com/Peformance-Task-usage-from-custom-task-tp25260860p25260860.html Sent from the Ant - Dev mailing list archive at Nabble.com. - To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org For additional commands, e-mail: dev-h...@ant.apache.org - To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org For additional commands, e-mail: dev-h...@ant.apache.org
Re: how to call a predefined target or macroin build.xml from Custom Ant task
Hi, I see there is a way to execut target using getProject().executeTarget().. but don't find a way to execute the macro. Any pointers pl. Regards, Nagendra -- View this message in context: http://www.nabble.com/how-to-call-a-predefined-target-or-macroin-build.xml-from-Custom-Ant-task-tp25260761p25263010.html Sent from the Ant - Dev mailing list archive at Nabble.com. - To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org For additional commands, e-mail: dev-h...@ant.apache.org
Re: Peformance Task usage from custom task
Hi Dale, Thank you for the pointer. Tried this in custom ant askgetProject().addBuildListener(new net.sf.antcontrib.perf.AntPerformanceListener()); this at the end of the build give the below exception.. java.lang.NullPointerException at net.sf.antcontrib.perf.AntPerformanceListener.buildFinished(AntPerfor manceListener.java:62) at org.apache.tools.ant.Project.fireBuildFinished(Project.java:2037) at org.apache.tools.ant.Main.runBuild(Main.java:778) at org.apache.tools.ant.Main.startAnt(Main.java:217) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104) Not sure what else needs to be added.. Dale Anson wrote: From a custom task, you have access to a Project object, which has both add and remove build listener methods, which means you should be able to add and remove listeners on the fly. I haven't tried this, but I don't see why it wouldn't work. Dale -- View this message in context: http://www.nabble.com/Peformance-Task-usage-from-custom-task-tp25260860p25263224.html Sent from the Ant - Dev mailing list archive at Nabble.com. - To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org For additional commands, e-mail: dev-h...@ant.apache.org
[External Task] changing URL for jarpatch task
1271a1272,1298 subsection name=JarPatch pJarPatch is a task that generates a zip file resulting of the diff between the content of 2 jar files. br/ The resulting diff file can be use as a patch for a previous installation (just ensure that the generated patch.zip file is located on the CLASSPATH before the patched oldJar jar file)/p table class=externals tr thCompatibility:/th tdAnt 1.5 and later/td /tr tr thURL:/th tda href=http://norb.dnsalias.org/ant/;http://norb.dnsalias.org/ant//a/td /tr tr thContact:/th tda href=mailto:norbert.barb...@gmail.com;Norbert Barbosa/a/td /tr tr thLicense:/th tdLGPL License/td /tr /table /subsection - To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org For additional commands, e-mail: dev-h...@ant.apache.org
AW: Peformance Task usage from custom task
According to your stacktrace the NPE occurs in line 62 of the listener Its source is available here: http://ant-contrib.svn.sourceforge.net/viewvc/ant-contrib/ant-contrib/trunk/src/main/java/net/sf/antcontrib/perf/AntPerformanceListener.java?revision=130view=markup long stop_time = master.stop(); So 'master' is null. This field is initialized in the buildStarted() method, which is invoked before your task started. So try instead your add AntPerformanceListener perf = new net.sf.antcontrib.perf.AntPerformanceListener(); perf.buildStarted(null); // the BuildEvent is not evaluated in that method getProject().addBuildListener(perf); Jan -Ursprüngliche Nachricht- Von: Raja Nagendra Kumar [mailto:nagendra.r...@tejasoft.com] Gesendet: Mittwoch, 2. September 2009 20:37 An: dev@ant.apache.org Betreff: Re: Peformance Task usage from custom task Hi Dale, Thank you for the pointer. Tried this in custom ant ask getProject().addBuildListener(new net.sf.antcontrib.perf.AntPerformanceListener()); this at the end of the build give the below exception.. java.lang.NullPointerException at net.sf.antcontrib.perf.AntPerformanceListener.buildFinished(AntPerfor manceListener.java:62) at org.apache.tools.ant.Project.fireBuildFinished(Project.java:2037) at org.apache.tools.ant.Main.runBuild(Main.java:778) at org.apache.tools.ant.Main.startAnt(Main.java:217) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104) Not sure what else needs to be added.. Dale Anson wrote: From a custom task, you have access to a Project object, which has both add and remove build listener methods, which means you should be able to add and remove listeners on the fly. I haven't tried this, but I don't see why it wouldn't work. Dale -- View this message in context: http://www.nabble.com/Peformance-Task-usage-from-custom-task-tp 25260860p25263224.html Sent from the Ant - Dev mailing list archive at Nabble.com. - To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org For additional commands, e-mail: dev-h...@ant.apache.org - To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org For additional commands, e-mail: dev-h...@ant.apache.org
AW: how to call a predefined target or macroin build.xml from Custom Ant task
project macrodef name=echo1 attribute name=foo default=default/ sequential echo message=@{foo}/ /sequential /macrodef script language=javascript ![CDATA[ // Create the macro like a normal task task = project.createTask(echo1); // and execute it task.execute(); // setting attributes like normal tasks doesnt work because there is no setter // implemented. //task.setFoo(my text); // so the macro uses a dynamic way defined in org.apache.tools.ant.DynamicAttribute here task.setDynamicAttribute(foo, my text); task.execute(); ]] /script /project Jan -Ursprüngliche Nachricht- Von: Raja Nagendra Kumar [mailto:nagendra.r...@tejasoft.com] Gesendet: Mittwoch, 2. September 2009 20:25 An: dev@ant.apache.org Betreff: Re: how to call a predefined target or macroin build.xml from Custom Ant task Hi, I see there is a way to execut target using getProject().executeTarget().. but don't find a way to execute the macro. Any pointers pl. Regards, Nagendra -- View this message in context: http://www.nabble.com/how-to-call-a-predefined-target-or-macroi n-build.xml-from-Custom-Ant-task-tp25260761p25263010.html Sent from the Ant - Dev mailing list archive at Nabble.com. - To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org For additional commands, e-mail: dev-h...@ant.apache.org - To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org For additional commands, e-mail: dev-h...@ant.apache.org