From bcc858ea72bf8719537798fd678fd3eaa4445a8e Mon Sep 17 00:00:00 2001 From: Costin Manolache Date: Fri, 13 Dec 2002 21:56:52 +0000 Subject: [PATCH] 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. PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273667 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/tools/ant/helper/ProjectHelper2.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/org/apache/tools/ant/helper/ProjectHelper2.java b/src/main/org/apache/tools/ant/helper/ProjectHelper2.java index ed42a48d3..2562addf6 100644 --- a/src/main/org/apache/tools/ant/helper/ProjectHelper2.java +++ b/src/main/org/apache/tools/ant/helper/ProjectHelper2.java @@ -101,6 +101,7 @@ public class ProjectHelper2 extends ProjectHelper { 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 @@ public class ProjectHelper2 extends ProjectHelper { /** 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 class ProjectHelper2 extends ProjectHelper { public AntXmlContext(Project project, ProjectHelper2 helper) { this.project=project; implicitTarget.setName(""); + targetVector.addElement( implicitTarget ); this.helper=helper; } @@ -679,6 +687,7 @@ public class ProjectHelper2 extends ProjectHelper { 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);