ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <dona...@apache.org>
Subject A DAG for all occasions
Date Fri, 05 Jan 2001 06:26:25 GMT
Hi,

I was just thinking about how we build dependency graphs and how we should
build it and I hit a snag. I think that we can currently agree that both
inter and intra project DAGs are necessary. However what happens when we
come to templates? My first reaction was to treat them like they are
treated now. ie ant-call executes the target in a new context all it's
dependencies are executed. So if we have the following

<target name="target.1" depends="target.2" />
<target name="target.2" depends="target.3" />
<target name="target.3" depends="target.4" />
<target name="target.4" />

and use <ant-call target="target.1" /> then all of targets 1-4 will be
executed. However consider the case when target.4 is something we want only
to be executed once in the project and not every time a template is called.
There is a number of ways we could get around this - the simplest of which is

<target name="target.4" unless="target.4.already-ran">
  <property name="target.4.already-ran" value="true"/>
  ...
</target>

however this becomes increasingly more complex as more of these targets
were added and a simple look at my build files indicate that it would be a
relatively common occurence.

So how about we explictly mark targets that participate in template. These
targets would not be able to be called except via ant-call or its
equivelent and would be run every time template is called. We could do it
either via an attribute (ie setting template="true") or via changing name
of tag. ie

<template name="target.1" depends="target.2" />
<template name="target.2" depends="target.3" />
<template name="target.3" depends="target.4" />
<target name="target.4" />


The second option (changing tag name) is simple to understand, easy to
implement and I think covers all bases that we need covering (at least that
I can see). What do you think - too icky or a possibility ?

Cheers,

Pete

*-----------------------------------------------------*
| "Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof."                   |
|              - John Kenneth Galbraith               |
*-----------------------------------------------------*


Mime
View raw message