if and unless in ant

I would like to clarify the if and unless statements in ANT script

I have the following code:

<condition property="hasExtensions">
    <contains string="${Product_version}" substring="Extensions">
</condition>

<exec executable="${TrueCM_App}\ssremove.exe" unless="hasExtensions">
    ...
</exec>

Does that mean the above would execute ssremove.exe if Product_version does not contain the string "Extensions"?

Then how about the opposite case: if it contains the string "Extensions"? Will my code look like this:

<condition property="hasExtensions">
    <contains string="${Product_version}" substring="Extensions">
</condition>
<!-- here below it does not have the string "Extensions" -->
<exec executable="${TrueCM_App}\ssremove.exe" unless="hasExtensions">
    ...
</exec>

<!-- below is for if it has the string "Extensions" -->
<exec executable="${TrueCM_App}\ssremove.exe" if="hasExtensions">
    ...
</exec>
8
задан Paul Bellora 20 January 2012 в 22:15
поделиться