Changeset 55

Show
Ignore:
Timestamp:
04/20/06 15:16:59 (3 years ago)
Author:
mrook
Message:

Apply patch to detect and act on failing builds (Matthias Pigulla)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/classes/phing/tasks/system/PhingTask.php

    r43 r55  
    7474    private $newProject; 
    7575 
     76    /** Fail the build process when the called build fails? */ 
     77    private $haltOnFailure = false; 
     78 
     79    /** 
     80     *  If true, abort the build process if there is a problem with or in the target build file. 
     81     *  Defaults to false. 
     82     * 
     83     *  @param boolean new value 
     84     */ 
     85    public function setHaltOnFailure($hof) { 
     86        $this->haltOnFailure = (boolean) $hof; 
     87    } 
     88 
    7689    /** 
    7790     * Creates a Project instance for the project to call. 
     
    147160        $savedPhingFile = $this->phingFile; 
    148161        $savedTarget = $this->newTarget; 
     162        $buildFailed = false; 
    149163 
    150164        // set no specific target for files in filesets 
     
    241255             
    242256        } catch (Exception $e) { 
     257            $buildFailed = true; 
    243258            $this->log($e->getMessage(), PROJECT_MSG_ERR); 
    244259             
     
    263278            chdir($this->dir->getAbsolutePath()); 
    264279        } 
     280 
     281        if ($this->haltOnFailure == true && $buildFailed == true) 
     282            throw new BuildException("Execution of the target buildfile failed. Aborting."); 
    265283    } 
    266284