You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Kamal Bhatt <kb...@tt.com.au> on 2005/12/08 04:40:03 UTC

Determining empty fileset

Hi
I am new to ant and I am trying to create a script to distribute only 
those files that were modified since the last distribution.

I would like to stop distribution if no files have been changed. 
However, I cannot seem to be able to work this into my script. I know 
that I can use path convert to determine if a fileset is empty or not, 
but I don't know how or how to use the property from pathconvert.

Any help would be appreciated.

Thanks.


Kamal.



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Determining empty fileset

Posted by Antoine Levy-Lambert <an...@gmx.de>.
Kamal Bhatt wrote:

> I know that I can use path convert to determine if a fileset is empty
> or not, but I don't know how or how to use the property from pathconvert.
>
Hello Kamal,

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>

Cheers,

Antoine

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org