Changeset View
Changeset View
Standalone View
Standalone View
src/applications/harbormaster/storage/HarbormasterBuildable.php
<?php | <?php | ||||
final class HarbormasterBuildable extends HarbormasterDAO | final class HarbormasterBuildable extends HarbormasterDAO | ||||
implements | implements | ||||
PhabricatorApplicationTransactionInterface, | PhabricatorApplicationTransactionInterface, | ||||
PhabricatorPolicyInterface, | PhabricatorPolicyInterface, | ||||
HarbormasterBuildableInterface { | HarbormasterBuildableInterface { | ||||
protected $buildablePHID; | protected $buildablePHID; | ||||
protected $containerPHID; | protected $containerPHID; | ||||
protected $buildableStatus; | protected $buildableStatus; | ||||
protected $details; | |||||
protected $isManualBuildable; | protected $isManualBuildable; | ||||
private $buildableObject = self::ATTACHABLE; | private $buildableObject = self::ATTACHABLE; | ||||
private $containerObject = self::ATTACHABLE; | private $containerObject = self::ATTACHABLE; | ||||
private $builds = self::ATTACHABLE; | private $builds = self::ATTACHABLE; | ||||
const STATUS_BUILDING = 'building'; | const STATUS_BUILDING = 'building'; | ||||
const STATUS_PASSED = 'passed'; | const STATUS_PASSED = 'passed'; | ||||
const STATUS_FAILED = 'failed'; | const STATUS_FAILED = 'failed'; | ||||
const DETAIL_LINT_STATUS = 'lint:status'; | |||||
const DETAIL_UNIT_STATUS = 'unit:status'; | |||||
const DETAIL_UNIT_COUNTS = 'unit:counts'; | |||||
const DETAIL_COVERAGE_MAP = 'unit:coverage'; | |||||
public static function getBuildableStatusName($status) { | public static function getBuildableStatusName($status) { | ||||
$map = self::getBuildStatusMap(); | $map = self::getBuildStatusMap(); | ||||
return idx($map, $status, pht('Unknown ("%s")', $status)); | return idx($map, $status, pht('Unknown ("%s")', $status)); | ||||
} | } | ||||
public static function getBuildStatusMap() { | public static function getBuildStatusMap() { | ||||
return array( | return array( | ||||
self::STATUS_BUILDING => pht('Building'), | self::STATUS_BUILDING => pht('Building'), | ||||
▲ Show 20 Lines • Show All 162 Lines • ▼ Show 20 Lines | PhabricatorWorker::scheduleTask( | ||||
)); | )); | ||||
return $build; | return $build; | ||||
} | } | ||||
protected function getConfiguration() { | protected function getConfiguration() { | ||||
return array( | return array( | ||||
self::CONFIG_AUX_PHID => true, | self::CONFIG_AUX_PHID => true, | ||||
self::CONFIG_SERIALIZATION => array( | |||||
'details' => self::SERIALIZATION_JSON, | |||||
), | |||||
self::CONFIG_COLUMN_SCHEMA => array( | self::CONFIG_COLUMN_SCHEMA => array( | ||||
'containerPHID' => 'phid?', | 'containerPHID' => 'phid?', | ||||
'buildableStatus' => 'text32', | 'buildableStatus' => 'text32', | ||||
'isManualBuildable' => 'bool', | 'isManualBuildable' => 'bool', | ||||
), | ), | ||||
self::CONFIG_KEY_SCHEMA => array( | self::CONFIG_KEY_SCHEMA => array( | ||||
'key_buildable' => array( | 'key_buildable' => array( | ||||
'columns' => array('buildablePHID'), | 'columns' => array('buildablePHID'), | ||||
Show All 36 Lines | public function attachBuilds(array $builds) { | ||||
$this->builds = $builds; | $this->builds = $builds; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getBuilds() { | public function getBuilds() { | ||||
return $this->assertAttached($this->builds); | return $this->assertAttached($this->builds); | ||||
} | } | ||||
public function getDetail($key, $default = null) { | |||||
return idx($this->details, $key, $default); | |||||
} | |||||
public function setDetail($key, $value) { | |||||
$this->details[$key] = $value; | |||||
return $this; | |||||
} | |||||
/* -( PhabricatorApplicationTransactionInterface )------------------------- */ | /* -( PhabricatorApplicationTransactionInterface )------------------------- */ | ||||
public function getApplicationTransactionEditor() { | public function getApplicationTransactionEditor() { | ||||
return new HarbormasterBuildableTransactionEditor(); | return new HarbormasterBuildableTransactionEditor(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 70 Lines • Show Last 20 Lines |