ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: how to test existance of file based on pattern
Date Wed, 20 Mar 2002 21:32:04 GMT
Diane just answered that one today, related to something else... She's
amazing ;-)

But, doesn't <javac> handle the fact that there's no sources to compile OK?
Have you tried it? --DD

-----Original Message-----
From: 	Diane Holt [mailto:holtdl@yahoo.com] 
Sent:	Wednesday, March 20, 2002 1:57 PM
To:	Ant Users List
Subject:	RE: Test if directory is empty

--- Dominique Devienne <DDevienne@lgc.com> wrote:
> Haven't tried it myself, but from the doc I would say that <pathconvert>
> would have converted your fileset the way you wanted. FWIW, --DD

Yep -- <pathconvert> will turn a fileset into a printable list. And you
could use it, in combination with <condition>, to test for an empty
directory -- eg:

  <fileset dir="foodir" id="fs"/>

  <target name="doit" depends="chkdir" unless="noFiles">
    <echo message="files = ${files}"/>
  </target>

  <target name="chkdir">
    <pathconvert pathsep="," property="files" refid="fs"/>
    <condition property="noFiles">
      <equals arg1="${files}" arg2=""/>
    </condition>
  </target>

Diane

=====
(holtdl@yahoo.com)


 -----Original Message-----
From: 	Zart Colwing [mailto:zartc@wanadoo.fr] 
Sent:	Wednesday, March 20, 2002 3:23 PM
To:	ant-user@jakarta.apache.org
Subject:	how to test existance of file based on pattern

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>

Any idea, any body.

Thanks
ZC.


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

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


Mime
View raw message