ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kronus David" <>
Subject Ignoring missing targets which are not needed for current build
Date Wed, 25 Feb 2009 15:33:08 GMT
I have implemented for myself the below described command-line argument and related task, do
you think it could be useful and hence submitted to ant?
I was looking for a way in which ant could perform a build on an antfile where some tasks
(which are not needed for the desired build) have dependencies on tasks which are not present
in the antfile. The motivation was that I have an <import file="..." optional="true"/>
in the antfile and the antfile to import is being downloaded by invoking a task in the main
antfile (containing the import). So during the first invocation to download the antfile to
import there may be some tasks in the main antfile which depend on tasks in the imported antfile
which is not available at the beginning of the invocation, only as a result of it. 

I didn't find anything related in documentation and I received no response from the user mailing
list, so I concluded that this is currently not possible and looked into the source code of
ant (1.7.1) to find out that this is very easy since the (redundant) control of dependencies
of tasks not involved in the current build is clearly divided from the rest of the dependency
checking (there is a detailed comment on that in in one of the toposort methods).
So I added a commandline switch (-ignore-missing) to overcome this. So this is first step,
do you think this could be useful to submit?

Second step is that I don't want to say "ant -ignore-missing" each time this is needed, so
I thought about "declaring" somehow in an antfile that when performing build using the antfile,
this option should be turned on. This is actually easy, I just wrote a simple anttask <config
ignoreMissing="true"/> which can be used outside of targets and gets executed before the
actual checking of missing targets. This task just sets a flag on Project instance according
to its attribute. It could even be extended so that you can declare options for Project, which
are now only controlled by commandline options, in antfiles that need them.  What do you think
about that? Is it useful (for me it is essential) and is it worth submitting to ant?


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message