Re: Reasons why Java 7 got me excited about Ant 2
show[9]; Leandro Pezzente sent me a link[10] (thanks, Leandro) that lists > some of the other changes to Java 7 to think about, although it only > mentions the file system changes that JSR 203 introduces in passing. > > [1] http://www.tbray.org/ongoing/When/200x/2008/05/01/Wide-Finder-2 > [2] http://www.tbray.org/ongoing/When/200x/2007/10/30/WF-Results > [3] http://openjdk.java.net/projects/jdk7/features/#f250 > [4] http://drdobbs.com/blogs/jvm/231600403 > [5] http://jaxenter.com/java-7-the-top-8-features-37156.html > [6] http://www.artima.com/lejava/articles/more_new_io.html > [7] http://www.youtube.com/watch?v=yNRS1ssLPdQ > [8] > https://blogs.oracle.com/javaspotlight/entry/java_spotlight_episode_59_alan > [9] http://openjdk.java.net/projects/nio/presentations/TS-5052.pdf > [10] > http://marxsoftware.blogspot.com/2011/03/jdk-7-new-interfaces-classes-enums-and.html > > > - > To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org > For additional commands, e-mail: dev-h...@ant.apache.org > -- Wolfgang Häfelinger - To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org For additional commands, e-mail: dev-h...@ant.apache.org
Re: Regarding exec task
> Is it possible to make the Execute class in ant extensible so that it becomes > possible to plugin our own implementation of Process class. Implement your own ueber-exec taks which uses default exec class when not-on windows and otherwise makes use of your own jvnet-process exec task. On Sun, Feb 12, 2012 at 3:29 PM, Vimil Saju wrote: > > > > > Hi, > > I noticed that on windows, if I use the exec task to run a batch script which > in turn starts other processes then if kill ant then the sub-processes > created by the batch script still continues to run. I did some research on > google and found that the default java implementation of Process.destroy does > not kill the child processes created by a process on windows. I also found > that there are some third party libraries like jvnet that provide the > capability of killing all processes created by a process on windows. > > So I thought of somehow extending the 'Execute' class of ant to use the > functionality of this 3rd party library, but I find that its difficult if not > impossible to extend this class. I can't find a way to provide my > implementation of Process class that does something different when its > destroy method is called. Other core tasks such as java task directly create > an instance of the 'Execute' class which makes it difficult to globally > change how a forked process is destroyed within ant. > > Is it possible to make the Execute class in ant extensible so that it becomes > possible to plugin our own implementation of Process class. > > > Thanks > > Vimil -- Wolfgang Häfelinger - To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org For additional commands, e-mail: dev-h...@ant.apache.org
Re: [DISCUSS] EasyAnt: Ant based pre packaged build system for java projects
> Q1: Does everyone agree that adding before/after to target to Ant 1.8 > is useful and should be done before (in conjunction of) creating > generic build files? Dominique and Peter, could you please explain why you see a need for target attributes "before" and "after" rather than following the Macro path I proposed? Regards, Wolfgang Häfelinger Research & Architecture | Dir. 2.7.0.2 European Patent Office Patentlaan 3-9 | 2288 EE Rijswijk | The Netherlands Tel. +31 (0)70 340 4931 [EMAIL PROTECTED] http://www.epo.org "Dominique Devienne" <[EMAIL PROTECTED]> 14-01-2008 18:39 Please respond to "Ant Developers List" To "Ant Developers List" cc Subject Re: [DISCUSS] EasyAnt: Ant based pre packaged build system for java projects On 1/14/08, Peter Reilly <[EMAIL PROTECTED]> wrote: > On Jan 14, 2008 5:02 PM, Wolfgang Häfelinger <[EMAIL PROTECTED]> wrote: > > Assume also: > > > > > > > > > > > > Do you want this before your "start-server" or after it or > > in parallel? > > > > I would say that if the build file does not specify the order, then the order > is undefined. > > If the order is important, then the build file can enforce an order by > using "depends". > > > > It makes sense Peter. And this already works in Ant, provided we add before/after support to . Q1: Does everyone agree that adding before/after to target to Ant 1.8 is useful and should be done before (in conjunction of) creating generic build files? Q2: Do others feel (like me) that we should also have a mean to override a target's content (task list) while keeping the overridden target's dependency list? Both questions above are independent of using overriding macros... --DD - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [DISCUSS] EasyAnt: Ant based pre packaged build system for java projects
> Q1: Does everyone agree that adding before/after to target to Ant 1.8 > is useful and should be done before (in conjunction of) creating > generic build files? Ok, I'm not a committer - anyhow: I disagree cause you can do the very same thing just with Macros. No need for new target attributes. > Q2: Do others feel (like me) that we should also have a mean to > override a target's content (task list) while keeping the overridden > target's dependency list? This must be the soul of this whole upcoming framework. It's an absolutley must. Regards, Wolfgang Häfelinger Research & Architecture | Dir. 2.7.0.2 European Patent Office Patentlaan 3-9 | 2288 EE Rijswijk | The Netherlands Tel. +31 (0)70 340 4931 [EMAIL PROTECTED] http://www.epo.org "Dominique Devienne" <[EMAIL PROTECTED]> 14-01-2008 18:39 Please respond to "Ant Developers List" To "Ant Developers List" cc Subject Re: [DISCUSS] EasyAnt: Ant based pre packaged build system for java projects On 1/14/08, Peter Reilly <[EMAIL PROTECTED]> wrote: > On Jan 14, 2008 5:02 PM, Wolfgang Häfelinger <[EMAIL PROTECTED]> wrote: > > Assume also: > > > > > > > > > > > > Do you want this before your "start-server" or after it or > > in parallel? > > > > I would say that if the build file does not specify the order, then the order > is undefined. > > If the order is important, then the build file can enforce an order by > using "depends". > > > > It makes sense Peter. And this already works in Ant, provided we add before/after support to . Q1: Does everyone agree that adding before/after to target to Ant 1.8 is useful and should be done before (in conjunction of) creating generic build files? Q2: Do others feel (like me) that we should also have a mean to override a target's content (task list) while keeping the overridden target's dependency list? Both questions above are independent of using overriding macros... --DD - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [DISCUSS] EasyAnt: Ant based pre packaged build system for java projects
Assume also: Do you want this before your "start-server" or after it or in parallel? And you you need to extend Ant with "before" and "after" of course. Regards, Wolfgang Häfelinger Research & Architecture | Dir. 2.7.0.2 European Patent Office Patentlaan 3-9 | 2288 EE Rijswijk | The Netherlands Tel. +31 (0)70 340 4931 [EMAIL PROTECTED] http://www.epo.org "Peter Reilly" <[EMAIL PROTECTED]> 14-01-2008 17:52 Please respond to "Ant Developers List" To "Ant Developers List" cc Subject Re: [DISCUSS] EasyAnt: Ant based pre packaged build system for java projects Why not have something simple like having a "before" and "after" attributes to the element. ... Peter On Jan 14, 2008 4:35 PM, Wolfgang Häfelinger <[EMAIL PROTECTED]> wrote: > > So every concrete simple target like became > > > > > > ... > > > > > > This looks pretty ugly this me! > > I believe that this whole discussion focusses too much on targets > instead of macros. Macros are a very powerfull feature and they > deserve much more attention! > > Why not simply: > > > > > > > > > > > > > > If a user then really need to override "foo", he or she would simply > write in build.xml something like > > > > > before original foo .. > > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [DISCUSS] EasyAnt: Ant based pre packaged build system for java projects
> So every concrete simple target like became > > > ... > > This looks pretty ugly this me! I believe that this whole discussion focusses too much on targets instead of macros. Macros are a very powerfull feature and they deserve much more attention! Why not simply: If a user then really need to override "foo", he or she would simply write in build.xml something like before original foo ..
Re: [DISCUSS] EasyAnt: Ant based pre packaged build system for java projects
>> Is it open source or proprietary? Any link? Trying - unfortunatley for quite a while - to make it Open Source. So, sorry - no source code and no links at this moment. However, I'm quite willing to share some ideas, thoughts and I would not mind even to contribute .. Regards, Wolfgang Häfelinger Research & Architecture | Dir. 2.7.0.2 European Patent Office Patentlaan 3-9 | 2288 EE Rijswijk | The Netherlands Tel. +31 (0)70 340 4931 [EMAIL PROTECTED] http://www.epo.org "Xavier Hanin" <[EMAIL PROTECTED]> 10-01-2008 18:04 Please respond to "Ant Developers List" To "Ant Developers List" cc Subject Re: [DISCUSS] EasyAnt: Ant based pre packaged build system for java projects On Jan 10, 2008 5:29 PM, Wolfgang Häfelinger <[EMAIL PROTECTED]> wrote: > >> it is certainly something that already exists in the wild. Does it? > > It's called AntEpoline and lives currently in The Netherlands, > especially here at the EPO in The Hague. Is it open source or proprietary? Any link? Xavier -- Xavier Hanin - Independent Java Consultant http://xhab.blogspot.com/ http://ant.apache.org/ivy/ http://www.xoocode.org/
RE: [DISCUSS] EasyAnt: Ant based pre packaged build system for java projects
>> it is certainly something that already exists in the wild. Does it? It's called AntEpoline and lives currently in The Netherlands, especially here at the EPO in The Hague. Ca. 90% of our Java projects are using AntEpoline, the remaining mainly Maven I. Here's how a typical build file looks like: All the magic is done via tag : generating standard targets (like clean, compile, test and package) and importing "extension points" (macros) for customization. Such a customization is shown for target "package" (which does nothing else than calling macro "package"). All a developer needs to do is to specify dependencies... Xavier is absolut right in his reflections about Maven. It's so easy for a developer to use it and you get all this nice things, dependency management and all those pretty reports... Regards, Wolfgang Häfelinger Research & Architecture | Dir. 2.7.0.2 European Patent Office Patentlaan 3-9 | 2288 EE Rijswijk | The Netherlands Tel. +31 (0)70 340 4931 [EMAIL PROTECTED] http://www.epo.org "Gilles Scokart" <[EMAIL PROTECTED]> 10-01-2008 17:03 Please respond to "Ant Developers List" To "'Ant Developers List'" cc Subject RE: [DISCUSS] EasyAnt: Ant based pre packaged build system for java projects I already thinked to something similar as well (after having re-written a few time generic build scripts). For me, one of the issues to solve is the problem of packaging a set of reusable build script in a nice way. For that, my idea was to use a "BAR" (Builder Archive). That would be a packaged jar that would include a build script with the life cycle, and some standard 'plug-in' builds scripts extending the life cycle in a standard way, (and potentally also the class for some task). That way, all you need to build is ant, the bar, and your project build script that would set some properties and include the right build files coming from the bar. An other difficulty is to document those reusable build scripts. I have already re-written a few reusable build scripts, but I have to admit that I never managed to get the right level of documentation for it. Finally, I stopped my reflections, thinking that it is certainly something that already exists in the wild. Does it? Gilles > -Original Message- > From: Matt Benson [mailto:[EMAIL PROTECTED] > Sent: jeudi 10 janvier 2008 16:12 > To: Ant Developers List > Subject: Re: [DISCUSS] EasyAnt: Ant based pre packaged build system for java projects > > Xavier: > I think it would be good to have a system that > pretty much bundles alternatives for everything Maven > provides, but without all the black magic that makes > Maven difficult to customize. Basically antlibs for > all parts of the Maven lifecycle, including, > especially, Ivy. :) In fact, I already came up with > my own name for this concept some time back: > "Shaven". ;) > > -Matt > > --- Xavier Hanin <[EMAIL PROTECTED]> wrote: > > > Hi, > > > > It's been a long time since I'm thinking about this, > > and thought it might be > > interesting to share with you and see where the idea > > can go. > > > > I see many developers adopt Maven because they want > > a build system able to > > provide common features with no effort. Most of them > > don't want to spend > > much time writing an Ant script, or have seen or > > heard that maintaining Ant > > build scripts is troublesome. So they choose to use > > Maven only because it's > > easy to use for common use cases: install, write a > > simple pom of a few lines > > or generate it using an archetype, and you're ready > > to compile, test and > > package your new project following the Maven > > standard structure. They also > > get dependency management for free, and with only a > > few more effort they > > have multi module builds, and some nice features > > like code analysis, > > coverage, and a set of report gathered in a web > > site. That's really nice and > > that's what I like about Maven. > > > > But Maven suffers from a lack of flexibility and > > robustness IMHO. And later > > the same people who first adopted Maven because of > > its perceived ease of use > > become frustrated when they need to tweek the system > > to their own needs or > > don't understand how the release plugin work. Then > > some of them go back to > > Ant, first having to go through a sometimes painful > > road to describe their > > whole build system in xml, especially if they aren
Re: ApacheCon Presentation
Hi, >> IMHO dependency fetching is the *worst* of the ideas that Maven has >> popularised. Hmm, dependency fetching is the *best* in my opinion - so we disagree :-) >> Instead of having a controlled build, you get a build where it's >> possible that every single build is done against a different set >> of artifacts How come? A dependency uniquely identifies an artefact and assuming you can't override ( versioned) artefacts - how do you end up with different artefacts? >> I prefer to know which libraries I'm building my code against :) No you don't. This is the biggest mistake of Maven. The version of an artefact is not important at all. However, I don't want to intro- duce this into Ant. I just favour auto-download of artefacts. >> As for the problem you have, different organizations deal with >> the problem in different ways. Kev, you didn't take the most obvious solution into account: 5. REPLACE ANT WITH MAVEN !! And this is a real pitty cause Ant is the better solution, almost at least. Just add some coool features please .. Regards, Wolfgang Häfelinger Research & Architecture | Dir. 2.7.0.2 European Patent Office Patentlaan 3-9 | 2288 EE Rijswijk | The Netherlands Tel. +31 (0)70 340 4931 [EMAIL PROTECTED] http://www.epo.org Kev Jackson <[EMAIL PROTECTED]> 15-11-2007 03:11 Please respond to "Ant Developers List" To Ant Developers List cc Subject Re: ApacheCon Presentation Hi, > I wonder whether Ant/Ivy has a "dependency fetching" mechanism like Maven > has > regarding "plugins". This is what I have in mind: A antlib provides > tasks > and macros and implements them in terms of 3rdparty libraries. Those > libraries > are described in dependencies (perhaps a la Maven). If such a antlib is > used, > Ant will download those 3rdparty stuff some cache directory and adjust > it's > classpath. IMHO dependency fetching is the *worst* of the ideas that Maven has popularised. Instead of having a controlled build, you get a build where it's possible that every single build is done against a different set of artifacts I prefer to know which libraries I'm building my code against :) As for the problem you have, different organizations deal with the problem in different ways. 1 - Place the full Ant (core) + extensions (antlibs etc) under version control as a 'build' project - make this the only sanctioned way of building the rest of your code * This relies on allowing binaries into your scm - sorry * 2 - Use multiple build files and a complex arrangements of classloader task, wget/get etc to pull in the correct dependencies for the build 3 - Edit the ant.bat|ant.sh 4 - Write a wrapper script that calls ant.bat|ant.sh with the correct env setup As you can see in other replies, the 'solution' varies depending on the particular needs of the organization :) Thanks, Kev - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ApacheCon Presentation
Hi Xavier, >> Without Ivy, you can simply use a get task and build a path >> from the downloaded jar. Well, but that implies that each and every build script (in thousands of projects) need to include such a "bootstrap". Something like you code example is what I want to "burry" in the Ant core. Just the namespace implies the artefacts to be used. Regards, Wolfgang Häfelinger Research & Architecture | Dir. 2.7.0.2 European Patent Office Patentlaan 3-9 | 2288 EE Rijswijk | The Netherlands Tel. +31 (0)70 340 4931 [EMAIL PROTECTED] http://www.epo.org "Xavier Hanin" <[EMAIL PROTECTED]> 14-11-2007 23:29 Please respond to "Ant Developers List" To "Ant Developers List" cc Subject Re: ApacheCon Presentation Here's what we do in Ivy build to use emma (this is just an example): With cleaner metadata using only one ivy:cachepath would be enough. Without Ivy, you can simply use a get task and build a path from the downloaded jar. That's what we suggest to do to "install" Ivy itself if you want to use clean Ant install (since using Ivy for that is obviously not an option :-)). Xavier On Nov 14, 2007 3:07 PM, Wolfgang Häfelinger <[EMAIL PROTECTED]> wrote: > Hey Kev, > > I just browsed your presentation and came across page 3/54 where I'm > reading > > * Simple fix...place all third-party jars in $ANT_HOME/lib > > Honestly, putting something into Ant's lib directory is really ugly and > all > those alternatives ($HOME/.ant etc) do not solve the overall problem. > > My/our problem is that we would like to checkout a project from a > source > repository and then just call Ant to build it. > > That's the theory, but all but most trivial scripts I've seen have > customized > Ant. So they all need all those tiny little antlib jars. And that's why > you > need to resolve all those class-not-found-exceptions, very annoying > actually. > > I wonder whether Ant/Ivy has a "dependency fetching" mechanism like Maven > has > regarding "plugins". This is what I have in mind: A antlib provides > tasks > and macros and implements them in terms of 3rdparty libraries. Those > libraries > are described in dependencies (perhaps a la Maven). If such a antlib is > used, > Ant will download those 3rdparty stuff some cache directory and adjust > it's > classpath. > > Does such a feature exist? Is such a feature reasonable? Am I the only one > who > is annoyed by putting 3rdparty libs in Ant's home directory? > > Regards, > > Wolfgang Häfelinger > Research & Architecture | Dir. 2.7.0.2 > European Patent Office > Patentlaan 3-9 | 2288 EE Rijswijk | The Netherlands > Tel. +31 (0)70 340 4931 > [EMAIL PROTECTED] > http://www.epo.org > > > > > Kev Jackson <[EMAIL PROTECTED]> > 13-11-2007 03:02 > Please respond to > "Ant Developers List" > > > To > Ant Developers List , Ant Users List > <[EMAIL PROTECTED]> > cc > > Subject > ApacheCon Presentation > > > > > > > Hi all, > > As some of you probably know already, the HK OSSummit has been canceled > due to lack of attendees. > > But as I've already prepared my presentation (which will now not be > aired publicly), feel free to browse/peruse yourselves without my witty > voiceover > > http://people.apache.org/~kevj/ossummit/extending-ant.html< http://people.apache.org/%7Ekevj/ossummit/extending-ant.html> > > If anyone is presenting at ApacheCon US / ApacheCon EU and wants to > take/modify material in the presentation, feel free - I hope it gets > some use. > > I cover: > * Antlibs (same material as my previous presentation) > * BuildListener/Logger > * > * Basic IVY > > > The format is S5 which is basically html + javascript + css. > > Thanks, > Kev > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- Xavier Hanin - Independent Java Consultant http://xhab.blogspot.com/ http://ant.apache.org/ivy/ http://www.xoocode.org/
Re: ApacheCon Presentation
>> Then again it's these people, Peter first, who enhance Ant to >> support better models for the future, so power to you guys ;-) Cool, so we can expect 'auto-download' to be a feature of 1.7.1? Serious, just to pull off some kind of demo implementation: is there some kind of namespace interceptor in Ant's source code? I'm just asking cause I have never seen such a beast... Regards, Wolfgang Häfelinger Research & Architecture | Dir. 2.7.0.2 European Patent Office Patentlaan 3-9 | 2288 EE Rijswijk | The Netherlands Tel. +31 (0)70 340 4931 [EMAIL PROTECTED] http://www.epo.org "Dominique Devienne" <[EMAIL PROTECTED]> 14-11-2007 17:40 Please respond to "Ant Developers List" To "Ant Developers List" cc Subject Re: ApacheCon Presentation On Nov 14, 2007 9:50 AM, Peter Reilly <[EMAIL PROTECTED]> wrote: > On Nov 14, 2007 3:18 PM, Dominique Devienne <[EMAIL PROTECTED]> wrote: > > On Nov 14, 2007 8:07 AM, Wolfgang Häfelinger <[EMAIL PROTECTED]> wrote: > > > * Simple fix...place all third-party jars in $ANT_HOME/lib > > > > > > Honestly, putting something into Ant's lib directory is really ugly and all > > > those alternatives ($HOME/.ant etc) do not solve the overall problem. > > I would argue that using -lib is nearly as ugly as placing jars in $ANT_HOME/lib > (but not as bad!!) > > On projects at work, that I am involved in, I insist on > using "clean room" ant 1.7.0 and "clean room" java 1.5.* (or higher). > > For each antlib / extension that is needed, I have an ant file that > sets up the extension for-example ant-contrib. Given a corporate environment (as opposed to OSS), I believe it's entirely OK, and even A-Good-ThingTM to have an official and properly configured Ant version which is the only *official* and *sanctioned* way to run the builds, which is under source control. The allows proper control of the dependencies, and allows to manage Ant versions to be used by the different branches/versions of the software, and most importantly it's easy! Check out the proper branch of the build tools, and of the software to be built, and you're in business. Just add JDK and shake, and here you go, instant CM ;-) I'm sure your build organization rocks Peter, but I personally view it as more complex and more trouble that I was willing to live with myself (I'm not even sure I could pull such a setup off myself in fact!). Different people draw the line between the absolute ideal and the practical at different places. Having a centralized Ant under SCM was the thing for me, and obviously others find it unacceptable, and have to live with my complex setups. Then again it's these people, Peter first, who enhance Ant to support better models for the future, so power to you guys ;-) Cheers, --DD - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ApacheCon Presentation
Peter, I'm missing the 'download' part in the example you gave. It appears that you expect your jars already to be present in ${commons.dir}, and even in a nicely structured way. To much too assume. It should all be handled by Ant's core .. Regards, Wolfgang Häfelinger Research & Architecture | Dir. 2.7.0.2 European Patent Office Patentlaan 3-9 | 2288 EE Rijswijk | The Netherlands Tel. +31 (0)70 340 4931 [EMAIL PROTECTED] http://www.epo.org "Peter Reilly" <[EMAIL PROTECTED]> 14-11-2007 16:51 Please respond to "Ant Developers List" To "Ant Developers List" cc Subject Re: ApacheCon Presentation On Nov 14, 2007 3:18 PM, Dominique Devienne <[EMAIL PROTECTED]> wrote: > On Nov 14, 2007 8:07 AM, Wolfgang Häfelinger <[EMAIL PROTECTED]> wrote: > > * Simple fix...place all third-party jars in $ANT_HOME/lib > > > > Honestly, putting something into Ant's lib directory is really ugly and all > > those alternatives ($HOME/.ant etc) do not solve the overall problem. > > If the project you checkout includes its own Ant extensions, and you > want to use a stock Ant release, you still have the option of using > the -lib command line switch to tell the Ant launcher to use your > custom libs. Using -lib is just as effective as putting the jars in > $ANT_HOME/lib I believe. Then you only need a little wrapper > build.bat/.sh script (checked in) to launch Ant properly configured > for the projects. I would argue that using -lib is nearly as ugly as placing jars in $ANT_HOME/lib (but not as bad!!) On projects at work, that I am involved in, I insist on using "clean room" ant 1.7.0 and "clean room" java 1.5.* (or higher). For each antlib / extension that is needed, I have an ant file that sets up the extension for-example ant-contrib. These setup files are called from a setup.xml: Where necessary I use the {antlib:net.jtools.classloadertask}classloader task (http://enitsys.sourceforge.net/ant-classloadertask/) to shovel jars into the project classloader - necessary for example to use beanshell with bsf on ant 1.7.0. I also found in necessary to use it to avoid classloading issues with coverage tools on axis tasks. Peter > > Sure, auto-download of dependencies would be nice, and with Ivy part > of the Ant family, it may come sooner rather than later, but in the > mean time, -lib is a very effective and easy way to work around your > issue it sounds like. --DD > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ApacheCon Presentation
Dominique, >> If the project you checkout includes its own Ant extensions I does not and I also believe it should not. I believe it's a rather good rule that a source repository contains sources and not binaries. Perhaps I should also mention that I'm not talking here about one or two projects. It's more a matter of hundreds or even thousands. >> Using -lib is just as effective as putting the jars in >> $ANT_HOME/lib I believe [..] >> [..] >> Then you only need a little wrapper build.bat/.sh [..] The problem starts already with the fact that you need to maintain two scripts (Windows and Unix). Then you need to download somehow. You can't assume that wget is around. So my script generates/contains a Ant script 'fetch.xml' which I would need to call to my plugins in place (using get task to download). I optimize this script to call Ant only in case something is missing Then you have the problem that you just add another complexity level, i.e. the script. If something is going wrong you firstly start to blame this script .. Finally there's the scenario where the build script is implemented in terms of a framework sitting on top of Ant. This frameworks builds the project, the developer does not need to care about the details. If this framework requires a new dependency, then I would need to change each "build.bat/.sh" script around. I could also optimize this by letting my down- loader fetch a list of artefacts to be downloaded. Then I only need to change this list on a central server ... I went a bit a different path in my framework case. I just created one big fat binary containing all those extension jars. So I just need to ask our users to update a single jar once in a while. It works although it's another ugly hack. I'm not a fan of Maven, but this automatic "plugin" download feature is really a good thing! >> Sure, auto-download of dependencies would be nice, and with Ivy >> part of the Ant family, it may come sooner rather than later, [..] I'm in favor of "sooner" :-) Of course, if I'm the only one missing "auto-download" then it doesn't make sense to ask for it. Regards, Wolfgang Häfelinger Research & Architecture | Dir. 2.7.0.2 European Patent Office Patentlaan 3-9 | 2288 EE Rijswijk | The Netherlands Tel. +31 (0)70 340 4931 [EMAIL PROTECTED] http://www.epo.org "Dominique Devienne" <[EMAIL PROTECTED]> 14-11-2007 16:18 Please respond to "Ant Developers List" To "Ant Developers List" cc Subject Re: ApacheCon Presentation On Nov 14, 2007 8:07 AM, Wolfgang Häfelinger <[EMAIL PROTECTED]> wrote: > * Simple fix...place all third-party jars in $ANT_HOME/lib > > Honestly, putting something into Ant's lib directory is really ugly and all > those alternatives ($HOME/.ant etc) do not solve the overall problem. If the project you checkout includes its own Ant extensions, and you want to use a stock Ant release, you still have the option of using the -lib command line switch to tell the Ant launcher to use your custom libs. Using -lib is just as effective as putting the jars in $ANT_HOME/lib I believe. Then you only need a little wrapper build.bat/.sh script (checked in) to launch Ant properly configured for the projects. Sure, auto-download of dependencies would be nice, and with Ivy part of the Ant family, it may come sooner rather than later, but in the mean time, -lib is a very effective and easy way to work around your issue it sounds like. --DD - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ApacheCon Presentation
Hey Kev, I just browsed your presentation and came across page 3/54 where I'm reading * Simple fix...place all third-party jars in $ANT_HOME/lib Honestly, putting something into Ant's lib directory is really ugly and all those alternatives ($HOME/.ant etc) do not solve the overall problem. My/our problem is that we would like to checkout a project from a source repository and then just call Ant to build it. That's the theory, but all but most trivial scripts I've seen have customized Ant. So they all need all those tiny little antlib jars. And that's why you need to resolve all those class-not-found-exceptions, very annoying actually. I wonder whether Ant/Ivy has a "dependency fetching" mechanism like Maven has regarding "plugins". This is what I have in mind: A antlib provides tasks and macros and implements them in terms of 3rdparty libraries. Those libraries are described in dependencies (perhaps a la Maven). If such a antlib is used, Ant will download those 3rdparty stuff some cache directory and adjust it's classpath. Does such a feature exist? Is such a feature reasonable? Am I the only one who is annoyed by putting 3rdparty libs in Ant's home directory? Regards, Wolfgang Häfelinger Research & Architecture | Dir. 2.7.0.2 European Patent Office Patentlaan 3-9 | 2288 EE Rijswijk | The Netherlands Tel. +31 (0)70 340 4931 [EMAIL PROTECTED] http://www.epo.org Kev Jackson <[EMAIL PROTECTED]> 13-11-2007 03:02 Please respond to "Ant Developers List" To Ant Developers List , Ant Users List <[EMAIL PROTECTED]> cc Subject ApacheCon Presentation Hi all, As some of you probably know already, the HK OSSummit has been canceled due to lack of attendees. But as I've already prepared my presentation (which will now not be aired publicly), feel free to browse/peruse yourselves without my witty voiceover http://people.apache.org/~kevj/ossummit/extending-ant.html If anyone is presenting at ApacheCon US / ApacheCon EU and wants to take/modify material in the presentation, feel free - I hope it gets some use. I cover: * Antlibs (same material as my previous presentation) * BuildListener/Logger * * Basic IVY The format is S5 which is basically html + javascript + css. Thanks, Kev - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Wolfgang Häfelinger is out of the office.
I will be out of the office starting 14-06-2007 and will not return until 20-06-2007. I will respond to your message when I return. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Wolfgang Häfelinger is out of the office.
I will be out of the office starting 11-06-2007 and will not return until 12-06-2007. I will respond to your message when I return. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Wolfgang Häfelinger is out of the office.
I will be out of the office starting 04-04-2007 and will not return until 10-04-2007. I will respond to your message when I return. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Wolfgang Häfelinger is out of the office.
I will be out of the office starting 17-03-2007 and will not return until 26-03-2007. I will respond to your message when I return. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Wolfgang Häfelinger is out of the office.
I will be out of the office starting 23-02-2007 and will not return until 27-02-2007. I will respond to your message when I return. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
tracing macros?
Hey, I'm using macrodef a lot (a really great feature). What I'm looking for is a simple way of tracing which macro is invoked. Something like "entring macro .. ", "leaving macro ..". So derived a Trace class from org.apache.tools.ant.taskdefs.Sequential, some- thing like: public class Trace extends Sequential { public void execute() { // entrer trace statements .. super.execute(); // leaving trace statements .. } } Then I created a task name "trace" and tried something like which unfortunatley does NOT work :-( because Macrodef has a createSequential() method while "lacking" a addSequential(Sequential s) method. Wouldn't it be cool to implementent such a trace task? Or do I miss something? Perhaps Ant (1.7) allows already tracing of macros ??? It would be even cooler if my trace task could figure out automatically that the name of its surrounding macrodef is "test". Is there a way to do that?? Yes, I k n o w that I can put my trace task within the macrodef sequential. This works but it has some disadvantages: - performance - code bloat (would like to keeps things short and simple) Regards, Wolfgang.
Re: Proposed roadmap
>> It may be difficult to have an EL in ant as >> the components/beans (properties and references) >> are not bound by any naming >> rules [..] You have a similar problem in JSP as you are allowed to define a config parameter named "foo-bar". EL will treat ${initParam.foo-bar} as valueof(initParam.foo) - valueof(bar) which is not what you want. However, you can also use ${initParam['foo-bar']} for names not bound to usual rules. >> properties and references have different rules ( >> properties are not meant to be overwritten) EL does not allow you to override properties (or resources). Btw, it would be rather handy to be able to override properties. Here Ant could be a bit less dogmatic. Why not adding an attribute to task property which overrides if desired?? >> and have different namespaces (i.e. one can use the >> same name for a property and for a reference). EL must work on properties, references as well as on any other data type .., i.e. the EL expression ${empty varname ? 'empty' : 'not empty'} must universally work (as it does in JSP). "Peter Reilly" <[EMAIL PROTECTED]> 03-01-2007 16:57 Please respond to "Ant Developers List" To "Ant Developers List" cc Subject Re: Proposed roadmap On 1/3/07, Wolfgang Häfelinger <[EMAIL PROTECTED]> wrote: > >> 3. I dont actually like EL handling as the way > >> any invalid bit the the expression switches the > >> whole thing to null, instead of telling where > >> you've left something undefined. That may just > >> be the JSP2 implementation, of course,. > > I like this actually much more than the Ant way. Too > many times I created funny directories like ${src.dir} > et cetera. So I'm not going to miss this Ant "feature". > It would anyhow only apply for those using EL, for all > others, the old rule would apply (I assume here that > you could define on a higher level to use EL or not ..). It may be difficult to have an EL in ant as the components/beans (properties and references) are not bound by any naming rules - so spaces, dots even < and > are allowed: properties and references have different rules (properties are not meant to be overwritten) and have different namespaces (i.e. one can use the same name for a property and for a reference). Traditionally in ant one uses nested elements in place of an EL. {from ant's build file} but this can get a bit verbose. > > >> 1. I'm not sure how serious it was > > Deadly serious for me ;-) as well as I hope that Peter > has not been joking with regards to "- add logic/control- > flow features from jsp/ant-contrib (for, if, while, try, > var etc) > > >> 2. its a traumatic change > > Kidding? > > > > > > > Steve Loughran <[EMAIL PROTECTED]> > 03-01-2007 14:58 > Please respond to > "Ant Developers List" > > > To > Ant Developers List > cc > > Subject > Re: Proposed roadmap > > > > > > > Wolfgang Häfelinger wrote: > > * 1.9 > > - add EL (?from jsp/jsf - properties or references?) > > > > Since EL is a really cool feature and simplifies JSP development so > much, > > I > > would like to give it a much higher priority (1.7.x)... > > > > 1. I'm not sure how serious it was > 2. its a traumatic change > 3. I dont actually like EL handling as the way any invalid bit the the > expression switches the whole thing to null, instead of telling where > you've left something undefined. That may just be the JSP2 > implementation, of course,. > > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Proposed roadmap
>> 3. I dont actually like EL handling as the way >> any invalid bit the the expression switches the >> whole thing to null, instead of telling where >> you've left something undefined. That may just >> be the JSP2 implementation, of course,. I like this actually much more than the Ant way. Too many times I created funny directories like ${src.dir} et cetera. So I'm not going to miss this Ant "feature". It would anyhow only apply for those using EL, for all others, the old rule would apply (I assume here that you could define on a higher level to use EL or not ..). >> 1. I'm not sure how serious it was Deadly serious for me ;-) as well as I hope that Peter has not been joking with regards to "- add logic/control- flow features from jsp/ant-contrib (for, if, while, try, var etc) >> 2. its a traumatic change Kidding? Steve Loughran <[EMAIL PROTECTED]> 03-01-2007 14:58 Please respond to "Ant Developers List" To Ant Developers List cc Subject Re: Proposed roadmap Wolfgang Häfelinger wrote: > * 1.9 > - add EL (?from jsp/jsf - properties or references?) > > Since EL is a really cool feature and simplifies JSP development so much, > I > would like to give it a much higher priority (1.7.x)... > 1. I'm not sure how serious it was 2. its a traumatic change 3. I dont actually like EL handling as the way any invalid bit the the expression switches the whole thing to null, instead of telling where you've left something undefined. That may just be the JSP2 implementation, of course,. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Proposed roadmap
* 1.9 - add EL (?from jsp/jsf - properties or references?) Since EL is a really cool feature and simplifies JSP development so much, I would like to give it a much higher priority (1.7.x)... it possible to "Peter Reilly" <[EMAIL PROTECTED]> 29-12-2006 17:43 Please respond to "Ant Developers List" To "Ant Developers List" cc Subject Proposed roadmap * 1.7.x - fix bugs - implement some enhancement requests - add some extra attributes to tasks/types (for example fileset dir not present attribute) - add some conditions/resources/filters/mappers - junitize other optional tasks (i.e. allow the needed thirdparty classes to be specified when using the task) - make checkstyle clean - support more java5,6,7 features * 1.8 - add classpath manipulation (classloader task) - add logic/controlflow features from jsp/ant-contrib (for, if, while, try, var etc) - better scripting language support - allow javascript and jruby to create tasks/types natively (beanshell, groovy can do this currently). - import improvements (url support, searchpath support) - if/unless attributes with primative EL (expression language) (ie if="${property.not.present}" will work as if="property.not.present") - restricted types (i.e. roles) - some simple build file generators (like seam-gen) - xmlize the manual goals: - pdf version output - clean html output - easy navigation * 1.9 - add EL (?from jsp/jsf - properties or references?) - unify properties and references - integration with ivy/maven for dependence - ?annotations for tasks? * 2.0 - remove need of xml - unify with maven - unify with raven - ant only runs on java5 - world peace - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Wolfgang Häfelinger is out of the office.
I will be out of the office starting 25-08-2006 and will not return until 05-09-2006. I will respond to your message when I return. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Wolfgang Häfelinger is out of the office.
I will be out of the office starting 29-06-2006 and will not return until 24-07-2006. I will respond to your message when I return. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: using multiple properties in the 'if' and 'unless' conditions
> -What is the existing one you'd recommend? XPath 1.0? Perl? > Pascal-style, Ruby-Style? I implemented the "test" expression logic found in popular shells, left a couple of tests out (like -p, -O etc) and added a couple of usefull tests like -P s => test whether "s" is a reference -R s => test whether "s" is a reference -T s => test whether "s" is a target -M s => test whether "s" is a macro or task ... > what functions to test for. defined/undefied, true/false, equality? and also numerical comparison, older/newer then, length of a string .. > How would I be able to declare and add new functions or operators into the language? You would use the same technique as we are currently using in Ant to install my own property or component handler. -What are we going to use as a parser; the recursive descent thingy built in to java, or use ANTLR to generate our own from the BNF nota I do not have an opinion on this (ANTLR is fine with me, after all I'm one of the contributors :-) -How are we going to test the language? Unit tests etc, where's the probem? -How do we roll it out to other conditional types such as fail? Add a new attribute named "test" (and deprecate "if"). If "if" and "test" are present do something like eval(test) && eval(if). Another idea is to stay with "if" (and "unless") and change it's evaluation on demand: fall back to whatever was there before using "test" Btw, we need to have a quota character. For example Wolfgang. Steve Loughran <[EMAIL PROTECTED]> 26-06-2006 13:17 Please respond to "Ant Developers List" To Ant Developers List cc Subject Re: using multiple properties in the 'if' and 'unless' conditions Wolfgang Häfelinger wrote: >> Which one would you prefer? Or should we invent a new one? > > Use an existing one of course. There could also be more than one, > just supported by a "language" attribute. > >> We do have the "clumsy" XML expression language that we built into the >> condition task and it follows the rest of Ant's "language". > > I do not see your point why an embedded expression language would > not follow Ant's language terms. Perhaps you can elaborate on this > bit further. > >> And regardless which existing language we'd chose, we'd always find >> users who'd find it hard to use - not all Ant users are Java >> developers and are able to read "a && b". > > Users who do not understand feature are not obligied to use them and > I still believe that users quickly get the idea what "a && b" could > mean. After all, you also need a lot of imagniation to understand > what you can do with Ant, right? > > The only problem with "&" is that it is an "XML" character as > well. so clearly then, java booleans are not the obvious choice. -What is the existing one you'd recommend? XPath 1.0? Perl? Pascal-style, Ruby-Style? -what functions to test for. defined/undefied, true/false, equality? -How would I be able to declare and add new functions or operators into the language? -What are we going to use as a parser; the recursive descent thingy built in to java, or use ANTLR to generate our own from the BNF notation. -How are we going to test the language? -How do we roll it out to other conditional types such as fail? I can see a conditional target as a more likely option. -steve - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: using multiple properties in the 'if' and 'unless' conditions
> Which one would you prefer? Or should we invent a new one? Use an existing one of course. There could also be more than one, just supported by a "language" attribute. > We do have the "clumsy" XML expression language that we built into the > condition task and it follows the rest of Ant's "language". I do not see your point why an embedded expression language would not follow Ant's language terms. Perhaps you can elaborate on this bit further. > And regardless which existing language we'd chose, we'd always find > users who'd find it hard to use - not all Ant users are Java > developers and are able to read "a && b". Users who do not understand feature are not obligied to use them and I still believe that users quickly get the idea what "a && b" could mean. After all, you also need a lot of imagniation to understand what you can do with Ant, right? The only problem with "&" is that it is an "XML" character as well. Wolfgang. Stefan Bodewig <[EMAIL PROTECTED]> 25-06-2006 11:42 Please respond to "Ant Developers List" To dev@ant.apache.org cc Subject Re: using multiple properties in the 'if' and 'unless' conditions On Fri, 23 Jun 2006, Wolfgang Häfelinger <[EMAIL PROTECTED]> wrote: > What would so bad introducing an "expression language"? Which one would you prefer? Or should we invent a new one? We do have the "clumsy" XML expression language that we built into the condition task and it follows the rest of Ant's "language". Introducing a different language would mean implementing a different interpreter for it, documenting it an all that. And regardless which existing language we'd chose, we'd always find users who'd find it hard to use - not all Ant users are Java developers and are able to read "a && b". Stefan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: using multiple properties in the 'if' and 'unless' conditions
Just out of curiousity: What would so bad introducing an "expression language"? After all, there's no need to express everything in (clumsy) XML just because we are able to do so. I believe that an expression language, escpecially for testing, would simplify Ant scripting considerably. Wolfgang. Stefan Bodewig <[EMAIL PROTECTED]> 23-06-2006 05:54 Please respond to "Ant Developers List" To dev@ant.apache.org cc Subject Re: using multiple properties in the 'if' and 'unless' conditions On Thu, 22 Jun 2006, Paul Mackay <[EMAIL PROTECTED]> wrote: > Has the possibility of adding multiple conditions to the target 'if' > and 'unless' attributes ever been considered? Yes, but it hasn't come up often after Ant 1.4 ;-) > Are there any reasons why this change would be a bad idea? One of the reasons (and my main one) is that you'd soon need an expression language since simple listing two properties isn't enough? Does if="a,b" mean "either a is set or b" or "a is set and b"? And then the example above doesn't work since "," is a legal character inside of property names, as is " " or any other character. There could be a property named "a,b". Stefan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to access a MacroDef?
Allright - thanks for the hints. Would be nice to clean things up in a further version of Ant ( simple API treating macrodef/task/presetdef/target similar) regarding "dynamic invocation". My scripts/framework is now shorter and much easier to understand. However, this is likely not happen as I'm probably the only one looking for this feature :-))) Cheers, Wolfgang. "Peter Reilly" <[EMAIL PROTECTED]> 12-06-2006 19:30 Please respond to "Ant Developers List" To "Ant Developers List" cc Subject Re: how to access a MacroDef? The work-around for preset is what has to be done in createTask. After create task, or createComponent() is done, one is has a normal java object. It is too late in the life cycle of the object to use unknownelements. One could create unknown elements and runtime configuratables ( see the code in macrodef to do this) but is is quite tricky. In your case it may be easier just to use java reflection to call the setter methods (see introspection helper). It has been a while since I was messing with UnknownElement/ RuntimeConfiguratable/IntrospectionHelper/ProjectHelper2 but I can remember that it was painful! Peter On 6/12/06, Wolfgang Häfelinger <[EMAIL PROTECTED]> wrote: > > Hi Peter, > > I worked around the problem by implementing something like > > obj = componentHelper.createComponent (mymacroname); > if (obj instanceof PreSetDef.PreSetDefinition) { > PreSetDef.PreSetDefinition psd; > psd = (PreSetDef.PreSetDefinition)obj; > obj = psd.createObject(getProject()); > } > else > { > /* try to create task */ > obj = getProject().createTask(this.name); > } > > if(obj instanceof MacroInstance) > { > /* invoke Macro .. */ > } > > which works fine so far. > > Would you mind to have a look how I can pass paramters to a non-macro > Task. It's > not working for me. Here's my code where 'args' just contains a list of > (key,value) > pairs. I'm trying to pass those parameters via this RuntimeConfigurable > class. That's > probably wrong or something is missing. Give me a hint please .. > > if(obj instanceof org.apache.tools.ant.Task) // and n o t a > marcodef > { > RuntimeConfigurable rtc; > org.apache.tools.ant.Task T; > > T = (org.apache.tools.ant.Task)obj; > rtc = T.getRuntimeConfigurableWrapper(); > > for(int i=0;i { > P = (Param)args[i]; > rtc.setAttribute(P.k,P.v); > } > T.execute(); > } > > Cheers, > Wolfgang. > > > > > "Peter Reilly" <[EMAIL PROTECTED]> > 12-06-2006 17:08 > Please respond to > "Ant Developers List" > > > To > "Ant Developers List" > cc > > Subject > Re: how to access a MacroDef? > > > > > > > Thanks, > > I have entered a bug report on this. When I was writing presetdef, > I had a lot of similar problems and as a result there is a number > of places in the code that contain checks for presets being the > result of createCompopent. The code here needs to create the > task that preset points to. Due to change in job, I am not currently > able to modify ant code (need to set up svn at home on windross ;-), > but I will a look. > > Peter > > > On 6/12/06, Wolfgang Häfelinger <[EMAIL PROTECTED]> wrote: > > > > > > > > > > hello, @{msg} > > > > > > > > > > > > > > > > > >import org.apache.tools.ant.taskdefs.MacroInstance ; > >import org.apache.tools.ant.BuildException; > > > >task = project.createTask("hello-there"); // error > > > > > > This will throw a > > > > java.lang.ClassCastException > > at > > org.apache.tools.ant.ComponentHelper.createNewTask (ComponentHelper.java > > :462) > > > > > > here > > > > private Task createNewTask(String taskType) throws BuildException { > > Class c = getComponentClass(taskType); > > if (c == null || !(Task.class.isAssignableFrom (c))) { > > return null; > > } > > Task task = (Task) createComponent(taskType); //=> > > ComponentHelper.java:462 > > if (task == null) { > > return null; > > } > > task.setTaskType(taskType); > > > > // set default value, can be changed by the user > > task.setTaskName(taskType); > > > > project.log(" +Task: " + taskType, Proje
Re: how to access a MacroDef?
Hi Peter, I worked around the problem by implementing something like obj = componentHelper.createComponent (mymacroname); if (obj instanceof PreSetDef.PreSetDefinition) { PreSetDef.PreSetDefinition psd; psd = (PreSetDef.PreSetDefinition)obj; obj = psd.createObject(getProject()); } else { /* try to create task */ obj = getProject().createTask(this.name); } if(obj instanceof MacroInstance) { /* invoke Macro .. */ } which works fine so far. Would you mind to have a look how I can pass paramters to a non-macro Task. It's not working for me. Here's my code where 'args' just contains a list of (key,value) pairs. I'm trying to pass those parameters via this RuntimeConfigurable class. That's probably wrong or something is missing. Give me a hint please .. if(obj instanceof org.apache.tools.ant.Task) // and n o t a marcodef { RuntimeConfigurable rtc; org.apache.tools.ant.Task T; T = (org.apache.tools.ant.Task)obj; rtc = T.getRuntimeConfigurableWrapper(); for(int i=0;i 12-06-2006 17:08 Please respond to "Ant Developers List" To "Ant Developers List" cc Subject Re: how to access a MacroDef? Thanks, I have entered a bug report on this. When I was writing presetdef, I had a lot of similar problems and as a result there is a number of places in the code that contain checks for presets being the result of createCompopent. The code here needs to create the task that preset points to. Due to change in job, I am not currently able to modify ant code (need to set up svn at home on windross ;-), but I will a look. Peter On 6/12/06, Wolfgang Häfelinger <[EMAIL PROTECTED]> wrote: > > > > > hello, @{msg} > > > > > > > > >import org.apache.tools.ant.taskdefs.MacroInstance ; >import org.apache.tools.ant.BuildException; > >task = project.createTask("hello-there"); // error > > > This will throw a > > java.lang.ClassCastException > at > org.apache.tools.ant.ComponentHelper.createNewTask (ComponentHelper.java > :462) > > > here > > private Task createNewTask(String taskType) throws BuildException { > Class c = getComponentClass(taskType); > if (c == null || !(Task.class.isAssignableFrom (c))) { > return null; > } > Task task = (Task) createComponent(taskType); //=> > ComponentHelper.java:462 > if (task == null) { > return null; > } > task.setTaskType(taskType); > > // set default value, can be changed by the user > task.setTaskName(taskType); > > project.log(" +Task: " + taskType, Project.MSG_DEBUG); > return task; > } > > It works for "normal" macros. > > > > > > > > > "Peter Reilly" <[EMAIL PROTECTED]> > 07-06-2006 12:20 > Please respond to > "Ant Developers List" > > > To > "Ant Developers List" > cc > > Subject > Re: how to access a MacroDef? > > > > > > > Since macro defs are tasks, it would be better to use the > project.createTask() method, and not try to use the > internal (although exposed trough the public classes and methods) > mechanizes of Ant. > > > >This is the atest macro > > > > >import org.apache.tools.ant.taskdefs.MacroInstance; > import org.apache.tools.ant.BuildException; >atest = project.createTask("atest"); >if (! (atest instanceof MacroInstance)) { >throw new BuildException("atest is not a macro"); >} >atest.execute(); > > > > It would be necessary to call setOwningTarget as project.createTask() > does not know the current target. > > Peter > > > On 6/7/06, Wolfgang Häfelinger <[EMAIL PROTECTED]> wrote: > > > > Allright, it appears much more easier than expected. > > > > ComponentHelper componenthelper; > > Object obj; > > MacroInstance instance; > > > > componenthelper = ComponentHelper.getComponentHelper(project()); > > obj = componentHelper.createComponent (mymacroname); > > instance= (MacroInstance)obj; > > instance.execute(); > > > > Appears that there's no need to call setProject() or setOwningTarget() > on > > the macro's > > instance. > > > > However, not sure whether this is the "right" way to do. Perhaps Peter > can > > comment > > on this. > > > > Thanks for all help so far. > > >
Re: how to access a MacroDef?
hello, @{msg} import org.apache.tools.ant.taskdefs.MacroInstance; import org.apache.tools.ant.BuildException; task = project.createTask("hello-there"); // error This will throw a java.lang.ClassCastException at org.apache.tools.ant.ComponentHelper.createNewTask(ComponentHelper.java:462) here private Task createNewTask(String taskType) throws BuildException { Class c = getComponentClass(taskType); if (c == null || !(Task.class.isAssignableFrom(c))) { return null; } Task task = (Task) createComponent(taskType); //=> ComponentHelper.java:462 if (task == null) { return null; } task.setTaskType(taskType); // set default value, can be changed by the user task.setTaskName(taskType); project.log(" +Task: " + taskType, Project.MSG_DEBUG); return task; } It works for "normal" macros. "Peter Reilly" <[EMAIL PROTECTED]> 07-06-2006 12:20 Please respond to "Ant Developers List" To "Ant Developers List" cc Subject Re: how to access a MacroDef? Since macro defs are tasks, it would be better to use the project.createTask() method, and not try to use the internal (although exposed trough the public classes and methods) mechanizes of Ant. This is the atest macro import org.apache.tools.ant.taskdefs.MacroInstance; import org.apache.tools.ant.BuildException; atest = project.createTask("atest"); if (! (atest instanceof MacroInstance)) { throw new BuildException("atest is not a macro"); } atest.execute(); It would be necessary to call setOwningTarget as project.createTask() does not know the current target. Peter On 6/7/06, Wolfgang Häfelinger <[EMAIL PROTECTED]> wrote: > > Allright, it appears much more easier than expected. > > ComponentHelper componenthelper; > Object obj; > MacroInstance instance; > > componenthelper = ComponentHelper.getComponentHelper(project()); > obj = componentHelper.createComponent(mymacroname); > instance= (MacroInstance)obj; > instance.execute(); > > Appears that there's no need to call setProject() or setOwningTarget() on > the macro's > instance. > > However, not sure whether this is the "right" way to do. Perhaps Peter can > comment > on this. > > Thanks for all help so far. > > Wolfgang. > > > > > "Dominique Devienne" <[EMAIL PROTECTED]> > 06-06-2006 19:41 > Please respond to > "Ant Developers List" > > > To > "Ant Developers List" > cc > > Subject > Re: how to access a MacroDef? > > > > > > > > I tried something like > > > > ComponentHelper componenthelper = > > ComponentHelper.getComponentHelper(project()); > > MacroDef def = (MacroDef) > > componenthelper.getTaskDefinitions().get(mymacroname); > > > > just in order to understand that Hastable getTaskDefinitions() contains > a > > String => Class relation. > > > > So where are those MacroDef's hidden? > > So your 'def' is null, right? > > Try not casting it to MacroDef, and see which kind of Java Class is > returned, if any. It may be an UnknownElement (my guess), a > MacroInstance, etc... > > From the UE, you may be able to get a MacroInstance or a MacroDef, and > if the later, configure it into a MacroInstance, which is what you > want to run. > > I vaguely know this code only. Peter's the expert. --D > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to access a MacroDef?
Hmm, I have seen that project.createTask() does more or less the same as I do. However, I do not understand what caching my task and invalidation means. Perhaps I do not to care about it anyway. Another thing I tried is to call my macro or task with attributes. I got it working for macros: This is the atest macro where foo = @{foo} atest = project.createTask("atest"); if (! (atest instanceof MacroInstance)) { throw new BuildException("atest is not a macro"); } MacroInstance inst = (MacroInstance)atest; inst.setDynamicAttribute("foo",bar"); atest.execute(); I tried then something similar for (ordinary?) tasks without success. That's what I want to do be able to do: I implemented this somehow like task = project.createTask("echo"); if (task instanceof MacroInstance) { .. } else { /* call echo with attribute message */ RuntimeConfigurable rtc = task.getRuntimeConfigurableWrapper(); rtc.setAttribute("message","hello"); } task.execute(); I can see that indeed echo is called but it's being called without my arguments. Any hint on this as well? Wolfgang. "Peter Reilly" <[EMAIL PROTECTED]> 07-06-2006 12:20 Please respond to "Ant Developers List" To "Ant Developers List" cc Subject Re: how to access a MacroDef? Since macro defs are tasks, it would be better to use the project.createTask() method, and not try to use the internal (although exposed trough the public classes and methods) mechanizes of Ant. This is the atest macro import org.apache.tools.ant.taskdefs.MacroInstance; import org.apache.tools.ant.BuildException; atest = project.createTask("atest"); if (! (atest instanceof MacroInstance)) { throw new BuildException("atest is not a macro"); } atest.execute(); It would be necessary to call setOwningTarget as project.createTask() does not know the current target. Peter On 6/7/06, Wolfgang Häfelinger <[EMAIL PROTECTED]> wrote: > > Allright, it appears much more easier than expected. > > ComponentHelper componenthelper; > Object obj; > MacroInstance instance; > > componenthelper = ComponentHelper.getComponentHelper(project()); > obj = componentHelper.createComponent(mymacroname); > instance= (MacroInstance)obj; > instance.execute(); > > Appears that there's no need to call setProject() or setOwningTarget() on > the macro's > instance. > > However, not sure whether this is the "right" way to do. Perhaps Peter can > comment > on this. > > Thanks for all help so far. > > Wolfgang. > > > > > "Dominique Devienne" <[EMAIL PROTECTED]> > 06-06-2006 19:41 > Please respond to > "Ant Developers List" > > > To > "Ant Developers List" > cc > > Subject > Re: how to access a MacroDef? > > > > > > > > I tried something like > > > > ComponentHelper componenthelper = > > ComponentHelper.getComponentHelper(project()); > > MacroDef def = (MacroDef) > > componenthelper.getTaskDefinitions().get(mymacroname); > > > > just in order to understand that Hastable getTaskDefinitions() contains > a > > String => Class relation. > > > > So where are those MacroDef's hidden? > > So your 'def' is null, right? > > Try not casting it to MacroDef, and see which kind of Java Class is > returned, if any. It may be an UnknownElement (my guess), a > MacroInstance, etc... > > From the UE, you may be able to get a MacroInstance or a MacroDef, and > if the later, configure it into a MacroInstance, which is what you > want to run. > > I vaguely know this code only. Peter's the expert. --D > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to access a MacroDef?
Allright, it appears much more easier than expected. ComponentHelper componenthelper; Object obj; MacroInstance instance; componenthelper = ComponentHelper.getComponentHelper(project()); obj = componentHelper.createComponent(mymacroname); instance= (MacroInstance)obj; instance.execute(); Appears that there's no need to call setProject() or setOwningTarget() on the macro's instance. However, not sure whether this is the "right" way to do. Perhaps Peter can comment on this. Thanks for all help so far. Wolfgang. "Dominique Devienne" <[EMAIL PROTECTED]> 06-06-2006 19:41 Please respond to "Ant Developers List" To "Ant Developers List" cc Subject Re: how to access a MacroDef? > I tried something like > > ComponentHelper componenthelper = > ComponentHelper.getComponentHelper(project()); > MacroDef def = (MacroDef) > componenthelper.getTaskDefinitions().get(mymacroname); > > just in order to understand that Hastable getTaskDefinitions() contains a > String => Class relation. > > So where are those MacroDef's hidden? So your 'def' is null, right? Try not casting it to MacroDef, and see which kind of Java Class is returned, if any. It may be an UnknownElement (my guess), a MacroInstance, etc... >From the UE, you may be able to get a MacroInstance or a MacroDef, and if the later, configure it into a MacroInstance, which is what you want to run. I vaguely know this code only. Peter's the expert. --D - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to access a MacroDef?
>> So your 'def' is null, right? Actually it's the case that componenthelper.getTaskDefinitions().get(mymacroname); returns a object of type Class: Class C = (Class) componenthelper.getTaskDefinitions().get(mymacroname); In case 'mymacroname' contanis the name of a macrodef I'm getting C.getName() => 'org.apache.tools.ant.taskdefs.MacroInstance' Still no clue how to get hold of my macro's definition. Peter, any hint? "Dominique Devienne" <[EMAIL PROTECTED]> 06-06-2006 19:41 Please respond to "Ant Developers List" To "Ant Developers List" cc Subject Re: how to access a MacroDef? > I tried something like > > ComponentHelper componenthelper = > ComponentHelper.getComponentHelper(project()); > MacroDef def = (MacroDef) > componenthelper.getTaskDefinitions().get(mymacroname); > > just in order to understand that Hastable getTaskDefinitions() contains a > String => Class relation. > > So where are those MacroDef's hidden? So your 'def' is null, right? Try not casting it to MacroDef, and see which kind of Java Class is returned, if any. It may be an UnknownElement (my guess), a MacroInstance, etc... >From the UE, you may be able to get a MacroInstance or a MacroDef, and if the later, configure it into a MacroInstance, which is what you want to run. I vaguely know this code only. Peter's the expert. --D - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
how to access a MacroDef?
Hi, a simple question - how can I retrieve a macro definition using ComponentHelper? I tried something like ComponentHelper componenthelper = ComponentHelper.getComponentHelper(project()); MacroDef def = (MacroDef) componenthelper.getTaskDefinitions().get(mymacroname); just in order to understand that Hastable getTaskDefinitions() contains a String => Class relation. So where are those MacroDef's hidden? Sorry for this stupid question, Wolfgang. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to call macros dynamically?
>> For example, the above could be replaced by a single empty-target >> depending on the 4 possible package-* targets, each with an >> appropriate 'if' attribute. Or with a (limited use of >> is usually not that expensive). Sure you agree that "run-macro" is by far more elegant than working with such a target? Also, I do not need to care about this hidden conditional if I'm going to extend the list of known project types. >> Or with a (limited use of is usually not that >> expensive). Hmm, I thought that there's no need for antcall any longer - now as we have macros. >> That's because you think of them in procedural term. Still I can't see the general problem treating a target like a special kind of macro .. (target = public macro + dependencies). >> That said, feel free to implement a or >> task ;-) I'm stuck in NullPointerExceptions :-) "Dominique Devienne" <[EMAIL PROTECTED]> 06-06-2006 16:55 Please respond to "Ant Developers List" To "Ant Developers List" cc Subject Re: how to call macros dynamically? > > > > > .. > > > > > > Having a "run-macro" around I could shorten things to simply write > > Indeed, that's what I had in mind by hidden conditional. That's one way to do it, but probably not one of the Ant ways. For example, the above could be replaced by a single empty-target depending on the 4 possible package-* targets, each with an appropriate 'if' attribute. Or with a (limited use of is usually not that expensive). I so think you are working a bit "against the grain" with Ant here ;-) > Another thing that strikes me is the distinction between a target and a > task and macrodef. > It's rather easy to implement a task executing an arbitrary target using > getProject().executeTarget(). Sure, that's the safe in Ant, or the less safe in Ant-Contrib. > Why not providing the same functionality for a macro as well? Honestly, I > regard a target > nothing more than a "public" macro, i.e. a macro able to call from the > command line. That's because you think of them in procedural term. When a target as dependencies, it's not the same ball game. In theory, the dependencies of a target should be only the pre-requisite of the target, and not an ordered list of steps to fun before, and then the Ant engine would be allowed to order the execution of theses target anyway it likes (possibly parallelizing them) as long the the pre-requisites are met. There's even an Executor proposal to behave that way. Sure, it's not the way Ant works, or will ever work in all likelyhood, but that's way I think it's wrong to think of targets as "public" macros. It's similar to how an XSLT engine processes it's templates. Most processors are still mostly procedural right now, but the design allows the engine to work in a non-procedural way (Read Dr. Kay's excellent books for more details). That said, feel free to implement a or task ;-) --DD - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to call macros dynamically?
> Is your motivation being able to have conditionals in disguise, i.e. > be able to write I believe that my deeper motivation is to be able to do "scripting" without falling back to Javascript, Python et cetera. I'm not using them because they are not part of a standard Ant installation. Here's my motivation for having "run-macro" - it would simplify my Ant scripts considerably. On loading my build script, a macro gets executed which guesses the project's type. The result of this guess is property '"project.type" which (currently) holds on of the values jar jsf war ear Further target "package" exists which calls a specific macro depending on project.type's value. So my package macro contains something like .. Having a "run-macro" around I could shorten things to simply write Another thing that strikes me is the distinction between a target and a task and macrodef. It's rather easy to implement a task executing an arbitrary target using getProject().executeTarget(). Why not providing the same functionality for a macro as well? Honestly, I regard a target nothing more than a "public" macro, i.e. a macro able to call from the command line. "Dominique Devienne" <[EMAIL PROTECTED]> 06-06-2006 15:18 Please respond to "Ant Developers List" To "Ant Developers List" cc Subject Re: how to call macros dynamically? Is your motivation being able to have conditionals in disguise, i.e. be able to write ? Otherwise I can't see the use for this. Just curious ;-) Thanks, --DD On 6/6/06, Wolfgang Häfelinger <[EMAIL PROTECTED]> wrote: > Hi, > > I wonder how to implement a task (in Java) allowing me to execute > a macro. I tried to understand how it works looking into Ant's source > code, but I'm bit lost. Would be kind if someone could give me a > "roadmap" how to do it .. > > What I'm looking for is something like .. > > Assume I have a macro: > > > > .. > > > Then I want to be able to say > > > > instead of > > > > For the beginning I'm happy to call a macro without any parameters like > shown. Even better would be to be able to provide parameters as well: > > > > > > > > Any hints? > > Cheers, > Wolfgang. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
how to call macros dynamically?
Hi, I wonder how to implement a task (in Java) allowing me to execute a macro. I tried to understand how it works looking into Ant's source code, but I'm bit lost. Would be kind if someone could give me a "roadmap" how to do it .. What I'm looking for is something like .. Assume I have a macro: .. Then I want to be able to say instead of For the beginning I'm happy to call a macro without any parameters like shown. Even better would be to be able to provide parameters as well: Any hints? Cheers, Wolfgang. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ComponentHelper replacement
>> lets you do this inline, though python's space rules make >> the resulting XML files look a bit messy. is a feature I'm not particular happy with. It makes me depend on specific languages and features. My framework consists basically of macros build on top of other macros or "native" tasks (either standard Ant task or custom tasks implement by me). So looking at my framework's XML code, I can hardly see any Java dependencies with the exception of (I can probably also get rid of it using a property file). Steve Loughran <[EMAIL PROTECTED]> 26-05-2006 15:29 Please respond to "Ant Developers List" To Ant Developers List cc Subject Re: ComponentHelper replacement Wolfgang Häfelinger wrote: >>>My preference is to improve Ant's API. > > > I would like to see Ant evolving in such a way allowing > me to implement a framework like Maven on top of it. > > >>>So, the question is "can Ant evolve into a good Java API?" > > > I have no doubt that it can be done, we just need to focus on > it. > > However, why does it need to be a Java API? Let's just talk > about a good API and treat Java as an implementation detail. > > I think it would be pretty cool to implement tasks (i.e. macros > with a "native" implementation) in other languages as well (I > would love to see Python supported). lets you do this inline, though python's space rules make the resulting XML files look a bit messy. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ComponentHelper replacement
>> My preference is to improve Ant's API. I would like to see Ant evolving in such a way allowing me to implement a framework like Maven on top of it. >> So, the question is "can Ant evolve into a good Java API?" I have no doubt that it can be done, we just need to focus on it. However, why does it need to be a Java API? Let's just talk about a good API and treat Java as an implementation detail. I think it would be pretty cool to implement tasks (i.e. macros with a "native" implementation) in other languages as well (I would love to see Python supported). Cheers, Wolfgang. "Stephen McConnell (DPML)" <[EMAIL PROTECTED]> 23-05-2006 21:10 Please respond to "Ant Developers List" To "'Ant Developers List'" cc Subject RE: ComponentHelper replacement > -Original Message- > From: Dominique Devienne [mailto:[EMAIL PROTECTED] > Sent: Wednesday, 24 May 2006 4:16 AM > To: Ant Developers List > Subject: Re: ComponentHelper replacement > > > However, it is possible to isolate Ant idiosyncrasies as an > > implementation concern providing one can establish a viable project > > model. > > I've long thought Ant needed a more rigorous model exposed to > Java clients and extension builders. However, I don't think > what I had in mind was quite as ambitious as what you > describe. It's not easy to evolve Ant in such a way, and > attempts at starting from scratch failed > (Ant: myrmidon and mutant), not from lack of quality, but > from lack of community support. > > Maven (1 or 2) may indeed be closer to your thinking. Close? Maybe. The solution? No. IMO Maven is too focussed on build time concerns (as opposed to the overall runtime management subject). In effect Maven's underlying framework does not fold easily into deployment and runtime solutions (which is at the end of the day the product of a build). In addition there are simple pragmatic issues that Maven does not fulfil. My point is that Ant as an API needs to evolve and its evolution should be driven by API users. It's not a question of Maven - Maven does not deliver what I need - I can build systems on Ant that deliver better solutions than Maven but in doing so, there are issues in the Ant API. My preference is to improve Ant's API. > > > I.e. perhaps Dominique's suggestion on the money? > > You meant Wolfgang, no? ;-) --DD LOL - Yes. However - it raises an interesting question: >Dominique wrote: > Ant's purpose is as a build tools, not a Java library. So, the question is "can Ant evolve into a good Java API?" If the answer is YES - in your opinion .. how? If the answer is NO - in your opinion .. why not? Cheers, Steve. -- Stephen McConnell mailto:[EMAIL PROTECTED] http://www.dpml.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ComponentHelper replacement
Hey, >> Ant's purpose is as a build tools, not a Java library. Perhaps time to change. After all, there must be a reason why Maven's community is growing :-) >> is just syntactic sugar, and is better not used >> IMHO. I disagree. It's very cool. Almost as cool as "macrodef" which I really love. Cheers, Wolfgang. "Dominique Devienne" <[EMAIL PROTECTED]> 23-05-2006 14:53 Please respond to "Ant Developers List" To "Ant Developers List" cc Subject Re: ComponentHelper replacement > Still the overall problem I have with customizing Ant is the over-usage of > "private". It also bites at other places, ComponentHelper is just an example. On the contrary, it's a Good Thing (TM) Ant's purpose is as a build tools, not a Java library. Keeping its internals private allows future refactoring which do not break BC, or minimize BC issues. It's a lot easier to open up an API here and there, when there's a good case for it, rather than leaving everything "protected" or public. is just syntactic sugar, and is better not used IMHO. But if you persist on wanting to overuse it, concentrate your energy on simply adding an attribute to presetdef to ignore overrides (with all that entails), and provide a patch. Or better yet, use a my- prefix for your presets, so as not to confuse people with tasks that look like plain Ant tasks, but don't behave the same because their defaults have been changed. This is most likely a maintenance issue, and a violation of the "principle of least surprise". Good luck. I'll get down from my soap box now ;-) --DD - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ComponentHelper replacement
Hi Kev, > If this is the problem that you and your users are facing, perhaps it > would be a better solution to provide a way to suppress these > messages instead of rewriting ComponentHelper et al. Is there are nice way to customize output suppressing? Still the overall problem I have with customizing Ant is the over-usage of "private". It also bites at other places, ComponentHelper is just an example. Cheers, Wolfgang. Kev Jackson <[EMAIL PROTECTED]> 23-05-2006 13:23 Please respond to "Ant Developers List" To "Ant Developers List" cc Subject Re: ComponentHelper replacement On 23 May 2006, at 17:26, Wolfgang Häfelinger wrote: > Hi, > > I'm heavily using to override/customize tasks. It > annoys me > and users > of my framework to see messages like > > Trying to override old definition of task junit > ignoring the rest of your message for now - your main problem seems to be that you're getting too much info dumped to System.out. Is that the main problem? If this is the problem that you and your users are facing, perhaps it would be a better solution to provide a way to suppress these messages instead of rewriting ComponentHelper et al. Thanks Kev -- "Society in every state is a blessing, but government even in its best state is but a necessary evil; in it's worst state an intolerable one" - Thomas Paine - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
ComponentHelper replacement
Hi, I'm heavily using to override/customize tasks. It annoys me and users of my framework to see messages like Trying to override old definition of task junit and so I had the idea to write my "own" ComponentHelper and to hook it in via reference "ant.ComponentHelper". The idea is - theoretically - simple, just inherit from ComponentHelper and override method updateDataTypeDefinition() and get rid of this project.log() statement (which should be a verbose message after all). In practice however I run into serious problems and I have no real clue how to do it: - updateDataType() is private, so I need to change addTaskDefinition() as well ( I really wonder why updateDataTypeDefinition() is private and not protected). - updateDataType() uses lot's of private variables and methods like rebuildTaskClassDefinitions antTypeTable sameDefinition project invalidateCreatedTasks and it appears that most of this private staff does not even have a "read" method. Therfore customization by inheritance appears not to work. In a second approach I copied ComponentHelper.java in my own package structure, added a couple of import statements, and finally got stuck because of Task t = (Task) ref.get(); //being a weak ref, it may be null by this point if (t != null) { t.markInvalid();// <= package access only } Ok, so do I need to put ComponentHelper.java in org.apache.tools.ant to make javac happy? This was then my third approach. I saved a copy of ComponentHelper.java as MyComponentHelper.java in "your" namespace and now I'm stuck because of for (Iterator i = helper.checkedNamespaces.iterator(); i.hasNext();) { // .. } Here checkedNamespaces is private (again) and there's no way to access it. Now for my final question (thanks for reading so far): How do I ever have a chance to replace ComponentHelper with my own version if basically everything is "private" ? And here's my proposal for Ant 1.6.6: 1. $ perl -pi -e 's,\sprivate\s, protected ,g' `find -name \*.java` 2. provide at least a "getter" for each "non-public" attribute Cheers, Wolfgang. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]