You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bo...@apache.org on 2006/04/29 16:56:34 UTC

svn commit: r398170 - in /ant/core/trunk: WHATSNEW src/etc/testcases/taskdefs/unzip.xml src/main/org/apache/tools/ant/taskdefs/Expand.java

Author: bodewig
Date: Sat Apr 29 07:56:34 2006
New Revision: 398170

URL: http://svn.apache.org/viewcvs?rev=398170&view=rev
Log:
merge multiple patternsets - PR 38973

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/src/etc/testcases/taskdefs/unzip.xml
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Expand.java

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewcvs/ant/core/trunk/WHATSNEW?rev=398170&r1=398169&r2=398170&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Sat Apr 29 07:56:34 2006
@@ -211,6 +211,9 @@
   standardized improperly included objselect and objsel property accessors to
   delegate to the inherited objSelect property accessor. Bugzilla report 37766.
 
+* <unzip> and <untar< now correctly merge multiple nested patternsets.
+  Bugzilla Report 38973.
+
 Other changes:
 --------------
 * took in bugzilla report 39320.

Modified: ant/core/trunk/src/etc/testcases/taskdefs/unzip.xml
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/etc/testcases/taskdefs/unzip.xml?rev=398170&r1=398169&r2=398170&view=diff
==============================================================================
--- ant/core/trunk/src/etc/testcases/taskdefs/unzip.xml (original)
+++ ant/core/trunk/src/etc/testcases/taskdefs/unzip.xml Sat Apr 29 07:56:34 2006
@@ -87,6 +87,7 @@
         <include name="2/**"/>
       </patternset>
       <patternset>
+        <exclude name="1/**"/>
         <exclude name="2/**"/>
       </patternset>
     </unzip>

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Expand.java
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Expand.java?rev=398170&r1=398169&r2=398170&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Expand.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Expand.java Sat Apr 29 07:56:34 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright  2000-2005 The Apache Software Foundation
+ * Copyright  2000-2006 The Apache Software Foundation
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -24,7 +24,9 @@
 import java.io.InputStream;
 import java.util.Date;
 import java.util.Enumeration;
+import java.util.HashSet;
 import java.util.Iterator;
+import java.util.Set;
 import java.util.Vector;
 
 import org.apache.tools.ant.BuildException;
@@ -195,6 +197,8 @@
             String name = entryName.replace('/', File.separatorChar)
                 .replace('\\', File.separatorChar);
             boolean included = false;
+            Set includePatterns = new HashSet();
+            Set excludePatterns = new HashSet();
             for (int v = 0, size = patternsets.size(); v < size; v++) {
                 PatternSet p = (PatternSet) patternsets.elementAt(v);
                 String[] incls = p.getIncludePatterns(getProject());
@@ -209,18 +213,9 @@
                     if (pattern.endsWith(File.separator)) {
                         pattern += "**";
                     }
-
-                    included = SelectorUtils.matchPath(pattern, name);
-                    if (included) {
-                        break;
-                    }
-                }
-
-                if (!included) {
-                    break;
+                    includePatterns.add(pattern);
                 }
 
-
                 String[] excls = p.getExcludePatterns(getProject());
                 if (excls != null) {
                     for (int w = 0; w < excls.length; w++) {
@@ -230,13 +225,23 @@
                         if (pattern.endsWith(File.separator)) {
                             pattern += "**";
                         }
-                        included = !(SelectorUtils.matchPath(pattern, name));
-                        if (!included) {
-                            break;
-                        }
+                        excludePatterns.add(pattern);
                     }
                 }
             }
+
+            for (Iterator iter = includePatterns.iterator();
+                 !included && iter.hasNext();) {
+                String pattern = (String) iter.next();
+                included = SelectorUtils.matchPath(pattern, name);
+            }
+
+            for (Iterator iter = excludePatterns.iterator();
+                 included && iter.hasNext();) {
+                String pattern = (String) iter.next();
+                included = !SelectorUtils.matchPath(pattern, name);
+            }
+
             if (!included) {
                 //Do not process this file
                 return;



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