public function PackageGenerator::generate in Drupal 8
Same name and namespace in other branches
- 9 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\GeneratorCode
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.");
}
}