ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Proetel, Ingo" <iproe...@SELECTICA.com>
Subject RE: Combining PatternSets with Path elements
Date Thu, 09 Nov 2000 18:30:24 GMT
If have a similar need. I would wish for something like:

<patternset id="packages">
  <include name="com/foo/util/**"  />
  <include name="com/foo/bar/**" />
</patternset>

<target name="compile" >
  <javac>  
    <patternset refid="packages" >
      <!-- this would include all .java files in the patternset only -->

      <include name="**/*.java" />
    </patternset>
  </javac>
</target>

<target name="package" >
  <jar>  
    <patternset refid="packages" >
      <!-- this would exclude all .java files in the patternset only -->

      <exclude name="**/*.java" />
    </patternset>
  </jar>
</target>

<target name="clean" >
  <delete>  
    <patternset refid="packages" >
      <!-- this would include all .class files in the patternset only -->

      <include name="**/*.class" />
    </patternset>
  </delete>
</target>



 What I gain is that for each project I only have to maintain one
patternset, and for each task I can define which files it should use.

ingo
> -----Original Message-----
> From: Matt_Conway@i2.com [mailto:Matt_Conway@i2.com]
> Sent: Thursday, November 09, 2000 9:04 AM
> To: ant-user@jakarta.apache.org
> Subject: Re: Combining PatternSets with Path elements
> 
> 
> 
> Sort of.  What I had in mind was the following:
> 
> <patternset id="packages">
>   <include name="com/foo/util/*" />
>   <include name="com/foo/bar/*" />
> </patternset>
> 
> <target name="compile">
>      <javac>
>           <!-- This is fine because javac task knows to only look for
> *.java files -->
>           <patternset refid="packages"/>
>      </javac>
> </target>
> 
> <target name="some_other_task">
>      <!-- I want this task to copy all *.foo files elsewhere, 
> but can't
> figure out
>      how to make the copy task only look for *.foo files, and 
> not others.
> -->
>      <copy todir="outputdir">
>           <fileset>
>                <patternset refid="packages"/>
>           </fileset>
>      </copy>
> </target>
> 
> I can't figure out how to reuse the patternset in some other 
> task (just
> using copy as an example) with different extensions - the patternset
> selects all files, and not _just_ the *.foo files.  Any ideas? Thanks,
> 
> Matt
> 
> 
> 
> <patternset id="component1">
>   <include name="**/com/foo/util/*" />
>   <include name="**/com/foo/bar/*" />
> </patternset>
> 
> > Where I get stuck is figuring out how to be able to specify a list
> > of package directories in the project xml and then be able to use
> > that list to limit my make rules to those directories, i.e. my javac
> > task would only compile the java files in those directories, my
> > ejbcompiler task would only process the ejbs in those directories,
> > etc.
> 
> <javac>
>   <patternset refid="component1" />
> </javac>
> 
> for example.
> 
> Unfortunately not all tasks support patternsets as the should, javadoc
> being a prominent exception.
> 
> I think this is what you've been asking for, but I'm not sure.
> 
> Stefan
> 
> 
> 
> 

Mime
View raw message