ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <hol...@yahoo.com>
Subject Re: Patternsets, Filesets, and Mapper
Date Thu, 28 Feb 2002 05:08:46 GMT
--- eoti@mind.net wrote:
> No, my patternset was like:
> <patternset id="packages">
>   <include name="com.mycompany.util.class1"/>
>   <include name="com.mycompany.io.class2"/>
>   <!-- about 40 more package names -->
> </patternset>

Okay, this is where I get confused. Is com.mycompany.util.class1 actually
a package name -- or is it the name of a class within the
com.mycompany.util package?

[From your other reply]
> I mean, if you can provide me the correct way to do it with the current
> codebase, great --

Well, assuming the above question's answer is the "or", the following
build.xml file should give you, from a fileset of .java source filenames,
a comma-separated list of the same set of files with .class suffixes (with
the path changed to be in a build/classes dir) and a comma-separated list
of the same set of files in the dot-notation you show above (note: it does
require 1.5alpha for the <replaceregexp> task, but I believe that is what
you're using, right?):
<project name="malachi" default="genLists">

  <fileset dir="src" id="srcfiles">
    <include name="com/mycompany/util/class1.java"/>
    <include name="com/mycompany/io/class2.java"/>
  </fileset>

  <target name="genLists" depends="setClassList,setPkgList">
    <echo message="classfiles = ${classfiles}"/>
    <echo message="pkglist = ${pkglist}"/>
  </target>

  <target name="setClassList">
    <delete file="classes.properties"/>
    <pathconvert pathsep="," property="classes" refid="srcfiles">
      <map from="${basedir}${file.separator}src"
           to="${basedir}${file.separator}build${file.separator}classes"/>
    </pathconvert>
    <propertyfile file="classes.properties">
      <entry key="classfiles" value="${classes}"/>
    </propertyfile>
    <replace file="classes.properties">
      <replacefilter token=".java" value=".class"/>
    </replace>
    <property file="classes.properties"/>
  </target>

  <target name="setPkgList">
    <delete file="pkgs.properties"/>
    <pathconvert pathsep="," dirsep="." property="pkgs" refid="srcfiles">
      <map from="${basedir}" to=""/>
    </pathconvert>
    <propertyfile file="pkgs.properties">
      <entry key="pkglist" value="${pkgs}"/>
    </propertyfile>
    <replace file="pkgs.properties">
      <replacefilter token=".src." value=""/>
    </replace>
    <replaceregexp file="pkgs.properties"
                   match="\.java"
                   replace=""
                   flags="g"
                   byline="true"/>
    <property file="pkgs.properties"/>
  </target>

</project>

Diane


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



__________________________________________________
Do You Yahoo!?
Yahoo! Greetings - Send FREE e-cards for every occasion!
http://greetings.yahoo.com

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


Mime
View raw message