コード例 #1
0
 /**
  *  Create a named task and configure it up to the init() stage.
  *
  * @param  UnknownElement $ue The unknwon element to create a task from
  * @param  RuntimeConfigurable $w The wrapper object
  * @param  boolean $onTopLevel Whether to treat this task as if it is top-level.
  * @throws BuildException
  * @return Task                The freshly created task
  */
 protected function makeTask(UnknownElement $ue, RuntimeConfigurable $w, $onTopLevel = false)
 {
     $task = $this->project->createTask($ue->getTag());
     if ($task === null) {
         if (!$onTopLevel) {
             throw new BuildException("Could not create task of type: '" . $this->elementName . "'. Make sure that this class has been declared using taskdef.");
         }
         return null;
     }
     // used to set the location within the xmlfile so that exceptions can
     // give detailed messages
     $task->setLocation($this->getLocation());
     $attrs = $w->getAttributes();
     if (isset($attrs['id'])) {
         $this->project->addReference($attrs['id'], $task);
     }
     if ($this->target !== null) {
         $task->setOwningTarget($this->target);
     }
     $task->init();
     return $task;
 }
コード例 #2
0
 /**
  * @param IntrospectionHelper $ih
  * @param                     $parent
  * @param UnknownElement      $child
  * @param RuntimeConfigurable $childWrapper
  *
  * @return bool
  */
 public function handleChild(IntrospectionHelper $ih, $parent, UnknownElement $child, RuntimeConfigurable $childWrapper)
 {
     $childWrapper->setProxy($realChild);
     if ($realChild instanceof Task) {
         $realChild->setRuntimeConfigurableWrapper($childWrapper);
     }
     $childWrapper->maybeConfigure($this->project);
     $child->handleChildren($realChild, $childWrapper);
     return true;
 }