On Thu, 2001-09-20 at 12:12, Craig Longman wrote:
> any idea why this doesn't do the right thing?
>
> > <project name="test" default="default2">
> >
> > <target name="default1">
> > <property name="use.target1" value="true"/>
> > <property name="use.target2" value="true"/>
> > </target>
> >
> > <target name="default2" depends="default1, target1, target2">
> > <echo message="${prop2}"/>
> > </target>
> >
> > <target name="target1" depends="check" if="use.target1">
> > <property name="prop1" value="test1a"/>
> > <property name="prop2" value="test2a"/>
> > </target>
> >
> > <target name="target2" depends="check" if="use.target2">
> > <property name="prop1" value="test1b"/>
> > <property name="prop2" value="test2b"/>
> > </target>
> >
> > <target name="check" if="prop1">
> > <fail message="prop1 already set"/>
> > </target>
> >
> > </project>
to answer my own question, and basically exclude this type of solution,
i think the reason it doesn't work is that ant runs the 'check' target
the first time, but then assumes that target is now _done_. so the next
depends="check" is just silently skipped, as that target was already
executed. is this right? here is the output from this project:
Buildfile: build.xml
default1:
check:
target1:
target2:
default2:
[echo] test2a
BUILD SUCCESSFUL
Total time: 0 seconds
cheers,
CraigL->Thx();
|