Danila Ladner
Danila Ladner

Reputation: 863

ANT Scenario Conditional Depend Targets

Is it possible in ANT to have the same target which depends on set of different targets depending on the condition in this target.

EXAMPLE:

<target name=my_target depends="target2,target3,target4" if="my_property1">

and

<target name=my_target depends="target2,target5,target6" if="my_property2">

Where "target2" evaluates properties my_property1 or my_property2.

Is something like this possible, or is there another way to assign to the same target different "depends" based on condition?

Thanks.

Upvotes: 3

Views: 764

Answers (1)

thekbb
thekbb

Reputation: 7934

You cannot have duplicate targets. I'm not quite clear on what you're goign for... what does target2 do with your properties? To replicate the behavior you have you could setup

<target name="my_target" depends="target2,target3,target4,target5,target6">

and then setup if and/or unless on target1-6 something like

<target name="target2"> (run target2 always)

<target name="target3" if="my_property1">

<target name="target4" if="my_property1">

<target name="target5" if="my_property2">

<target name="target6" if="my_property2">

Upvotes: 1

Related Questions