ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jason Rosenberg" <ja...@squaretrade.com>
Subject Re: A DAG for all occasions
Date Sun, 07 Jan 2001 05:56:44 GMT
Peter,

Now you are beginning to see.  Templates do require their
own isolated context, which is local.  This is because they
are sub-routines, which have their own local values on
the stack (speaking in procedural terms).

You are simply running into the problem of trying to
do templates from a pure declarative model.  The dependency
graph idea just isn't really buying much, when we talk
about parameterized, reusable code.

Better to throw out ant-call altogether, and allow direct
<execute-task> functionality.

The <template> tag really complicates the code unnecessarily,
since now we have to be thinking about having completely
separately declared code.  Code which can be part of a
template, or code which cannot.

In the end, things will likely evolve such that 95% of the script
is being executed by templates, and so the business of building
a DAG representation for the non-template part is superfluous.

Jason


----- Original Message ----- 
From: "Peter Donald" <donaldp@apache.org>
To: <ant-dev@jakarta.apache.org>
Sent: Friday, January 05, 2001 1:26 AM
Subject: A DAG for all occasions


> 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               |
> *-----------------------------------------------------*
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ant-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: ant-dev-help@jakarta.apache.org
> 


Mime
View raw message