You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Daniels, Doug" <Do...@GDC4S.Com> on 2004/01/21 18:40:07 UTC

Nested patternset, patternset intersection

I want to match a certain pattern in my package directory structure but want
to exclude a certain subdirectory in there, I'm looking to do an <include
.../> AND <exclude..../> which I assume is what the patternset allows me to
do, but it isn't working. My second question is can I nest a patternset
within another patternset?

Here is my problem:
  <patternset id="ExcPresentationFiles"> 
      <exclude
name="**/${PackageName}/presentation/adaptation/RouterDeviceAgentAdapter.jav
a" />
      <exclude
name="**/${PackageName}/presentation/presUtil/SnmpPoller.java" />
      <exclude
name="**/${PackageName}/presentation/presUtil/TrapListener.java" />
  </patternset>

  <patternset id="BuildDirs">
    <patternset refid="ExcPresentationFiles" />
   <!-- include only at the level of particular package -->
     <include name="**/${PackageName}/**" />
  </patternset>


where the /presentation... code is within the package I'm trying to match. I
then use this patternset in my compile, and jar targets as so:

  <target name="compile">
<!-- fork the compile task and give it 1gb of memory to use -->
     <javac srcdir="${Src}" classpathref="project.class.path" fork="true"
memorymaximumsize="1024m">	    
<!-- only compile whats in the application we need -->
	 <patternset refid="BuildDirs" /> 
     </javac>
  </target>

But when it runs it still tries to compile the code in the
${PackageName}/presentation/adaptation/RouterDeviceAgentAdapter.java file,
and the other ones that I listed as excluded. I've tried putting the
excludes directly in the BuildDirs patternset, no luck, it seems to me that
its doing a union instead of an intersection of the patterns, is this how
the patternset is supposed to work, or am I just not doing something
correctly? Any suggestions.

~Doug Daniels

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


Re: Nested patternset, patternset intersection

Posted by Stefan Bodewig <bo...@apache.org>.
On Wed, 21 Jan 2004, Peter Reilly <pe...@corvil.com> wrote:

> 2) (not too sure about this)
> The order of includes and excludes is important, put the
> includes first and then the excludes.

No, order is irrelevant.  exclude wins over include.

Stefan

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


Re: Nested patternset, patternset intersection

Posted by Peter Reilly <pe...@corvil.com>.
1)
If the class RouterDeviceAgentAdapter is used by any of
the classes to be compiled, javac will attempt to compile it
even if it not in the list of files to be compiled.

2) (not too sure about this)
The order of includes and excludes is important, put the
includes first and then the excludes.

Peter

Daniels, Doug wrote:

>I want to match a certain pattern in my package directory structure but want
>to exclude a certain subdirectory in there, I'm looking to do an <include
>.../> AND <exclude..../> which I assume is what the patternset allows me to
>do, but it isn't working. My second question is can I nest a patternset
>within another patternset?
>
>Here is my problem:
>  <patternset id="ExcPresentationFiles"> 
>      <exclude
>name="**/${PackageName}/presentation/adaptation/RouterDeviceAgentAdapter.jav
>a" />
>      <exclude
>name="**/${PackageName}/presentation/presUtil/SnmpPoller.java" />
>      <exclude
>name="**/${PackageName}/presentation/presUtil/TrapListener.java" />
>  </patternset>
>
>  <patternset id="BuildDirs">
>    <patternset refid="ExcPresentationFiles" />
>   <!-- include only at the level of particular package -->
>     <include name="**/${PackageName}/**" />
>  </patternset>
>
>
>where the /presentation... code is within the package I'm trying to match. I
>then use this patternset in my compile, and jar targets as so:
>
>  <target name="compile">
><!-- fork the compile task and give it 1gb of memory to use -->
>     <javac srcdir="${Src}" classpathref="project.class.path" fork="true"
>memorymaximumsize="1024m">	    
><!-- only compile whats in the application we need -->
>	 <patternset refid="BuildDirs" /> 
>     </javac>
>  </target>
>
>But when it runs it still tries to compile the code in the
>${PackageName}/presentation/adaptation/RouterDeviceAgentAdapter.java file,
>and the other ones that I listed as excluded. I've tried putting the
>excludes directly in the BuildDirs patternset, no luck, it seems to me that
>its doing a union instead of an intersection of the patterns, is this how
>the patternset is supposed to work, or am I just not doing something
>correctly? Any suggestions.
>
>~Doug Daniels
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>
>
>  
>


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