You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Mark McMillan <ma...@engineous.com> on 2001/12/17 16:53:03 UTC
Dependency analysis
I'm new to the list so be gentle :-)
After working with ANT a while on a moderately complex build scenario and
writing a few custom tasks, I have one problem I cannot seem to solve with
ANT's build-in tasks or a custom task. I see from the ANT source why I
cannot archive what I want, but maybe someone here can tell me why I don't
want it :-)
The problem (to me) is that ANT's target dependency processing (talking
about "depends=" on targets here) is too simplistic. I have constructed a
build file by defining a large set of relatively simple targets. I then
build more complex targets that combine some tasks with ANTCALLs to the
simpler targets. Not all complex targets use the same set of base targets,
and basic targets themselves may be composed of tasks and ANTCALLs to other
targets.
Each target properly expresses its own dependencies on other targets using
the "depends=..." attribute. For example, every target has "init" first in
its dependency list. This dependency is independent of how targets are
combined and used by the more complex targets (e.g. the ANTCALL sequence).
The problem is that when a complex target is executed, each ANTCALL made
within it completely re-evaluates the dependency tree and re-executes many
common targets that have already been run. So in our scenario, "init" is
executed many times. Some of our commonly used targets are expensive to
run and this results in a much longer build time than is necessary.
From a code point of view, there seems to be no structure in ANT for
keeping track (on a target or task level) what targets have been
executed. The dependency list is simply executed from the root to the
current target (Project.executeTarget()). I expected to find a Hashtable
somewhere of already-evaluated targets that would be checked before a
dependent target is run; the run would be skipped if the dependent is
already in the list.
Am I missing something basic about how to use ANT? This seems like it
would be a very common problem...
-Mark
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>