« Return to Thread: factoring out commonality in sequences of tasks

Re: factoring out commonality in sequences of tasks

by jscripter :: Rate this Message:

Reply to Author | View in Thread

Michael Ludwig-6 wrote:
jscripter schrieb am 22.06.2009 um 14:16:24 (-0700):

> >   <target name="deploy-using-copy" depends="trg1,trg3,trg5">
> >   ...
> >
> >   <target name="deploy-using-link" depends="trg1,trg3,trg5">
> >   ...

> I need to preserve the execution order of the tasks, so I don't think
> that would work.

From a recent post of David Weintraub:

| You say that B depends upon A, and C depends upon A and that A depends
| upon D, and both Ant and Make will calculate out the build order of
| your components. If you make a change (Say B now depends upon both A
| and C, Ant [...] will adjust the build without major rewriting of your
| build script.

This suggests you could guarantee execution order by setting up the
dependency matrix accordingly. Let your main tasks depend on trg5, which
in turn depends on trg3, which in turn depends on trg1.

Also, take a look at the manual, which has this example:

    <target name="A"/>
    <target name="B" depends="A"/>
    <target name="C" depends="B"/>
    <target name="D" depends="C,B,A"/>

        Suppose we want to execute target D. From its depends attribute, you
        might think that first target C, then B and then A is executed. Wrong!
        C depends on B, and B depends on A, so first A is executed, then B,
        then C, and finally D.

http://ant.apache.org/manual/using.html#targets

Michael Ludwig

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
The problem is that task3 has to come after copy-files-2 OR link-files-2 depending on which one I want to execute.

So, to use an abbreviated example, I can get most of the execution order specified with
the following declarations:

<target name="deploy-using-copy" depends="target-1,target-copy-2,target-3">...</target>
<target name="deploy-using-link" depends="target-1,target-link-2,target-3">...</target>

<target name="target-copy-2" depends=target-1">...</target>
<target name="target-link-2" depends="target-1">...</target>

but then how do I set up the depends for target-3?

 « Return to Thread: factoring out commonality in sequences of tasks