You are here

class DrupalPinnedDevDependenciesBuilder in Drupal 10

Same name and namespace in other branches
  1. 8 composer/Generator/Builder/DrupalPinnedDevDependenciesBuilder.php \Drupal\Composer\Generator\Builder\DrupalPinnedDevDependenciesBuilder
  2. 9 composer/Generator/Builder/DrupalPinnedDevDependenciesBuilder.php \Drupal\Composer\Generator\Builder\DrupalPinnedDevDependenciesBuilder

Builder to produce metapackage for drupal/core-dev-pinned.

Hierarchy

Expanded class hierarchy of DrupalPinnedDevDependenciesBuilder

3 files declare their use of DrupalPinnedDevDependenciesBuilder
BuilderTest.php in core/tests/Drupal/Tests/Composer/Generator/BuilderTest.php
MetapackageUpdateTest.php in core/tests/Drupal/Tests/Composer/Generator/MetapackageUpdateTest.php
PackageGenerator.php in composer/Generator/PackageGenerator.php

File

composer/Generator/Builder/DrupalPinnedDevDependenciesBuilder.php, line 10

Namespace

Drupal\Composer\Generator\Builder
View source
class DrupalPinnedDevDependenciesBuilder extends DrupalPackageBuilder {

  /**
   * {@inheritdoc}
   */
  public function getPath() {
    return 'PinnedDevDependencies';
  }

  /**
   * {@inheritdoc}
   */
  public function getPackage() {
    $composer = $this
      ->initialPackageMetadata();

    // Pull the exact versions of the dependencies from the composer.lock
    // file and use it to build our 'require' section.
    $composerLockData = $this->drupalCoreInfo
      ->composerLock();
    if (isset($composerLockData['packages-dev'])) {
      foreach ($composerLockData['packages-dev'] as $package) {
        $composer['require'][$package['name']] = $package['version'];
      }
    }
    return $composer;
  }

  /**
   * Returns the initial package metadata that describes the metapackage.
   *
   * @return array
   */
  protected function initialPackageMetadata() {
    return [
      "name" => "drupal/core-dev-pinned",
      "type" => "metapackage",
      "description" => "Pinned require-dev dependencies from drupal/drupal; use in addition to drupal/core-recommended to run tests from drupal/core.",
      "license" => "GPL-2.0-or-later",
      "conflict" => [
        "webflo/drupal-core-require-dev" => "*",
      ],
      "require" => [
        "drupal/core" => Composer::drupalVersionBranch(),
      ],
    ];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DrupalPackageBuilder::$drupalCoreInfo protected property Information about composer.json, composer.lock etc. in current release.
DrupalPackageBuilder::__construct public function DrupalPackageBuilder constructor. Overrides BuilderInterface::__construct
DrupalPinnedDevDependenciesBuilder::getPackage public function Generate the Composer.json data for the current tag or branch. Overrides BuilderInterface::getPackage
DrupalPinnedDevDependenciesBuilder::getPath public function Return the path to where the metapackage should be written. Overrides BuilderInterface::getPath
DrupalPinnedDevDependenciesBuilder::initialPackageMetadata protected function Returns the initial package metadata that describes the metapackage.