diff --git a/src/applications/harbormaster/controller/HarbormasterBuildableViewController.php b/src/applications/harbormaster/controller/HarbormasterBuildableViewController.php --- a/src/applications/harbormaster/controller/HarbormasterBuildableViewController.php +++ b/src/applications/harbormaster/controller/HarbormasterBuildableViewController.php @@ -25,6 +25,8 @@ ->needBuildTargets(true) ->execute(); + list($lint, $unit) = $this->renderLintAndUnit($builds); + $buildable->attachBuilds($builds); $object = $buildable->getBuildableObject(); @@ -55,6 +57,8 @@ array( $crumbs, $box, + $lint, + $unit, $build_list, $timeline, ), @@ -251,4 +255,57 @@ return $box; } + private function renderLintAndUnit(array $builds) { + $viewer = $this->getViewer(); + + $targets = array(); + foreach ($builds as $build) { + foreach ($build->getBuildTargets() as $target) { + $targets[] = $target; + } + } + + if (!$targets) { + return; + } + + $target_phids = mpull($targets, 'getPHID'); + + $lint_data = id(new HarbormasterBuildLintMessage())->loadAllWhere( + 'buildTargetPHID IN (%Ls) LIMIT 25', + $target_phids); + + $unit_data = id(new HarbormasterBuildUnitMessage())->loadAllWhere( + 'buildTargetPHID IN (%Ls) LIMIT 25', + $target_phids); + + if ($lint_data) { + $lint_table = id(new HarbormasterLintPropertyView()) + ->setUser($viewer) + ->setLintMessages($lint_data); + + $lint = id(new PHUIObjectBoxView()) + ->setHeaderText(pht('Lint Messages')) + ->appendChild($lint_table); + } else { + $lint = null; + } + + if ($unit_data) { + $unit_table = id(new HarbormasterUnitPropertyView()) + ->setUser($viewer) + ->setUnitMessages($unit_data); + + $unit = id(new PHUIObjectBoxView()) + ->setHeaderText(pht('Unit Tests')) + ->appendChild($unit_table); + } else { + $unit = null; + } + + return array($lint, $unit); + } + + + } diff --git a/src/applications/harbormaster/view/HarbormasterLintPropertyView.php b/src/applications/harbormaster/view/HarbormasterLintPropertyView.php --- a/src/applications/harbormaster/view/HarbormasterLintPropertyView.php +++ b/src/applications/harbormaster/view/HarbormasterLintPropertyView.php @@ -2,7 +2,7 @@ final class HarbormasterLintPropertyView extends AphrontView { - private $pathURIMap; + private $pathURIMap = array(); private $lintMessages = array(); public function setPathURIMap(array $map) { diff --git a/src/applications/harbormaster/view/HarbormasterUnitPropertyView.php b/src/applications/harbormaster/view/HarbormasterUnitPropertyView.php --- a/src/applications/harbormaster/view/HarbormasterUnitPropertyView.php +++ b/src/applications/harbormaster/view/HarbormasterUnitPropertyView.php @@ -2,7 +2,7 @@ final class HarbormasterUnitPropertyView extends AphrontView { - private $pathURIMap; + private $pathURIMap = array(); private $unitMessages = array(); public function setPathURIMap(array $map) {