You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by John Fisher <fi...@llnl.gov> on 2001/05/04 03:07:57 UTC

wildcarding dir in fileset?


Hi folks-

I'm at my wits end here. I'm trying to adapt Ant to work with our Apex
development environment. I've already had to hack the Ant code to get
compilations to work (they work beautifully now). I'm trying to get the
creation of jar files to work. I've included a *manually* constructed ant
XML file below that creates a jar file with the appropriate content. You
will notice that I have quite a number of filesets; each represents one of
the Apex import directories. My probably is that for any Apex view, this
list is arbitrary. In other words, my list of "dir" values that I need to
process are
"/nif/code/Framework_Templates/GUI.ss/fisher_java.wrk/Links/Imported_Views/*
/classes" (you can see I've created n fileset entries to match this
pattern). How the heck can I generate these n filesets automatically,
without some sort of XML generation preprocessor?

Thanks,
John





<project name="mytest" default="dist" basedir=".">

  <patternset id="jarable"
        includes="**/*.class,**/*.gif,**/*.xml,**/*.jlx,**/*.dtd"
        excludes="**/Links,**/.Makefile.rtnl" />

  <target name="main">
    <delete
file="/nif/code/Framework_Templates/GUI.ss/fisher_java.wrk/classes/myapp.jar
" />
    <jar
jarfile="/nif/code/Framework_Templates/GUI.ss/fisher_java.wrk/classes/myapp.
jar">
       <fileset
dir="/nif/code/Framework_Templates/GUI.ss/fisher_java.wrk/Links/Imported_Vie
ws/Application/classes">
           <patternset refid="jarable" />
       </fileset>
       <fileset
dir="/nif/code/Framework_Templates/GUI.ss/fisher_java.wrk/Links/Imported_Vie
ws/Configuration/classes">
           <patternset refid="jarable" />
       </fileset>
       <fileset
dir="/nif/code/Framework_Templates/GUI.ss/fisher_java.wrk/Links/Imported_Vie
ws/GUI/classes">
           <patternset refid="jarable" />
       </fileset>
       <fileset
dir="/nif/code/Framework_Templates/GUI.ss/fisher_java.wrk/Links/Imported_Vie
ws/GUI_Images/classes">
           <patternset refid="jarable" />
       </fileset>
       <fileset
dir="/nif/code/Framework_Templates/GUI.ss/fisher_java.wrk/Links/Imported_Vie
ws/Hardware/classes">
           <patternset refid="jarable" />
       </fileset>
       <fileset
dir="/nif/code/Framework_Templates/GUI.ss/fisher_java.wrk/Links/Imported_Vie
ws/ICCS_Types/classes">
           <patternset refid="jarable" />
       </fileset>
       <fileset
dir="/nif/code/Framework_Templates/GUI.ss/fisher_java.wrk/Links/Imported_Vie
ws/Oracle/classes">
           <patternset refid="jarable" />
       </fileset>
       <fileset
dir="/nif/code/Framework_Templates/GUI.ss/fisher_java.wrk/Links/Imported_Vie
ws/Reservation/classes">
           <patternset refid="jarable" />
       </fileset>
       <fileset
dir="/nif/code/Framework_Templates/GUI.ss/fisher_java.wrk/Links/Imported_Vie
ws/Status_Monitor/classes">
           <patternset refid="jarable" />
       </fileset>
       <fileset
dir="/nif/code/Framework_Templates/GUI.ss/fisher_java.wrk/Links/Imported_Vie
ws/System_Manager/classes">
           <patternset refid="jarable" />
       </fileset>
       <fileset
dir="/nif/code/Framework_Templates/GUI.ss/fisher_java.wrk/Links/Imported_Vie
ws/Utilities/classes">
           <patternset refid="jarable" />
       </fileset>
    </jar>

  </target>
</project>


Re: wildcarding dir in fileset?

Posted by Diane Holt <ho...@yahoo.com>.
--- John Fisher <fi...@llnl.gov> wrote:
> My probably is that for any Apex view, this
> list is arbitrary. In other words, my list of "dir" values that I need
> to process are
>
"/nif/code/Framework_Templates/GUI.ss/fisher_java.wrk/Links/Imported_Views/*
> /classes" (you can see I've created n fileset entries to match this
> pattern). How the heck can I generate these n filesets automatically,
> without some sort of XML generation preprocessor?

Unless you have some kind of inclusion and/or exclusion pattern for the
subdirs to include/exclude, I can't think of any way to do it without
explicitly listing the dirs you want/don't want. But you could at least
shrink down the way you've currently got it:

<property name="top.dir" value="/nif/code/Framework_Templates/GUI.ss"/>
<property name="work.dir" value="${top.dir}/fisher_java.wrk"/>

<property name="links.dir" value="${work.dir}/Links/Imported_View"/>

<patternset id="jarable"
       includes="**/*.class,**/*.gif,**/*.xml,**/*.jlx,**/*.dtd"
       excludes="**/Links,**/.Makefile.rtnl"/>

 <target name="main">
   <delete file="${work.dir}/classes/myapp.jar"/>
   <jar jarfile="${work.dir}/classes/myapp.jar">
      <fileset dir="${work.dir}">
          <patternset refid="jarable" />
          <include name="${links.dir}/Application/classes"/>
          <include name="${links.dir}/Configuration/classes"/>
          <include name="${links.dir}/GUI/classes"/>
          <include name="${links.dir}/GUI_Images/classes"/>
          <include name="${links.dir}/Hardware/classes"/>
          <include name="${links.dir}/ICCS_Types/classes"/>
          <include name="${links.dir}/Oracle/classes"/>
          <include name="${links.dir}/Reservation/classes"/>
          <include name="${links.dir}/Status_Monitor/classes"/>
          <include name="${links.dir}/System_Manager/classes"/>
          <include name="${links.dir}/Utilities/classes"/>
      </fileset>
   </jar>
 </target>

If you could say "${links.dir}/*/classes" (with an excludes, if you need
to exclude stuff), all the better -- then all you'd need is:
      <fileset dir="${work.dir}">
          <patternset refid="jarable" />
          <include name="${links.dir}/*/classes"/>
          <exclude name="whatever_you_need_excluded"/>
      </fileset>

Diane

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



__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/