ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peterrei...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/helper ProjectHelper2.java
Date Wed, 17 Sep 2003 14:13:54 GMT
peterreilly    2003/09/17 07:13:54

  Modified:    src/main/org/apache/tools/ant Target.java
               src/main/org/apache/tools/ant/helper ProjectHelper2.java
  Log:
  change implementation of handling importing files top-level tasks
  to be less hachy
  
  Revision  Changes    Path
  1.45      +3 -29     ant/src/main/org/apache/tools/ant/Target.java
  
  Index: Target.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/Target.java,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- Target.java	4 Sep 2003 11:46:03 -0000	1.44
  +++ Target.java	17 Sep 2003 14:13:53 -0000	1.45
  @@ -80,15 +80,11 @@
       private List dependencies = null;
       /** Children of this target (tasks and data types). */
       private List children = new ArrayList();
  -    /** Position in task list */
  -    private int taskPosition = 0;
   
       /** Project this target belongs to. */
       private Project project;
  -    /** Description of this target, if any. */
  +
       private String description = null;
  -    /** Imported tasks/types being added */
  -    private List importedTasks = null;
   
       /** Sole constructor. */
       public Target() {
  @@ -171,34 +167,12 @@
       }
   
       /**
  -     * This method called when an import file is being processed.
  -     * The top-level tasks/types are placed in the importedTasks array.
  -     *
  -     */
  -    public void startImportedTasks() {
  -        importedTasks = new ArrayList();
  -    }
  -
  -    /**
        * Adds a task to this target.
        *
        * @param task The task to be added. Must not be <code>null</code>.
        */
       public void addTask(Task task) {
  -        if (importedTasks != null) {
  -            importedTasks.add(task);
  -        } else {
  -            children.add(task);
  -        }
  -    }
  -
  -    /**
  -     * This method called when an import file is being processed.
  -     * The top-level tasks/types are placed in the importedTasks array.
  -     *
  -     */
  -    public void endImportedTasks() {
  -        children.addAll(taskPosition + 1, importedTasks);
  +        children.add(task);
       }
   
       /**
  @@ -354,7 +328,7 @@
        */
       public void execute() throws BuildException {
           if (testIfCondition() && testUnlessCondition()) {
  -            for (taskPosition = 0;
  +            for (int taskPosition = 0;
                    taskPosition < children.size();
                    ++taskPosition) {
                   Object o = children.get(taskPosition);
  
  
  
  1.33      +10 -3     ant/src/main/org/apache/tools/ant/helper/ProjectHelper2.java
  
  Index: ProjectHelper2.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/helper/ProjectHelper2.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- ProjectHelper2.java	12 Sep 2003 20:56:46 -0000	1.32
  +++ ProjectHelper2.java	17 Sep 2003 14:13:53 -0000	1.33
  @@ -154,9 +154,16 @@
           if (getImportStack().size() > 1) {
               // we are in an imported file.
               context.setIgnoreProjectTag(true);
  -            context.getCurrentTarget().startImportedTasks();
  -            parse(project, source, new RootHandler(context, mainHandler));
  -            context.getCurrentTarget().endImportedTasks();
  +            Target currentTarget = context.getCurrentTarget();
  +            try {
  +                Target newCurrent = new Target();
  +                newCurrent.setName("");
  +                context.setCurrentTarget(newCurrent);
  +                parse(project, source, new RootHandler(context, mainHandler));
  +                newCurrent.execute();
  +            } finally {
  +                context.setCurrentTarget(currentTarget);
  +            }
           } else {
               // top level file
               parse(project, source, new RootHandler(context, mainHandler));
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message