ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antoine Levy Lambert <anto...@gmx.de>
Subject Re: questions about dirset and depend task
Date Wed, 13 Jan 2010 14:52:41 GMT
Hello Cheney,

you can probably build your dirset using a scriptselector

see http://ant.apache.org/manual/CoreTypes/selectors.html#scriptselector 
about scriptselectors.

read the section about library dependencies, you will needs bsf.jar and 
js.jar on the classpath I think if you add some custom javascript to 
your build.

<dirset dir="webroot" id="containsjs">
<scriptselector language="javascript">
     
      importClass(java.io.File)
      importClass(java.lang.String)
      selected = false;
      filesindir = file.list();
      for (i = 0; i< filesindir.length; i++) {
         if (filesindir[i].endsWith(".js") {
              selected=true;
          }
      }
      self.setSelected(selected);
    </scriptselector>
</dirset>

<echo>${toString:containsjs}</echo>

<copy todir="deploy" includeemptydirs="true">
   <dirset refid="containsjs"/>
</copy>

For the depends task, I do not know it out of heart.

Regards,

Antoine

張毓成 wrote:
> Hi, everyone!
>   I wanna ask two questions.
>
> 1. how to select folders and sub folders that contains the specific
> filetype, and excludes all files.
> e.g.  select all folders that contains js files.
> i use the following script and it did not work.
>
> <copy todir="deploy">
>     <dirset dir="webroot" includes="**/*.js"/>
> </copy>
>
>
> 2.how to use the depend task? I delele a java file in the source
> folder and run the following script
> and class file in the classes wont be deleted.
> <depend srcdir="src" destdir="${classes.dir}" closure="on"/>
>
> thanks in advanced.
>
>   


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


Mime
View raw message