/**
  * @override \ComponentManager\Step\Step
  *
  * @param \ComponentManager\Task\InstallTask $task
  */
 public function execute($task, LoggerInterface $logger)
 {
     $componentSpecifications = $this->project->getProjectFile()->getComponentSpecifications();
     foreach ($componentSpecifications as $componentSpecification) {
         $packageRepository = $this->project->getPackageRepository($componentSpecification->getPackageRepository());
         $logger->info('Resolving component version', ['component' => $componentSpecification->getName(), 'packageRepository' => $componentSpecification->getPackageRepository(), 'version' => $componentSpecification->getVersion()]);
         $componentName = $componentSpecification->getName();
         $componentVersion = $componentSpecification->getVersion();
         $packageRepositoryName = $componentSpecification->getPackageRepository();
         if (!($component = $packageRepository->getComponent($componentSpecification))) {
             throw new InvalidProjectException("The component \"{$componentName}\" could not be found within repository \"{$packageRepositoryName}\"", InvalidProjectException::CODE_MISSING_COMPONENT);
         }
         /* Note that even at this late stage, we still might not have a final
          * version for the component:
          * -> If the package repository provides us with the Moodle
          *    $plugin->version value, we'll be using it here.
          * -> If the package repository is a version control system, the version
          *    will contain the name of a branch or tag and will need to be
          *    resolved to an individual commit. */
         $version = $component->getVersion($componentVersion);
         $task->addResolvedComponentVersion(new ResolvedComponentVersion($componentSpecification, $packageRepository, $component, $version));
     }
 }
 /**
  * Initialiser.
  *
  * @param \ComponentManager\MoodleApi              $moodleApi
  * @param \ComponentManager\Project\Project        $project
  * @param string                                   $moodleArchive
  * @param string                                   $moodleDestination
  * @param \Symfony\Component\Filesystem\Filesystem $filesystem
  * @param \ComponentManager\Moodle                 $moodle
  * @param string                                   $packageFormat
  * @param string                                   $packageDestination
  */
 public function __construct(MoodleApi $moodleApi, Project $project, $moodleArchive, $moodleDestination, Platform $platform, Filesystem $filesystem, Moodle $moodle, $packageFormat, $packageDestination)
 {
     /* Because we're reordering the installation steps, we don't want to
      * call InstallTask's constructor. */
     AbstractTask::__construct();
     $this->resolvedComponentVersions = [];
     $this->addStep(new VerifyPackageRepositoriesCachedStep($project->getPackageRepositories()));
     $this->addStep(new ResolveMoodleVersionStep($moodleApi, $project->getProjectFile()->getMoodleVersion()));
     $this->addStep(new ResolveComponentVersionsStep($project));
     $this->addStep(new ObtainMoodleSourceStep($moodleArchive, dirname($moodleDestination)));
     $this->addStep(new InstallComponentsStep($project, $moodle, $platform, $filesystem));
     $this->addStep(new BuildComponentsStep($moodle, $platform, $filesystem));
     $this->addStep(new CommitProjectLockFileStep($project->getProjectLockFile()));
     $this->addStep(new PackageStep($project, $moodleDestination, $packageFormat, $packageDestination));
     $this->addStep(new RemoveTempDirectoriesStep($platform));
 }
 /**
  * @override \ComponentManager\Step\Step
  */
 public function execute($task, LoggerInterface $logger)
 {
     $packageFormat = $this->project->getPackageFormat($this->format);
     $packageFormat->package($this->source, $this->destination, $this->project->getProjectFile(), $this->project->getProjectLockFile(), $logger);
 }