ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject svn commit: r468781 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/types/AbstractFileSet.java src/main/org/apache/tools/ant/types/PatternSet.java src/tests/antunit/types/fileset-test.xml
Date Sat, 28 Oct 2006 22:54:49 GMT
Author: antoine
Date: Sat Oct 28 15:54:48 2006
New Revision: 468781

URL: http://svn.apache.org/viewvc?view=rev&rev=468781
Log:
fix for Bugzilla 40722. Was identified as a directory scanning problem.

Added:
    ant/core/trunk/src/tests/antunit/types/fileset-test.xml
Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/src/main/org/apache/tools/ant/types/AbstractFileSet.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/PatternSet.java

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?view=diff&rev=468781&r1=468780&r2=468781
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Sat Oct 28 15:54:48 2006
@@ -13,6 +13,9 @@
 * <delete> doesnt delete when defaultexcludes="false" and no includes is set 
   fixed. Bugzilla 40313.
 
+* behavior change of DirectoryScanner/AbstractFileset when conditional include
+  patterns are used. Bugzilla 40722.
+
 Other changes:
 --------------
 

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/AbstractFileSet.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/AbstractFileSet.java?view=diff&rev=468781&r1=468780&r2=468781
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/AbstractFileSet.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/AbstractFileSet.java Sat Oct 28 15:54:48
2006
@@ -459,12 +459,16 @@
         }
         ds.setBasedir(dir);
 
-        PatternSet ps = mergePatterns(p);
+        final int count = additionalPatterns.size();
+        for (int i = 0; i < count; i++) {
+            Object o = additionalPatterns.elementAt(i);
+            defaultPatterns.append((PatternSet) o, p);
+        }
         p.log(getDataTypeName() + ": Setup scanner in dir " + dir
-            + " with " + ps, Project.MSG_DEBUG);
+            + " with " + defaultPatterns, Project.MSG_DEBUG);
 
-        ds.setIncludes(ps.getIncludePatterns(p));
-        ds.setExcludes(ps.getExcludePatterns(p));
+        ds.setIncludes(defaultPatterns.getIncludePatterns(p));
+        ds.setExcludes(defaultPatterns.getExcludePatterns(p));
         if (ds instanceof SelectorScanner) {
             SelectorScanner ss = (SelectorScanner) ds;
             ss.setSelectors(getSelectors(p));

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/PatternSet.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/PatternSet.java?view=diff&rev=468781&r1=468780&r2=468781
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/PatternSet.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/PatternSet.java Sat Oct 28 15:54:48
2006
@@ -117,11 +117,12 @@
          * @return a printable form of this object.
          */
         public String toString() {
+            StringBuffer buf = new StringBuffer();
             if (name == null) {
-                throw new BuildException(
-                    "Missing attribute \"name\" for a pattern");
+                buf.append("noname");
+            } else {
+                buf.append(name);
             }
-            StringBuffer buf = new StringBuffer(name);
             if ((ifCond != null) || (unlessCond != null)) {
                 buf.append(":");
                 String connector = "";

Added: ant/core/trunk/src/tests/antunit/types/fileset-test.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/types/fileset-test.xml?view=auto&rev=468781
==============================================================================
--- ant/core/trunk/src/tests/antunit/types/fileset-test.xml (added)
+++ ant/core/trunk/src/tests/antunit/types/fileset-test.xml Sat Oct 28 15:54:48 2006
@@ -0,0 +1,32 @@
+<project xmlns:au="antlib:org.apache.ant.antunit" default="all">
+
+  <target name="test-fileset-with-if">
+    <fileset id="this.xml" dir=".">
+      <include if="trigger.include" name="fileset-test.xml"/>
+    </fileset>
+    <pathconvert refid="this.xml" property="this.xml.prop" pathsep="${line.separator}"
setonempty="false"/>
+    <au:assertTrue message="fileset this.xml should not contain anything but contains
${this.xml.prop}">
+        <not>
+          <isset property="this.xml.prop"/>
+        </not>
+    </au:assertTrue>
+  </target>
+
+  <target name="test-fileset-with-if-property-set">
+    <property name="trigger.include" value="true"/>
+    <fileset id="this.xml" dir=".">
+      <include if="trigger.include" name="fileset-test.xml"/>
+    </fileset>
+    <pathconvert refid="this.xml" property="this.xml.prop" pathsep="${line.separator}"
setonempty="false"/>
+    <au:assertPropertySet name="this.xml.prop" message="fileset should contain one file"/>
+    <echo>${this.xml.prop}</echo>
+    <au:assertLogContains text="fileset-test.xml"/>
+  </target>
+
+  <target name="all">
+    <au:antunit>
+      <fileset dir="${basedir}" includes="fileset-test.xml"/>
+      <au:plainlistener/>
+    </au:antunit>
+  </target>
+</project>



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


Mime
View raw message