16
You can use the pathconvert task to do that, with the setonempty property.
<pathconvert refid="myfileset"
property="fileset.notempty"
setonempty="false"/>
will set the property fileset.notempty only if the fileset those refid is myfileset is not empty.
You just have to define myfileset with your directory, and no excludes do get a directory empty test:
<fileset dir="foo/bar" id="myfileset"/>
See this example for a use case:
use the setonempty attribute of pathconvert, with the value "false". This way, if the fileset is empty, the property will not be set. this is good since targets check with their if attribut whether a property is set or not.
so you do something like :
<fileset dir="foo/bar" id="myfileset"/> <target name="fileset.check"> <pathconvert refid="myfileset" property="fileset.notempty" setonempty="false"/> </target> <target name="main" depends="fileset.check" if="fileset.nonempty"> <!-- your main work goes here --> </target>