ant conditional if within a macrodef -


within ant, have macrodef.

assuming have use macrodef, , there item inside said macrodef want run iff property special.property exists , true, do?

i have

<macrodef name="somename">     <sequential>         <somemacrodefthatsetstheproerty  />         <some:thingherethatdependson if="special.property" />     <sequential> </macrodef> 

which doesn't work - some:thingherethatdependson doesnt have "if" attribute, , cannot add 1 it.

antcontrib not available.

with target can give target "if", can macrodef?

in ant 1.9.1 , higher, there new implementation of if , unless attributes. might you're thinking of.

first, need put them namespace. add them <project> header:

<project name="myproject" basedir="." default="package"     xmlns:if="ant:if"     xmlns:unless="ant:unless"> 

now, can add them ant task or sub entity:

<!-- copy on files special directory, if exists --> <available property="special.dir.available"     file="${special.dir} type="dir"/>  <copy todir="${target.dir}>     <fileset dir="${special.dir}" if:true="special.dir.available"/>     <fileset dir="${other.dir}"/> </copy>  <!-- ftp files on host, if it's on line--> <condition property="ftp.available">     <isreachable host="${ftp.host}"/> </condition>  <ftp server="${ftp.host}"      userid="${userid}"     passowrd="${password}"     if:true="ftp.available">     <fileset dir=".../> </ftp> 

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -