Changeset View
Changeset View
Standalone View
Standalone View
src/applications/harbormaster/step/BuildStepImplementation.php
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | abstract class BuildStepImplementation { | ||||
/** | /** | ||||
* Gets the settings for this build step. | * Gets the settings for this build step. | ||||
*/ | */ | ||||
public function getSettings() { | public function getSettings() { | ||||
return $this->settings; | return $this->settings; | ||||
} | } | ||||
public function getSetting($key, $default = null) { | |||||
return idx($this->settings, $key, $default); | |||||
} | |||||
/** | /** | ||||
* Validate the current settings of this build step. | * Validate the current settings of this build step. | ||||
*/ | */ | ||||
public function validateSettings() { | public function validateSettings() { | ||||
return true; | return true; | ||||
} | } | ||||
/** | /** | ||||
Show All 37 Lines | abstract class BuildStepImplementation { | ||||
* return array( | * return array( | ||||
* 'some_name_input_by_user' => 'host'); | * 'some_name_input_by_user' => 'host'); | ||||
* | * | ||||
* Future steps will calculate all available artifact mappings | * Future steps will calculate all available artifact mappings | ||||
* before them and filter on the type. | * before them and filter on the type. | ||||
* | * | ||||
* @return array The mappings of artifact names to their types. | * @return array The mappings of artifact names to their types. | ||||
*/ | */ | ||||
public function getArtifactMappings() { | public function getArtifactInputs() { | ||||
return array(); | |||||
} | |||||
public function getArtifactOutputs() { | |||||
return array(); | return array(); | ||||
} | } | ||||
/** | /** | ||||
* Returns a list of all artifacts made available by previous build steps. | * Returns a list of all artifacts made available by previous build steps. | ||||
*/ | */ | ||||
public static function loadAvailableArtifacts( | public static function loadAvailableArtifacts( | ||||
HarbormasterBuildPlan $build_plan, | HarbormasterBuildPlan $build_plan, | ||||
Show All 21 Lines | public static function getAvailableArtifacts( | ||||
$previous_implementations = array(); | $previous_implementations = array(); | ||||
foreach ($build_steps as $build_step) { | foreach ($build_steps as $build_step) { | ||||
if ($build_step->getPHID() === $current_build_step->getPHID()) { | if ($build_step->getPHID() === $current_build_step->getPHID()) { | ||||
break; | break; | ||||
} | } | ||||
$previous_implementations[] = $build_step->getStepImplementation(); | $previous_implementations[] = $build_step->getStepImplementation(); | ||||
} | } | ||||
$artifact_arrays = mpull($previous_implementations, 'getArtifactMappings'); | $artifact_arrays = mpull($previous_implementations, 'getArtifactOutputs'); | ||||
$artifacts = array(); | $artifacts = array(); | ||||
foreach ($artifact_arrays as $array) { | foreach ($artifact_arrays as $array) { | ||||
$array = ipull($array, 'type', 'key'); | |||||
foreach ($array as $name => $type) { | foreach ($array as $name => $type) { | ||||
if ($type !== $artifact_type && $artifact_type !== null) { | if ($type !== $artifact_type && $artifact_type !== null) { | ||||
continue; | continue; | ||||
} | } | ||||
$artifacts[$name] = $type; | $artifacts[$name] = $type; | ||||
} | } | ||||
} | } | ||||
return $artifacts; | return $artifacts; | ||||
Show All 37 Lines |