You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by BOUSQUET Jeremie <Je...@gemplus.com> on 2005/08/22 09:05:16 UTC

Match list of files agains fileset

I reply to this message because my problem is quite similar in reverse...

I use the following to check that some dependencies listed in a file (relative paths) really exist in a real fileset.

[ANT SCRIPT]
<pathconvert property="unknown.dependencies" setonempty="false">
   <path>
       <fileset dir="${real.fileset}"
           includesfile="${dependencies.list.filename}">
           <different targetdir="${real.fileset}"
              ignoreFileTimes="true"/>
       </fileset>
   </path>
</pathconvert>
[ANT SCRIPT]

This, of course, does not do what was expected : all files included in <fileset> are by construction existing files, and so <different> does not match anything ...

Well to make it work I would love just to replace <fileset> by <filelist>, because in filelist files don't need to really exist ...
But it's not possible because <filelist> don't know about <includesfile> attribute, so I'm ... A bit disappointed.

Do you think my analysis is correct ?
And how to resolve this issue ? (without coding a new <filelist> ...)

Regards,
Jeremie


> -----Original Message-----
> From: Jan.Materne@rzf.fin-nrw.de [mailto:Jan.Materne@rzf.fin-nrw.de] 
> Sent: jeudi 18 août 2005 07:50
> To: user@ant.apache.org
> Subject: AW: Ensure Build Failed if fileset contains no jars
> 
>     <pathconvert property="files" setonempty="false">
>         <fileset dir="." includes="check.txt"/>
>     </pathconvert>
>     <fail message="no files" unless="files"/>
> 
> Just set up the fileset ...
> 
> 
> Jan 
> 
> >-----Ursprüngliche Nachricht-----
> >Von: Rebhan, Gilbert [mailto:Gilbert.Rebhan@huk-coburg.de]
> >Gesendet: Mittwoch, 17. August 2005 16:20
> >An: user@ant.apache.org
> >Betreff: Ensure Build Failed if fileset contains no jars
> >
> >
> >Hi,
> >
> >Problem =
> >
> >my script contains a target with two filesets.
> >If the compile -done in another script- fails, there are only empty 
> >folders, but no jars in it.
> >
> >If compile successful it looks like =
> >
> >dist/lib
> >        /Toplevel
> >	/project1
> >	/project2
> >
> >if compile failed it looks like that =
> >
> >dist/lib
> >        /Toplevel
> >
> ><target name="publish">
> >     
> >     <fileset id="jarsfolder" dir="./temp/dist/lib/Toplevel"
> >includes="**/*"/>
> >     <fileset id="jarsonly"   dir="./temp/dist/lib/Toplevel"
> >includes="**/*.jar"/>
> >     
> >        <copy todir="${safir.jar.deploy}safir" overwrite="true">
> >            <fileset refid="jarsfolder"/>
> >        </copy>
> >        
> >        
> >        <move todir="./jars" flatten="true">
> >            <fileset refid="jarsonly"/>
> >        </move>
> >        
> >    <!-- Move von Auftrag.txt und *.doc -->    
> >        <move file="${safir.txtquelle}${wordfile_move}"
> >todir="${safir.txtziel}/temp"/>   
> >        <move file="${auftragtxt}" todir="${safir.txtziel}"/>
> >
> ><target name="clean" depends="publish">
> ><delete includeemptydirs="yes">        
> >            <fileset dir="C:/cc_safir_workdir/checkout"
> >defaultexcludes="no">
> >                <include name ="**/*"/> 
> >                <exclude name="**/jars/*"/>
> >                <exclude name="**/SAFIR Build/**"/>
> >            </fileset> 
> >         </delete>
> >
> >
> >the filesets jarsfolder and jarsonly exist but only as empty 
> >directories, containing no jars as compile in another script failed.
> >
> >The script runs successful =
> >
> >Buildfile: publisher.xml
> >
> >publish:
> >
> >  *** those are the txt and doc files that shouldnt be moved,
> >       when compile in other script failed and no jars available ***
> >
> >     [move] Moving 1 file to C:\deployserver\liefern\prod\temp
> >     [move] Moving 1 file to C:\deployserver\liefern\prod
> >
> >clean:
> >   [delete] Deleting 1831 files from C:\cc_safir_workdir\checkout
> >   [delete] Deleted 175 directories from C:\cc_safir_workdir\checkout
> >
> >BUILD SUCCESSFUL
> >
> >Question : The script should fail, if there are no jars beyond the 
> >toplevel directory.
> >
> >How to get a Build Failed when there are only empty folders ?
> >
> >
> >Regards, Gilbert
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For 
> additional 
> >commands, e-mail: user-help@ant.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For 
> additional commands, e-mail: user-help@ant.apache.org
> 
> 

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