public function buildTargets()
 {
     $object = $this->getObject();
     $viewer = $this->getViewer();
     $step_map = $this->generateBuildStepMap($this->getAutoTargetKeys());
     $buildable = HarbormasterBuildable::createOrLoadExisting($viewer, $object->getHarbormasterBuildablePHID(), $object->getHarbormasterContainerPHID());
     $target_map = $this->generateBuildTargetMap($buildable, $step_map);
     return $target_map;
 }
 /**
  * Looks up the plan PHIDs and applies the plans to the specified
  * object identified by it's PHID.
  */
 public static function applyBuildPlans($phid, $container_phid, array $plan_phids)
 {
     if (count($plan_phids) === 0) {
         return;
     }
     // Skip all of this logic if the Harbormaster application
     // isn't currently installed.
     $harbormaster_app = 'PhabricatorHarbormasterApplication';
     if (!PhabricatorApplication::isClassInstalled($harbormaster_app)) {
         return;
     }
     $buildable = HarbormasterBuildable::createOrLoadExisting(PhabricatorUser::getOmnipotentUser(), $phid, $container_phid);
     $plans = id(new HarbormasterBuildPlanQuery())->setViewer(PhabricatorUser::getOmnipotentUser())->withPHIDs($plan_phids)->execute();
     foreach ($plans as $plan) {
         if ($plan->isDisabled()) {
             // TODO: This should be communicated more clearly -- maybe we should
             // create the build but set the status to "disabled" or "derelict".
             continue;
         }
         $buildable->applyPlan($plan);
     }
 }