Browse Source

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
master
Costin Manolache 22 years ago
parent
commit
bcc858ea72
1 changed files with 10 additions and 1 deletions
  1. +10
    -1
      src/main/org/apache/tools/ant/helper/ProjectHelper2.java

+ 10
- 1
src/main/org/apache/tools/ant/helper/ProjectHelper2.java View File

@@ -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);


Loading…
Cancel
Save