ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antoine Lévy-Lambert <anto...@antbuild.com>
Subject Re: Telling DirectoryScanner to scan each directory separately.
Date Mon, 26 Jan 2004 09:21:10 GMT
Antony paul wrote:

> Hi all,
>   I am writing a custom task which needs to get the list of included 
> files for each directory but not any subdirectory and files inside it. 
> First I have to get all included directories which is set in the build 
> file. Then I will scan each individual directory to get the included 
> files. While scanning a directory I dont want to get any subdirectory 
> name or files in subdirectory. How to do this.
>
>
>
This snippet is really for ant 1.6.0, because the type selector has been 
introduced in 1.6.0

If you do not want to include subdirectories in a fileset, do something 
like :

<fileset dir="somedir" id="myfileset">
    <!-- this include pattern includes only files and dirs under somedir -->
    <include name="*"/>
    <!-- exclude directories -->
    <not>
        <type type="dir"/>
    </not>
</fileset>


if you have put such a snippet in a build file, for which you have 
created a Project object,
you can get the reference back to your fileset with

Reference r = getProject().getReference("myfileset");
FileSet myFileset = (FileSet) r.getReferencedObject();


 > I am using 1.5.4. Custome task is extending MatchingTask. Also a 
minor problem. I am using the same build file to compile and run the 
custom task. First compile, make it a jar, copy the jar file to 
ANT_HOME\lib directory >then call the target to run the task. If I run 
the task in one step it will run the old class file. I have to launch 
ant a second time to run the newly copied task. Is it possible to 
compile and run it in one step ?.

You might want to wrap your build process in a script or .bat file and 
separate the compilation/jarring of the custom task, and the use of the 
custom task. (Just my feeling).


Antoine

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


Mime
View raw message