From 30d8dc80a562b0c3c7db85f1fbf501dcf9ffa706 Mon Sep 17 00:00:00 2001 From: Sam Ruby Date: Mon, 28 Feb 2000 14:10:46 +0000 Subject: [PATCH] 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 --- .../org/apache/tools/ant/ProjectHelper.java | 58 ++++--------------- 1 file changed, 11 insertions(+), 47 deletions(-) diff --git a/src/main/org/apache/tools/ant/ProjectHelper.java b/src/main/org/apache/tools/ant/ProjectHelper.java index 4a36353ba..0e5abd864 100644 --- a/src/main/org/apache/tools/ant/ProjectHelper.java +++ b/src/main/org/apache/tools/ant/ProjectHelper.java @@ -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); } } }