xml - if else for ant script -
hi current have ant script:
<target name="cleanup snapshots" description="cleanup truecm snapshots"> <echo>executing: ${truecm_app}\ssremove.exe -h${truecm_host} "${truecm_new_ss}"</echo> <exec executable="${truecm_app}\ssremove.exe" failonerror="${truecm_failon_exec}"> <arg line="-h ${truecm_host}"/> <arg line='-f "${truesase}/${product_version}/${name}"'/> </exec> </target> what script execute ssremove.exe parameters shown.
however, script above valid when parameter ${product_version} contains word "extensions" example 6.00_extensions
else if dont contain "extensions" script should this:
<target name="cleanup snapshots" description="cleanup truecm snapshots"> <echo>executing: ${truecm_app}\ssremove.exe -h${truecm_host} "${truecm_new_ss}"</echo> <exec executable="${truecm_app}\ssremove.exe" failonerror="${truecm_failon_exec}"> <arg line="-h ${truecm_host}"/> <arg line='-f "${truesase}/${name}"'/> </exec> </target> so question how should add if else statements contain line "extensions"? or how check if "extensions" word present?
just outline solution if can't add custom library ant build. note need pretty recent version of ant (>= 1.7, think).
first, need put result of test in property (use condition contains; see ant manual). can use property in exec skip when property true.
<condition property="hasextensions"> <contains string="${product_version}" substring="extensions"> </condition> <exec ... unless="hasextensions"> ... </exec>
Comments
Post a Comment