ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/helper ProjectHelper2.java
Date Fri, 27 Dec 2002 18:14:50 GMT
costin      2002/12/27 10:14:50

  Modified:    src/main/org/apache/tools/ant/helper ProjectHelper2.java
  Log:
  Update with the 2 changes: set attributes explicitely ( instead of passing
  the SAX2 Attributes).
  - import will use the normal entry point and will not depend on the sax
  context. We know we are in an import by looking at the importStack,
  that will set ignoreProjectTag flag and we'll reuse the context.
  There are few more changes needed to clean up the context ( some fields
  are no longer needed, and it needs to use proper getter/setters instead
  of the fields ).
  
  Revision  Changes    Path
  1.6       +25 -9     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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ProjectHelper2.java	25 Dec 2002 17:56:22 -0000	1.5
  +++ ProjectHelper2.java	27 Dec 2002 18:14:50 -0000	1.6
  @@ -99,15 +99,27 @@
       public void parse(Project project, Object source)
               throws BuildException
       {
  -        AntXmlContext context=new AntXmlContext(project, this);
  -        
  -        project.addReference( "ant.parsing.context", context );
  -        project.addReference( "ant.targets", context.targetVector );
  -
  -        parse(project, source,new RootHandler(context));
  +        this.getImportStack().addElement(source);
  +        AntXmlContext context=null;
  +        context=(AntXmlContext)project.getReference("ant.parsing.context");
  +//        System.out.println("Parsing " + getImportStack().size() + " " +
  +//                context+ " " + getImportStack() );
  +        if( context==null ) {
  +            context=new AntXmlContext(project, this);
  +            project.addReference( "ant.parsing.context", context );
  +            project.addReference( "ant.targets", context.targetVector );
  +        }
   
  -        // Execute the top-level target
  -        context.implicitTarget.execute();
  +        if( this.getImportStack().size() > 1 ) {
  +            // we are in an imported file.
  +            context.ignoreProjectTag=true;
  +            parse(project, source, new RootHandler(context));
  +        } else {
  +            // top level file
  +            parse(project, source,new RootHandler(context));
  +            // Execute the top-level target
  +            context.implicitTarget.execute();
  +        }
       }
   
       /**
  @@ -858,7 +870,11 @@
               // This is a nop in UE: task.init();
   
               wrapper=new RuntimeConfigurable( task, task.getTaskName());
  -            wrapper.setAttributes2(attrs);
  +
  +            for (int i = 0; i < attrs.getLength(); i++) {
  +                wrapper.setAttribute( attrs.getQName(i),
  +                        attrs.getValue(i));
  +            }
   
               if (parentWrapper != null) {
                   parentWrapper.addChild(wrapper);
  
  
  

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


Mime
View raw message