Differential D7892 Diff 17872 src/applications/harbormaster/storage/build/HarbormasterBuildTarget.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/harbormaster/storage/build/HarbormasterBuildTarget.php
| <?php | <?php | ||||
| final class HarbormasterBuildTarget extends HarbormasterDAO | final class HarbormasterBuildTarget extends HarbormasterDAO | ||||
| implements PhabricatorPolicyInterface { | implements PhabricatorPolicyInterface { | ||||
| protected $buildPHID; | protected $buildPHID; | ||||
| protected $buildStepPHID; | protected $buildStepPHID; | ||||
| protected $className; | protected $className; | ||||
| protected $details; | protected $details; | ||||
| protected $variables; | protected $variables; | ||||
| protected $targetStatus; | |||||
| const STATUS_PENDING = 'target/pending'; | |||||
| const STATUS_PASSED = 'target/passed'; | |||||
| const STATUS_FAILED = 'target/failed'; | |||||
| private $build = self::ATTACHABLE; | private $build = self::ATTACHABLE; | ||||
| private $buildStep = self::ATTACHABLE; | private $buildStep = self::ATTACHABLE; | ||||
| public static function initializeNewBuildTarget( | public static function initializeNewBuildTarget( | ||||
| HarbormasterBuild $build, | HarbormasterBuild $build, | ||||
| HarbormasterBuildStep $build_step, | HarbormasterBuildStep $build_step, | ||||
| array $variables) { | array $variables) { | ||||
| return id(new HarbormasterBuildTarget()) | return id(new HarbormasterBuildTarget()) | ||||
| ->setBuildPHID($build->getPHID()) | ->setBuildPHID($build->getPHID()) | ||||
| ->setBuildStepPHID($build_step->getPHID()) | ->setBuildStepPHID($build_step->getPHID()) | ||||
| ->setClassName($build_step->getClassName()) | ->setClassName($build_step->getClassName()) | ||||
| ->setDetails($build_step->getDetails()) | ->setDetails($build_step->getDetails()) | ||||
| ->setTargetStatus(self::STATUS_PENDING) | |||||
| ->setVariables($variables); | ->setVariables($variables); | ||||
| } | } | ||||
| public function getConfiguration() { | public function getConfiguration() { | ||||
| return array( | return array( | ||||
| self::CONFIG_AUX_PHID => true, | self::CONFIG_AUX_PHID => true, | ||||
| self::CONFIG_SERIALIZATION => array( | self::CONFIG_SERIALIZATION => array( | ||||
| 'details' => self::SERIALIZATION_JSON, | 'details' => self::SERIALIZATION_JSON, | ||||
| ▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | if (!in_array($class, $implementations)) { | ||||
| "Class name '".$class."' does not extend BuildStepImplementation."); | "Class name '".$class."' does not extend BuildStepImplementation."); | ||||
| } | } | ||||
| $implementation = newv($class, array()); | $implementation = newv($class, array()); | ||||
| $implementation->loadSettings($this); | $implementation->loadSettings($this); | ||||
| return $implementation; | return $implementation; | ||||
| } | } | ||||
| /* -( Status )------------------------------------------------------------- */ | |||||
| public function isComplete() { | |||||
| switch ($this->getTargetStatus()) { | |||||
| case self::STATUS_PASSED: | |||||
| case self::STATUS_FAILED: | |||||
| return true; | |||||
| } | |||||
| return false; | |||||
| } | |||||
| public function isFailed() { | |||||
| switch ($this->getTargetStatus()) { | |||||
| case self::STATUS_FAILED: | |||||
| return true; | |||||
| } | |||||
| return false; | |||||
| } | |||||
| /* -( PhabricatorPolicyInterface )----------------------------------------- */ | /* -( PhabricatorPolicyInterface )----------------------------------------- */ | ||||
| public function getCapabilities() { | public function getCapabilities() { | ||||
| return array( | return array( | ||||
| PhabricatorPolicyCapability::CAN_VIEW, | PhabricatorPolicyCapability::CAN_VIEW, | ||||
| ); | ); | ||||
| } | } | ||||
| Show All 17 Lines | |||||