You are here

class DrupalDevDependenciesBuilder in Drupal 10

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

Builder to produce metapackage for drupal/core-dev.

Hierarchy

Expanded class hierarchy of DrupalDevDependenciesBuilder

3 files declare their use of DrupalDevDependenciesBuilder
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/DrupalDevDependenciesBuilder.php, line 8

Namespace

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

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

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

    // Put everything from Drupal's "require-dev" into our "require" section.
    $composer['require'] = $this->drupalCoreInfo
      ->getRequireDev();

    // Sort our required packages by key.
    ksort($composer['require']);
    return $composer;
  }

  /**
   * Returns the initial package metadata that describes the metapackage.
   *
   * @return array
   */
  protected function initialPackageMetadata() {
    return [
      "name" => "drupal/core-dev",
      "type" => "metapackage",
      "description" => "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" => "*",
      ],
    ];
  }

}

Members

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