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. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269374 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -611,13 +611,13 @@ public class ProjectHelper { | |||||
| throw new BuildException("Unknown data type "+propType); | throw new BuildException("Unknown data type "+propType); | ||||
| } | } | ||||
| configureId(element, attrs); | |||||
| if (target != null) { | if (target != null) { | ||||
| wrapper = new RuntimeConfigurable(element); | wrapper = new RuntimeConfigurable(element); | ||||
| wrapper.setAttributes(attrs); | wrapper.setAttributes(attrs); | ||||
| target.addDataType(wrapper); | target.addDataType(wrapper); | ||||
| } else { | } else { | ||||
| configure(element, attrs, project); | configure(element, attrs, project); | ||||
| configureId(element, attrs); | |||||
| } | } | ||||
| } catch (BuildException exc) { | } catch (BuildException exc) { | ||||
| throw new SAXParseException(exc.getMessage(), locator, exc); | throw new SAXParseException(exc.getMessage(), locator, exc); | ||||
| @@ -130,8 +130,11 @@ public class RuntimeConfigurable { | |||||
| * Configure the wrapped element and all children. | * Configure the wrapped element and all children. | ||||
| */ | */ | ||||
| public void maybeConfigure(Project p) throws BuildException { | public void maybeConfigure(Project p) throws BuildException { | ||||
| String id = null; | |||||
| if (attributes != null) { | if (attributes != null) { | ||||
| ProjectHelper.configure(wrappedObject, attributes, p); | ProjectHelper.configure(wrappedObject, attributes, p); | ||||
| id = attributes.getValue("id"); | |||||
| attributes = null; | attributes = null; | ||||
| } | } | ||||
| if (characters.length() != 0) { | if (characters.length() != 0) { | ||||
| @@ -143,6 +146,10 @@ public class RuntimeConfigurable { | |||||
| RuntimeConfigurable child = (RuntimeConfigurable) enum.nextElement(); | RuntimeConfigurable child = (RuntimeConfigurable) enum.nextElement(); | ||||
| child.maybeConfigure(p); | child.maybeConfigure(p); | ||||
| } | } | ||||
| if (id != null) { | |||||
| p.addReference(id, wrappedObject); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -260,6 +260,9 @@ public class FileSet extends DataType { | |||||
| Object o = additionalPatterns.elementAt(i); | Object o = additionalPatterns.elementAt(i); | ||||
| defaultPatterns.append((PatternSet) o, p); | 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.setIncludes(defaultPatterns.getIncludePatterns(p)); | ||||
| ds.setExcludes(defaultPatterns.getExcludePatterns(p)); | ds.setExcludes(defaultPatterns.getExcludePatterns(p)); | ||||
| @@ -121,6 +121,32 @@ public class PatternSet extends DataType { | |||||
| } | } | ||||
| return true; | 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() { | public PatternSet() { | ||||
| @@ -377,4 +403,10 @@ public class PatternSet extends DataType { | |||||
| } | } | ||||
| } | } | ||||
| public String toString() | |||||
| { | |||||
| return "patternSet{ includes: " + includeList + | |||||
| " excludes: " + excludeList + " }"; | |||||
| } | |||||
| } | } | ||||