On Wednesday 20 March 2002 22:22 pm, you wrote:
> I have the following need that I couldn't work out by myself so far:
> - In order to fire a target I need to make sure at least one Test*.java
> exist anywhere in my test source hierarchy.
>
> Naively I tried the following rule, but without success because
> <available/> is only capable of testing the existence of a single well
> know file at once. <available/> does not support file pattern !
>
> <target name = "test_cases.exists">

>       <!-- check that at least one Test*.java exist anywhere in the test
> source hierarchy -->
>       <available file = "${src.test}/**/Test*.java" type = "file"
> property = "test_cases_exists"/>
> </target>

i don't believe the file attribute of <available> supports wildcards, as it's 
designed to look for ONE file. You could probably use a combination of the 
tips Dominique and Diane just showed us. Something like:

� <target name="doit" depends="check_for_testcases" 
          if="tast_cases.exist">
� � <echo message="files = ${files}"/>
� </target>


  <fileset dir="${src.test}" id="fs"/>
<!-- i don't know the syntax for fileset, but there must be something which 
lets you add file wildcards to it -->

� <target name="check_for_testcases">
� � <pathconvert pathsep="," property="files" refid="fs"/>
� � <condition property="tast_cases.exist">
� � � <not><equals arg1="${files}" arg2=""/></not>
� � </condition>
� </target>

----- stephan
Generic Universal Computer Guy
[EMAIL PROTECTED] - http://www.einsurance.de
Office: +49 (89) �552 92 862 Handy: �+49 (179) 211 97 67
"I ain't gen'rally given to physicality of that nature but it saves
a lot of arguing." -- Nanny Ogg

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to