You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Jason Rosenberg <ja...@squaretrade.com> on 2000/11/29 00:31:16 UTC

patternset question...

Hello,

I am creating a simple build.xml with 2 targets:

compile
clean

The compile needs to reference the specific .java files to be compiled,
and the clean needs to reference the specific .class files to be deleted.
The build dir is the same as the source dir.

So far, I have created 2 patternsets, one for the .java files, and one for
the .class files:

 <patternset id="sourceFiles">
  <include name="${buildDir}/EventTime.java"/>
  <include name="${buildDir}/EventOutMail.java"/>
 </patternset>

 <patternset id="classFiles">
  <include name="${buildDir}/EventTime.class"/>
  <include name="${buildDir}/EventOutMail.class"/>
 </patternset>

I am wondering if there is a more efficient way to do this as a single patternset.
Is there a way I can parameterize the file extension.  This would help avoid errors
by only itemizing the set of files to be built a single time.

I don't want to use liberal wildcards *.java or *.class, because other files may be
in the directory that I don't want to be involved in the target in question, etc.

Is there some like:

 <patternset id="filenames">
  <include name="${buildDir}/EventTime.${ext}"/>
  <include name="${buildDir}/EventOutMail.${ext}"/>
 </patternset>

and then have it interpret the ext property differently depending on whether I am
interested in .class files or .java files.

Jason