----- Original Message ----- 
From: "Jean Rajotte" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, November 20, 2003 6:30 PM
Subject: RE: [Nant-users] Incorrect dependency evaluation?


> gert, thanks for sticking w/ me on this.
>
> > > your build example could be done using call+force just as
> > readily in
> > > the past as you have it now.
> >
> > feel free to provide a sample to convince me, but I don't
> > think we will be change the new behaviour :-)
>
> here's your example:
>
> <target name="clean" />
> <target name="build-assembly" />
> <target name="build-docs" />
>
> <target name="debug" depends="clean, build-assembly, build-docs"
> />
> <target name="release" depends="clean, build-assembly,
> build-docs" />
>
> <target name="build">
>     <call target="debug" />
>     <call target="release" />
> </target>
>
> #1, i don't see how your example works.  there's no diff bet. target
> debug and target release, unless they init props in their bodies, in
> which case the depends= run too soon.  what am i missing?

My example wasn't meant to work, I just wanted to illustrate how I think
dependencies should be implemented in build file ...

>
> #2 here's the equiv using call+force.  just as legible, if slightly more
> verbose.
>
> <target name="clean" />
> <target name="build-assembly" />
> <target name="build-docs" />
>
> <target name="doBuild" >
>   <call force="true" target="clean"  />
>   <call force="true" target="build-assembly" />
>   <call force="true" target="build-docs"  />
> </target>
>
> <target name="build">
>     <call target="initForDebug" />
>     <call target="DoBuild" force="true" />
>     <call target="initForRelease" />
>     <call target="DoBuild" force="true" />
> </target>

But using this solution, you don't set up dependencies ... The call task was
not really intended to be used to set-up dependencies, it should only be
used when you want to break-out of the normal dependency walking ...

Sorry if I'm not making completely sense right now ... Been working a bit
too hard today :(

I'll look into all of this again when I have some more time (tomorrow or in
the weekend) ...

>
> >
> > If you send me a simple example of your build file, I'd love
> > to help you out ...
>
> hopefully, the following example isn't too verbose to get the points
> across that
> 1) i have to use CALL to execute dodo*
> 2) in the new world order setProps will run several times altho it
> should only run once
> 3) i need setProps dependency so i can unit-test dodo1, dodo2, ...
>
> <target name="setProps" />
>
> <target name="dodo1" depends="setProps" />
> <target name="dodo2" depends="setProps" />
> <target name="dodo3" depends="setProps" />
>
> <target name="figure-it-all-out" >
>     <property name="do1" value="false" />
>     <property name="do2" value="false" />
>     <property name="do3" value="false" />
>
>     <if uptodatefile="${File.App.Leap.Marker}"  >
>       <comparefiles>
>         <includes name="${Dir.Leap.Xml}**.xml" />
>         <includes name="${Dir.Leap.Gsl}**.gsl" />
>         <includes name="${Dir.Leap.Commands}**.build" />
>         <includes name="${Dir.App}**.build" />
>       </comparefiles>
>       <property name="do1" value="true" />
>       <property name="do2" value="true" />
>     </if>
>     <if uptodatefile="${File.App.Leap.Marker}"  >
>       <comparefiles>
>         <includes name="${Dir.Leap.Sql}**.sql" />
>         <includes name="${File.Version.Def.Spec}" />
>       </comparefiles>
>       <property name="do2" value="true" />
>       <property name="do3" value="true" />
>     </if>
>
>     <call if="${do1}" target="dodo1" />
>     <call if="${do2}" target="dodo2" />
>     <call if="${do3}" target="dodo3" />
> ...
> </target>
>

I attached a possible solution for your specific case, but I'm pretty sure
there's a better solution possible using dynamic properties... But in that
case, I'd have to know more about the setProps target ...

Gert
<project name="test" default="do">
    <property name="do1" value="false" />
    <property name="do2" value="false" />
    <property name="do3" value="false" />
    <target name="setProps">
        <echo message="in setProps" />
    </target>
    <target name="dodo1" depends="setProps" />
    <target name="dodo2" depends="setProps" />
    <target name="dodo3" depends="setProps" />
    <target name="figure-it-all-out">
        <property name="do1" value="false" />
        <property name="do2" value="false" />
        <property name="do3" value="false" />
        <if uptodatefile="${File.App.Leap.Marker}">
            <comparefiles>
                <includes name="${Dir.Leap.Xml}**.xml" />
                <includes name="${Dir.Leap.Gsl}**.gsl" />
                <includes name="${Dir.Leap.Commands}**.build" />
                <includes name="${Dir.App}**.build" />
            </comparefiles>
            <property name="do1" value="true" />
            <property name="do2" value="true" />
        </if>
        <if uptodatefile="${File.App.Leap.Marker}">
            <comparefiles>
                <includes name="${Dir.Leap.Sql}**.sql" />
                <includes name="${File.Version.Def.Spec}" />
            </comparefiles>
            <property name="do2" value="true" />
            <property name="do3" value="true" />
        </if>
    </target>
    <target name="do" depends="figure-it-all-out, do1, do2, do3" />
    <target name="do1" depends="dodo1" if="${do1}" />
    <target name="do2" depends="dodo2" if="${do2}" />
    <target name="do3" depends="dodo3" if="${do3}" />
</project>

Reply via email to