You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by gl...@apache.org on 2001/07/23 05:56:12 UTC
cvs commit: jakarta-ant/src/main/org/apache/tools/ant/types PatternSet.java FileSet.java
glennm 01/07/22 20:56:12
Modified: src/main/org/apache/tools/ant RuntimeConfigurable.java
ProjectHelper.java
src/main/org/apache/tools/ant/types PatternSet.java
FileSet.java
Log:
Fix for id/refid data type bug. Delays adding the
id to the list of references till runtime when the
data type is inside a target. Without this change,
if multiple data types have the same id, only the
one that is last refered to in the file *and* is
configured at runtime (i.e. its target is executed)
will work properly. Otherwise, you will end up
using an unconfigured data type.
Revision Changes Path
1.7 +7 -0 jakarta-ant/src/main/org/apache/tools/ant/RuntimeConfigurable.java
Index: RuntimeConfigurable.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/RuntimeConfigurable.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- RuntimeConfigurable.java 2001/07/04 19:02:44 1.6
+++ RuntimeConfigurable.java 2001/07/23 03:56:12 1.7
@@ -130,8 +130,11 @@
* Configure the wrapped element and all children.
*/
public void maybeConfigure(Project p) throws BuildException {
+ String id = null;
+
if (attributes != null) {
ProjectHelper.configure(wrappedObject, attributes, p);
+ id = attributes.getValue("id");
attributes = null;
}
if (characters.length() != 0) {
@@ -142,6 +145,10 @@
while (enum.hasMoreElements()) {
RuntimeConfigurable child = (RuntimeConfigurable) enum.nextElement();
child.maybeConfigure(p);
+ }
+
+ if (id != null) {
+ p.addReference(id, wrappedObject);
}
}
1.56 +1 -1 jakarta-ant/src/main/org/apache/tools/ant/ProjectHelper.java
Index: ProjectHelper.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/ProjectHelper.java,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- ProjectHelper.java 2001/07/22 13:12:28 1.55
+++ ProjectHelper.java 2001/07/23 03:56:12 1.56
@@ -611,13 +611,13 @@
throw new BuildException("Unknown data type "+propType);
}
- configureId(element, attrs);
if (target != null) {
wrapper = new RuntimeConfigurable(element);
wrapper.setAttributes(attrs);
target.addDataType(wrapper);
} else {
configure(element, attrs, project);
+ configureId(element, attrs);
}
} catch (BuildException exc) {
throw new SAXParseException(exc.getMessage(), locator, exc);
1.7 +32 -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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- PatternSet.java 2001/05/23 16:58:17 1.6
+++ PatternSet.java 2001/07/23 03:56:12 1.7
@@ -121,6 +121,32 @@
}
return true;
}
+
+ public String toString()
+ {
+ StringBuffer buf = new StringBuffer();
+ buf.append( name );
+ if ((ifCond != null) || (unlessCond != null))
+ {
+ buf.append(":");
+ String connector = "";
+
+ if (ifCond != null)
+ {
+ buf.append("if->");
+ buf.append(ifCond);
+ connector = ";";
+ }
+ if (unlessCond != null)
+ {
+ buf.append(connector);
+ buf.append("unless->");
+ buf.append(unlessCond);
+ }
+ }
+
+ return buf.toString();
+ }
}
public PatternSet() {
@@ -375,6 +401,12 @@
readPatterns(excl, excludeList, p);
excl = null;
}
+ }
+
+ public String toString()
+ {
+ return "patternSet{ includes: " + includeList +
+ " excludes: " + excludeList + " }";
}
}
1.16 +3 -0 jakarta-ant/src/main/org/apache/tools/ant/types/FileSet.java
Index: FileSet.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/types/FileSet.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- FileSet.java 2001/03/14 12:48:32 1.15
+++ FileSet.java 2001/07/23 03:56:12 1.16
@@ -260,6 +260,9 @@
Object o = additionalPatterns.elementAt(i);
defaultPatterns.append((PatternSet) o, p);
}
+
+ p.log( "FileSet: Setup file scanner in dir " + dir +
+ " with " + defaultPatterns, p.MSG_DEBUG );
ds.setIncludes(defaultPatterns.getIncludePatterns(p));
ds.setExcludes(defaultPatterns.getExcludePatterns(p));