ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ehatc...@apache.org
Subject cvs commit: jakarta-ant/src/testcases/org/apache/tools/ant/types PatternSetTest.java
Date Tue, 26 Mar 2002 22:52:31 GMT
ehatcher    02/03/26 14:52:31

  Modified:    src/main/org/apache/tools/ant/types PatternSet.java
               src/testcases/org/apache/tools/ant/types PatternSetTest.java
  Log:
  Implementation of nested patternsets.  Addresses PR3761
  
  Revision  Changes    Path
  1.21      +21 -0     jakarta-ant/src/main/org/apache/tools/ant/types/PatternSet.java
  
  Index: PatternSet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/types/PatternSet.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- PatternSet.java	26 Mar 2002 21:18:34 -0000	1.20
  +++ PatternSet.java	26 Mar 2002 22:52:31 -0000	1.21
  @@ -164,6 +164,27 @@
           super.setRefid(r);
       }
   
  +    public void addConfiguredPatternset(PatternSet p) {
  +        if (isReference()) {
  +            throw noChildrenAllowed();
  +        }
  +
  +        String[] nestedIncludes = p.getIncludePatterns(getProject());
  +        String[] nestedExcludes = p.getExcludePatterns(getProject());
  +
  +        if (nestedIncludes != null) {
  +            for (int i=0; i < nestedIncludes.length; i++) {
  +                createInclude().setName(nestedIncludes[i]);
  +            }
  +        }
  +
  +        if (nestedExcludes != null) {
  +            for (int i=0; i < nestedExcludes.length; i++) {
  +                createExclude().setName(nestedExcludes[i]);
  +            }
  +        }
  +    }
  +
       /**
        * add a name entry on the include list
        */
  
  
  
  1.6       +16 -0     jakarta-ant/src/testcases/org/apache/tools/ant/types/PatternSetTest.java
  
  Index: PatternSetTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/testcases/org/apache/tools/ant/types/PatternSetTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PatternSetTest.java	10 Jan 2002 10:13:13 -0000	1.5
  +++ PatternSetTest.java	26 Mar 2002 22:52:31 -0000	1.6
  @@ -222,4 +222,20 @@
                        1, i.length);
           assertEquals("exclude", i[0]);
       }
  +    
  +    public void testNestedPatternset() {
  +        PatternSet p = new PatternSet();
  +        p.setIncludes("**/*.java");
  +
  +        PatternSet nested = new PatternSet();
  +        nested.setExcludes("**/*.class");
  +
  +        p.addConfiguredPatternset(nested);
  +
  +        String[] excludes = p.getExcludePatterns(project);
  +        String[] includes = p.getIncludePatterns(project);
  +
  +        assertEquals("Includes","**/*.java", includes[0]);
  +        assertEquals("Excludes","**/*.class", excludes[0]);
  +    }
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message