You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Scott Goldstein <sd...@mailandnews.com> on 2002/06/26 03:17:30 UTC

Reverse PatternSet

Is there any way to reverse a PatternSet?  In other words, if a PatternSet 
includes a list of files, is there anyway that I can reverse it to that it 
excludes a list of files?

Here's the context.

I want to write a target that compiles a number of files in a src tree.  The 
classes, however, have two different destination directories.  So, I wanted to 
write two javac tasks, one that excludes a patternset of file and compiles to 
directory A and one that excludes the patternset of files and for to directory 
B.

Is there a better way of doing this?  Do I just have to define two 
Patternsets?

Thanks for the help.

Scott

------------------------------------------------------------
"Just a mirror for the sun...
 My smiling eyes are just a mirror for the sun."
------------------------------------------------------------


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Reverse PatternSet

Posted by Scott Goldstein <sd...@mailandnews.com>.
Thanks for the help.  That did the trick!

Scott

Diane Holt wrote:

> --- Erik Hatcher <ja...@ehatchersolutions.com> wrote:
> > Sorry for the confusion.  I did not mean it would literally negate a
> > <patternset>, but that it could be used to accomplish the functionality
> > Scott asked about.  You could create a <selector> that nested a
> > <filename> (or more, inside an <or>), and then another <selector>
> > that negated the previous one by refid.
>
> Yeah, okay, that'd work. (I gotta play with these things more :)
>
>   <selector id="selector.java">
>     <filename name="**/*.java"/>
>   </selector>
>
>   <fileset dir="src" id="fs1">
>     <selector refid="selector.java"/>
>   </fileset>
>
>   <fileset dir="src" id="fs2">
>     <not>
>       <selector refid="selector.java"/>
>     </not>
>   </fileset>
>
> Results in "fs1" containing all the .java files under the src directory,
> and "fs2" containing all the files under the src directory except the
> .java files.
>
> Diane
>
> =====
> (holtdl@yahoo.com)
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! - Official partner of 2002 FIFA World Cup
> http://fifaworldcup.yahoo.com
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Reverse PatternSet

Posted by Diane Holt <ho...@yahoo.com>.
--- Erik Hatcher <ja...@ehatchersolutions.com> wrote:
> Sorry for the confusion.  I did not mean it would literally negate a
> <patternset>, but that it could be used to accomplish the functionality
> Scott asked about.  You could create a <selector> that nested a
> <filename> (or more, inside an <or>), and then another <selector>
> that negated the previous one by refid.

Yeah, okay, that'd work. (I gotta play with these things more :)

  <selector id="selector.java">
    <filename name="**/*.java"/>
  </selector>

  <fileset dir="src" id="fs1">
    <selector refid="selector.java"/>
  </fileset>

  <fileset dir="src" id="fs2">
    <not>
      <selector refid="selector.java"/>
    </not>
  </fileset>

Results in "fs1" containing all the .java files under the src directory,
and "fs2" containing all the files under the src directory except the
.java files.

Diane

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



__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Reverse PatternSet

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
Sorry for the confusion.  I did not mean it would literally negate a
<patternset>, but that it could be used to accomplish the functionality
Scott asked about.  You could create a <selector> that nested a <filename>
(or more, inside an <or>), and then another <selector> that negated the
previous one by refid.

(I haven't tried this, I'm speaking hypothetically.  I'm sure Diane will let
me know if I'm wrong! :)

    Erik


----- Original Message -----
From: "Diane Holt" <ho...@yahoo.com>
To: "Ant Users List" <an...@jakarta.apache.org>
Sent: Tuesday, June 25, 2002 10:11 PM
Subject: Re: Reverse PatternSet


> --- Erik Hatcher <ja...@ehatchersolutions.com> wrote:
> > Have a look at Selectors in Ant 1.5.  There is a <not> selector that
> > would do the trick.
>
> Except it doesn't take a <patternset>, just a <filename> (which doesn't
> take a refid to a <patternset> either).
>
> Diane
>
> =====
> (holtdl@yahoo.com)
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! - Official partner of 2002 FIFA World Cup
> http://fifaworldcup.yahoo.com
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Reverse PatternSet

Posted by Diane Holt <ho...@yahoo.com>.
--- Erik Hatcher <ja...@ehatchersolutions.com> wrote:
> Have a look at Selectors in Ant 1.5.  There is a <not> selector that
> would do the trick.

Except it doesn't take a <patternset>, just a <filename> (which doesn't
take a refid to a <patternset> either).

Diane

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



__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Reverse PatternSet

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
Have a look at Selectors in Ant 1.5.  There is a <not> selector that would
do the trick.

    Erik


----- Original Message -----
From: "Scott Goldstein" <sd...@mailandnews.com>
To: <an...@jakarta.apache.org>
Sent: Tuesday, June 25, 2002 9:17 PM
Subject: Reverse PatternSet


> Is there any way to reverse a PatternSet?  In other words, if a PatternSet
> includes a list of files, is there anyway that I can reverse it to that it
> excludes a list of files?
>
> Here's the context.
>
> I want to write a target that compiles a number of files in a src tree.
The
> classes, however, have two different destination directories.  So, I
wanted to
> write two javac tasks, one that excludes a patternset of file and compiles
to
> directory A and one that excludes the patternset of files and for to
directory
> B.
>
> Is there a better way of doing this?  Do I just have to define two
> Patternsets?
>
> Thanks for the help.
>
> Scott
>
> ------------------------------------------------------------
> "Just a mirror for the sun...
>  My smiling eyes are just a mirror for the sun."
> ------------------------------------------------------------
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>