ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Seegel <RobSee...@comcast.net>
Subject Re: Checking if a Target Exists
Date Fri, 04 Nov 2011 01:40:39 GMT
Steve,

   For my project I created a custom task that was basically an 
extension of runtarget (from ant-contrib), which worked *almost* the way 
I wanted. I wanted the following specific case:

   - core skeleton build process in one script, that contained hooks I 
could use to "extend" with one or more smaller utility scripts that are 
also imported to enhance the core build process by taking advantage of 
those hooks very much like plug-ins.

The runtarget extension, can run every implementation of a particular 
target that it finds, or a few variations. This allows me to define a 
task that looks for something like "run-test-suite" or "generate-report" 
or "initialize" or whatever, and then add however many implementations 
that are appropriate for that project. What this allows me to do, is 
wrap other custom ant tasks into small utility modules where sensible 
defaults are established (that can be overridden). It allows for easier 
reuse of ant processes.

The final project build script usually ends up being incredibly small, 
only implementing small snippets that are absolutely specific to the one 
build. Most times a scripts is between one and three imports, and maybe 
a few property overrides.

Let me take a look at the code tomorrow - perhaps I can share it. It was 
written for Ant 1.6.5, but I've also used it for 1.7.*  The basic idea 
has worked pretty well for me.

Rob


On 11/3/11 7:52 AM, Steve Amerige wrote:
> Hi all,
>
> I want to be able to check if a target exists and hope you can help.  
> I'm looking for a generic solution that doesn't rely any knowledge of 
> the target name to be checked.  It is not possible to modify the 
> target code.  And, I'd like to avoid any solutions that cause the 
> entire JVM to be loaded (e.g., as with antcall).
>
> My environment is Ant 1.7 and allows for the use of Ant-Contrib and 
> Groovy.
>
> Any ideas on how to do this?  Even better, any solutions anyone have 
> to share?!
>
> Thanks,
> Steve Amerige
> SAS Institute, Deployment Software Development
>


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


Mime
View raw message