diff options
Diffstat (limited to 'buildscripts/phing/classes/phing/parser/TaskHandler.php')
-rwxr-xr-x[-rw-r--r--] | buildscripts/phing/classes/phing/parser/TaskHandler.php | 81 |
1 files changed, 43 insertions, 38 deletions
diff --git a/buildscripts/phing/classes/phing/parser/TaskHandler.php b/buildscripts/phing/classes/phing/parser/TaskHandler.php index 976aebf2..53e07a56 100644..100755 --- a/buildscripts/phing/classes/phing/parser/TaskHandler.php +++ b/buildscripts/phing/classes/phing/parser/TaskHandler.php @@ -1,6 +1,6 @@ <?php /* - * $Id: TaskHandler.php,v 1.10 2005/10/04 19:13:44 hlellelid Exp $ + * $Id: 3b31bb3e2c1ae122411833c67617e7cebf6967b8 $ * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT @@ -28,9 +28,9 @@ include_once 'phing/UnknownElement.php'; * nested tags (datatypes and tasks) that may be unknown off bat and are * initialized on the fly. * - * @author Andreas Aderhold <andi@binarycloud.com> - * @copyright © 2001,2002 THYRELL. All rights reserved - * @version $Revision: 1.10 $ + * @author Andreas Aderhold <andi@binarycloud.com> + * @copyright 2001,2002 THYRELL. All rights reserved + * @version $Id: 3b31bb3e2c1ae122411833c67617e7cebf6967b8 $ * @package phing.parser */ class TaskHandler extends AbstractHandler { @@ -55,20 +55,20 @@ class TaskHandler extends AbstractHandler { * @var Task */ private $task; - - /** - * Wrapper for the parent element, if any. The wrapper for this - * element will be added to this wrapper as a child. - * @var RuntimeConfigurable - */ - private $parentWrapper; - - /** - * Wrapper for this element which takes care of actually configuring - * the element, if this element is contained within a target. - * Otherwise the configuration is performed with the configure method. - * @see ProjectHelper::configure(Object,AttributeList,Project) - */ + + /** + * Wrapper for the parent element, if any. The wrapper for this + * element will be added to this wrapper as a child. + * @var RuntimeConfigurable + */ + private $parentWrapper; + + /** + * Wrapper for this element which takes care of actually configuring + * the element, if this element is contained within a target. + * Otherwise the configuration is performed with the configure method. + * @see ProjectHelper::configure(Object,AttributeList,Project) + */ private $wrapper; /** @@ -84,7 +84,7 @@ class TaskHandler extends AbstractHandler { * @param object $parentHandler The parent handler that invoked this handler * @param ProjectConfigurator $configurator * @param TaskContainer $container The container object this task is contained in (null for top-level tasks). - * @param RuntimeConfigurable $parentWrapper Wrapper for the parent element, if any. + * @param RuntimeConfigurable $parentWrapper Wrapper for the parent element, if any. * @param Target $target The target object this task is contained in (null for top-level tasks). */ function __construct(AbstractSAXParser $parser, $parentHandler, ProjectConfigurator $configurator, $container = null, $parentWrapper = null, $target = null) { @@ -94,16 +94,16 @@ class TaskHandler extends AbstractHandler { if (($container !== null) && !($container instanceof TaskContainer)) { throw new Exception("Argument expected to be a TaskContainer, got something else"); } - if (($parentWrapper !== null) && !($parentWrapper instanceof RuntimeConfigurable)) { + if (($parentWrapper !== null) && !($parentWrapper instanceof RuntimeConfigurable)) { throw new Exception("Argument expected to be a RuntimeConfigurable, got something else."); } if (($target !== null) && !($target instanceof Target)) { throw new Exception("Argument expected to be a Target, got something else"); } - $this->configurator = $configurator; + $this->configurator = $configurator; $this->container = $container; - $this->parentWrapper = $parentWrapper; + $this->parentWrapper = $parentWrapper; $this->target = $target; } @@ -149,25 +149,30 @@ class TaskHandler extends AbstractHandler { // add file position information to the task (from parser) // should be used in task exceptions to provide details $this->task->setLocation($this->parser->getLocation()); - $configurator->configureId($task, $attrs); - - if ($this->container) { - $this->container->addTask($this->task); - } - + $configurator->configureId($this->task, $attrs); + + if ($this->container) { + $this->container->addTask($this->task); + } + // Top level tasks don't have associated targets - // FIXME: if we do like Ant 1.6 and create an implicitTarget in the projectconfigurator object - // then we don't need to check for null here ... but there's a lot of stuff that will break if we - // do that at this point. + // FIXME: if we do like Ant 1.6 and create an implicitTarget in the projectconfigurator object + // then we don't need to check for null here ... but there's a lot of stuff that will break if we + // do that at this point. if ($this->target !== null) { $this->task->setOwningTarget($this->target); $this->task->init(); $this->wrapper = $this->task->getRuntimeConfigurableWrapper(); $this->wrapper->setAttributes($attrs); - if ($this->parentWrapper !== null) { // this may not make sense only within this if-block, but it - // seems to address current use cases adequately - $this->parentWrapper->addChild($this->wrapper); - } + /* + Commenting this out as per thread on Premature configurate of ReuntimeConfigurables + with Matthias Pigulla: http://phing.tigris.org/servlets/ReadMsg?list=dev&msgNo=251 + + if ($this->parentWrapper !== null) { // this may not make sense only within this if-block, but it + // seems to address current use cases adequately + $this->parentWrapper->addChild($this->wrapper); + } + */ } else { $this->task->init(); $configurator->configure($this->task, $attrs, $project); @@ -178,11 +183,11 @@ class TaskHandler extends AbstractHandler { * Executes the task at once if it's directly beneath the <project> tag. */ protected function finished() { - if ($this->task !== null && $this->target === null) { + if ($this->task !== null && $this->target === null && $this->container === null) { try { - $this->task->main(); + $this->task->perform(); } catch (Exception $e) { - $this->task->log($e->getMessage(), PROJECT_MSG_ERR); + $this->task->log($e->getMessage(), Project::MSG_ERR); throw $e; } } |