costin 2002/12/13 13:56:52
Modified: src/main/org/apache/tools/ant/helper ProjectHelper2.java
Log:
Project stores the targets in a hashtable. There is no way to
retrieve the ordered list. This should eventually be included in
Project, but for now I added a small workaround in order to
support Description.
Revision Changes Path
1.2 +10 -1
jakarta-ant/src/main/org/apache/tools/ant/helper/ProjectHelper2.java
Index: ProjectHelper2.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/helper/ProjectHelper2.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ProjectHelper2.java 13 Dec 2002 00:46:51 -0000 1.1
+++ ProjectHelper2.java 13 Dec 2002 21:56:52 -0000 1.2
@@ -101,6 +101,7 @@
AntXmlContext context=new AntXmlContext(project, this);
project.addReference( "ant.parsing.context", context );
+ project.addReference( "ant.targets", context.targetVector );
parse(project, source,new RootHandler(context));
@@ -299,7 +300,13 @@
/** The configuration file to parse. */
public File buildFile;
- /**
+ /** Vector with all the targets, in the order they are
+ * defined. Project maintains a Hashtable, which is not ordered.
+ * This will allow description to know the original order.
+ */
+ public Vector targetVector=new Vector();
+
+ /**
* Parent directory of the build file. Used for resolving entities
* and setting the project's base directory.
*/
@@ -346,6 +353,7 @@
public AntXmlContext(Project project, ProjectHelper2 helper) {
this.project=project;
implicitTarget.setName("");
+ targetVector.addElement( implicitTarget );
this.helper=helper;
}
@@ -679,6 +687,7 @@
Project project=context.getProject();
Target target = new Target();
context.currentTarget=target;
+ context.targetVector.addElement( target );
for (int i = 0; i < attrs.getLength(); i++) {
String key = attrs.getQName(i);
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>