ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt_Con...@i2.com
Subject Re: Combining PatternSets with Path elements
Date Tue, 14 Nov 2000 16:53:35 GMT

An alternative approach, would be some way to combine a path element with a
pattern to produce a patternset.  The new pattern would simply be each path
concatenated with each pattern in the given arguments.  This would be less
complex as it doesn't complexify the already complex patternset feature.
Maybe it would look something like this:

<path id="packages">
     <pathelement location="com/foo/util" />
     <pathelement location="com/foo/bar" />
</path>

<patternset id="javafiles">
     <include name="*.java">
</patternset>

<createpatternset id="all_java_in_packages">
     <path refid="packages"/>
     <pattern refid="javafiles"/>
</createpatternset>

<createpatternset id="all_xml_in_packages">
     <path refid="packages"/>
     <pattern includes="*.xml"/>
</createpatternset>

<javac>
     <patternset refid="all_java_in_packages"/>
</javac>

<someothertask>
     <patternset refid="alll_xml_in_packages"/>
</someothertask>


Matt



                                                                                         
                                                  
                    Stefan                                                               
                                                  
                    Bodewig              To:     ant-user@jakarta.apache.org             
                                                  
                    <bodewig@bost        cc:                                          
                                                     
                    .de>                 Subject:     Re: Combining PatternSets with Path
elements                                          
                                                                                         
                                                  
                    11/13/00                                                             
                                                  
                    04:19 AM                                                             
                                                  
                    Please                                                               
                                                  
                    respond to                                                           
                                                  
                    ant-user                                                             
                                                  
                                                                                         
                                                  
                                                                                         
                                                  



Matt Conway <Matt_Conway@i2.com> wrote:

> This is sortof what I want as well - to be able to re-use a
> "generic" patternset with a more specific include pattern -
> i.e. reapply the include pattern to all the existing pattern, so a
> previous pattern like "com/foo/bar/+" would become
> "com/foo/bar/*.class" in a statement like given below
>
> <patternset id="packages">
>   <include name="com/foo/util/+" />
>   <include name="com/foo/bar/+" />
> </patternset>
>
> <patternset refid="packages">
>   <include name="*.class" />
> </patternset>
>
> This re-uses the patternset "packages" which is generic - by generic
> I mean that it has a '+' in it which is taken to mean that the +
> will get replaced with whatever you include when you reuse the
> patternset.  Obviously, there are more details to be worked out =)

I can see the benefit of restricting include patterns, but I'm not
sure how to tackle this.

The include patterns are additive and I think they should remain
additive. The same holds for exclude patterns.

What you are asking for is a way to refine a generic patternset for
different use cases, I wouldn't go and overload the meaning of include
for something like this. <restrict>?

I'm not sure I'd want to add something like this as one probably needs
one for the opposite action as well (exclude this package and that
package but (only|not) the .bar files in them). This is one of the
points where one starts trading convenience for complexity.

Stefan





Mime
View raw message