Browse Source

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 ).


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273705 13f79535-47bb-0310-9956-ffa450edef68
master
Costin Manolache 23 years ago
parent
commit
f15fb7639c
1 changed files with 26 additions and 10 deletions
  1. +26
    -10
      src/main/org/apache/tools/ant/helper/ProjectHelper2.java

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

@@ -99,15 +99,27 @@ public class ProjectHelper2 extends ProjectHelper {
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));

// Execute the top-level target
context.implicitTarget.execute();
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 );
}

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 @@ public class ProjectHelper2 extends ProjectHelper {
// 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);


Loading…
Cancel
Save