Browse Source

Remove special processing for init.

Tested with the latest versions of:
  jakarta-ant
  jakarta-tomcat
  jakarta-tools
  jakarta-watchdog
  xml-xerces
  xml-xalan
  xml-cocoon


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@267623 13f79535-47bb-0310-9956-ffa450edef68
master
Sam Ruby 25 years ago
parent
commit
30d8dc80a5
1 changed files with 11 additions and 47 deletions
  1. +11
    -47
      src/main/org/apache/tools/ant/ProjectHelper.java

+ 11
- 47
src/main/org/apache/tools/ant/ProjectHelper.java View File

@@ -124,36 +124,9 @@ public class ProjectHelper {
// configureTaskDefs(project, root);

// set up the targets into the project
init(project, root );
configureTargets(project, root);
}

/** Read and execute init - all other targets will be loaded after ( to
* make sure all properties are set ).
*
*/
private static void init(Project project, Element root)
throws BuildException
{
// Hack - all tasks outside init target will be added to init
// ( will be removed when / if build.xml will start using init )
Target initTarget = new Target();
initTarget.setProject(project);
initTarget.setName( "init" );
project.addTarget( "init", initTarget );
configureTasks( project, initTarget, root );

NodeList list = root.getElementsByTagName("target");
for (int i = 0; i < list.getLength(); i++) {
Element element = (Element)list.item(i);
String targetName = element.getAttribute("name");

if( targetName.equals("init") )
configureTasks(project, initTarget, element);
}
initTarget.execute();
}

private static void configureTargets(Project project, Element root)
throws BuildException
{
@@ -171,10 +144,6 @@ public class ProjectHelper {
throw new BuildException(msg);
}

// init is done already
if( targetName.equals("init") )
continue;

Target target = new Target();
target.setName(targetName);
target.setCondition(targetCond);
@@ -212,26 +181,21 @@ public class ProjectHelper {
Element element = (Element)node;
String taskType = element.getTagName();

// special case - no target in a target.
// hack to allow this method to set "init" target
// using root element
if( ! taskType.equals( "target" ) ) {
// XXX
// put in some sanity checking
// XXX
// put in some sanity checking

Task task = project.createTask(taskType);
Task task = project.createTask(taskType);

// get the attributes of this element and reflect them
// into the task
// get the attributes of this element and reflect them
// into the task

NamedNodeMap nodeMap = element.getAttributes();
configure(project, task, nodeMap);
task.init();
task.setTarget(target);
target.addTask(task);
NamedNodeMap nodeMap = element.getAttributes();
configure(project, task, nodeMap);
task.init();
task.setTarget(target);
target.addTask(task);

processNestedProperties(project, task, element);
}
processNestedProperties(project, task, element);
}
}
}


Loading…
Cancel
Save