Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for new drupal/core-recommended subtree split #15

Merged
merged 3 commits into from
Oct 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ env:
- RELEASE=stable COMPOSER_CHANNEL=snapshot

matrix:
allow_failures:
# 5.6 is no longer supported by drupal-composer/drupal-project
- php: 5.6
env: RELEASE=stable COMPOSER_CHANNEL=stable
exclude:
- php: 5.6
env: RELEASE=dev COMPOSER_CHANNEL=stable
Expand Down
13 changes: 8 additions & 5 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ public function activate(Composer $composer, IOInterface $io)
// Set default version constraints based on the composer requirements.
$extra = $composer->getPackage()->getExtra();
$packages = $composer->getPackage()->getRequires();
if (!isset($extra['composer-drupal-optimizations']['require']) && isset($packages['drupal/core'])) {
$coreConstraint = $packages['drupal/core']->getConstraint();
$extra['composer-drupal-optimizations']['require'] = static::getDefaultRequire($coreConstraint);
if (!empty($extra['composer-drupal-optimizations']['require']) && $io->isVerbose()) {
$io->write('Required tags were not explicitly set so the zaporylie/composer-drupal-optimizations set default based on project\'s composer.json content.');
if (!isset($extra['composer-drupal-optimizations']['require'])) {
$package = isset($packages['drupal/core']) ? $packages['drupal/core'] : (isset($packages['drupal/core-recommended']) ? $packages['drupal/core-recommended'] : null);
if (isset($package)) {
$coreConstraint = $package->getConstraint();
$extra['composer-drupal-optimizations']['require'] = static::getDefaultRequire($coreConstraint);
if (!empty($extra['composer-drupal-optimizations']['require']) && $io->isVerbose()) {
$io->write('Required tags were not explicitly set so the zaporylie/composer-drupal-optimizations set default based on project\'s composer.json content.');
}
}
}
if (!empty($extra['composer-drupal-optimizations']['require']) && $io->isVerbose()) {
Expand Down