Note: If either both "a" and "b" are not set, or only one of "a" and "b"
is not set (ie., any case where you'll actually end up setting "ab"), then
you need to explicitly set "ab" to "true" -- otherwise, you still end up
with "xxx" getting run:
Buildfile: test.xml
aa:
a is not set
setting property ab
bb:
b is not set
setting property ab
xxx:
a and b are both set
a is set to ${a}
b is set to ${b}
This suggests something may be out-of-whack with <property>, since it's
supposed to set the property to "true" by default.
I actually tried this same approach this morning, but didn't specify a
value="true" then, so I didn't think it worked -- then you sent this out,
so I figured there must be something to it afterall, so I kept tinkering
with it until I finally tried explicity setting ab to true, and then it
worked:
Buildfile: test.xml
aa:
a is not set
setting property ab explicitly to true
bb:
b is not set
setting property ab explicitly to true
xxx:
Buildfile: test.xml
aa:
bb:
xxx:
a and b are both set
a is set to apple
b is set to bear
Diane
--- Jose Alberto Fernandez <[EMAIL PROTECTED]> wrote:
> Actually this is possible to do in ANT, although conversome.
>
> We just need to remember our boolean algebra:
> A ^ B == ~(~A v ~B)
>
> Hence:
>
> <target name="aa" unless="a">
> <property name="ab" />
> </target>
>
> <target name="bb" unless="b">
> <property name="ab" />
> </target>
>
> <target name="xxx" depends="aa,bb" unless="ab" >
> <your stuff here/>
> </target>
>
> There you go!!!! (here "a" --> "prop1", "b" --> "prop2")
>
>
> > -----Original Message-----
> > From: Ken Wood [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, October 18, 2000 9:58 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: Questions on Ant
> >
> >
> > <target name="yyy" if="prop2">
> > <all_your_tasks_here.../>
> > </target>
> >
> > <target name="xxx" depends="yyy" if="prop1">
> > </target>
> >
> > If prop1 is true, xxx will be executed. Since it
> > depends on "yyy", "yyy" is 'fired up'. If "prop2"
> > is true, then "yyy" is executed.
> >
> > Max Nalsky wrote:
> > >
> > > Hi!
> > >
> > > Sorry if I post questions that were already discussed here.
> > >
> > > I haven't heard of Ant a week ago, now I'm using it for all
> > my projects
> > > and I'm extremely happy with it! Thank all of you for developing it.
> > >
> > > Questions:
> > >
> > > 1) How can I defince a target that should be invoked only if TWO
> > > properties are simultaneously set? Using
> > >
> > > <target name="xxx" if="prop1,prop2">
> > >
> > > seem does not work. Is anyone has got an advice on it?
> >
=====
([EMAIL PROTECTED])
__________________________________________________
Do You Yahoo!?
Yahoo! Messenger - Talk while you surf! It's FREE.
http://im.yahoo.com/