function PackageGenerator::generate

Same name in other branches
  1. 9 composer/Generator/PackageGenerator.php \Drupal\Composer\Generator\PackageGenerator::generate()
  2. 8.9.x composer/Generator/PackageGenerator.php \Drupal\Composer\Generator\PackageGenerator::generate()
  3. 10 composer/Generator/PackageGenerator.php \Drupal\Composer\Generator\PackageGenerator::generate()

Generate Drupal's metapackages whenever composer.lock is updated.

Parameters

\Composer\IO\IOInterface $io: Composer IO object for interacting with the user.

string $base_dir: Directory where drupal/drupal repository is located.

File

composer/Generator/PackageGenerator.php, line 39

Class

PackageGenerator
Generates metapackages.

Namespace

Drupal\Composer\Generator

Code

public function generate(IOInterface $io, $base_dir) {
    // General information from drupal/drupal and drupal/core composer.json
    // and composer.lock files.
    $drupalCoreInfo = DrupalCoreComposer::createFromPath($base_dir);
    // Exit early if there is no composer.lock file.
    if (empty($drupalCoreInfo->composerLock())) {
        return;
    }
    // Run all of our available builders.
    $builders = $this->builders();
    $changed = FALSE;
    foreach ($builders as $builder_class) {
        $builder = new $builder_class($drupalCoreInfo);
        $changed |= $this->generateMetapackage($io, $builder);
    }
    // Remind the user not to miss files in a patch.
    if ($changed) {
        $io->write("If you make a patch, ensure that the files above are included.");
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.