Beispiel #1
0
 /**
  * @param Build $build
  * @param bool $success
  */
 protected function completeBuild(Build $build, $success)
 {
     // Loop each artifact generated by the build:
     foreach ($build->getArtifacts() as $artifact) {
         // Get the handler for the artifact:
         $artifactHandler = $this->system->getPluginManager()->getArtifactHandler($artifact->getHelper());
         // If we're an instance of BuildStatisticInterface, generate the relevant statistics:
         if ($artifactHandler && $artifactHandler instanceof BuildStatisticInterface) {
             $artifactHandler->parseArtifact($build, file_get_contents($artifact->getFile()));
             $artifactHandler->generateBuildStatistics($build);
         }
     }
     $build->setStatus($success ? Build::STATUS_SUCCESS : Build::STATUS_FAILURE);
     $this->buildRepository->flush();
     $this->system->getEventManager()->trigger('build.complete', $build);
     $this->system->getEventManager()->trigger('build.' . ($success ? 'success' : 'failure'), $build);
 }