Although the wikimedia/composer-merge-plugin remains in Drupal's root composer.json file, it is no longer being used to merge in the drupal/core subproject. Instead, a Composer path repository is being used for that purpose. Most users should not notice any change in behavior from these changes, but see the notes at the end about downgrading, core development, and custom modules that are currently using the composer-merge-plugin.
The project drupal/core is a subtree split of the core directory in the monorepo drupal/drupal. Previously, drupal/core was merged into drupal/drupal using the wikimedia/composer-merge-plugin; it also recursively merged in a number of subprojects which are also subtree splits. This had the effect of making all of the dependencies of drupal/core, and all of the dependencies merged from drupal/core become dependencies of the top-level project drupal/drupal.
In Drupal 8.8.x, drupal/core and its various subprojects remain subtree splits of drupal/drupal; now, though, drupal/core is included from drupal/drupal via Composer's path repository feature. The subprojects that drupal/core formerly merged are now replaced via Composer's project replace feature. There are two primary implications from this change:
- The
drupal/corepackage is installed as a separate Composer project and relocated via thecomposer/installersplugin back to its source location, thecoredirectory (a no-op). All of its external dependencies are still included as dependencies ofdrupal/drupal. - The dependencies of the replaced projects do not become dependencies of
drupal/drupal.
Drupal Components (in core/lib/Components directory) will need to declare their dependencies in their own composer.json file, so that they work as subtree split projects, and must also ensure that all of their dependencies are declared in the drupal/core composer.json file, so that they work when included in Drupal.
Important prerequisite: This change requires Composer 1.9 or later in order to do Drupal core development. Earlier versions of Composer may still be used when using Drupal tarball downloads or template projects such as drupal-composer/drupal-project.
When making patches that modify the core/composer.json file, be sure to run composer update drupal/core to update the composer.lock file. This is necessary even for projects included via a path repository because Composer stores some metadata from the composer.json file in the lock file. This metadata most notably includes the extra section.
Core developers: Now, core developers creating patches that update core's dependencies must set the environment variable COMPOSER_ROOT_VERSION explicitly to avoid unexpected results (including possible accidental deletion of the core directory). When making patches that modify the core/composer.json file, run COMPOSER_ROOT_VERSION=8.9.x-dev composer update drupal/core to update the composer.lock file. This is necessary even for projects included via a path repository because Composer stores some metadata from the composer.json file in the lock file. This metadata most notably includes the extra section. This process must be repeated for every branch, using a COMPOSER_ROOT_VERSION that matches the branch name (plus "-dev"). Read Managing Composer updates for Drupal core for more information.
Contributed and custom modules using composer-merge-plugin: The managing dependencies for a custom project documentation previously recommended using the composer-merge-plugin to manage external dependencies added by a custom project. If you have a site that followed this advice, you will need to examine your root composer.json file to ensure that your dependencies will continue to be included. There are two options available. First, you could use a path repository, as now recommended in the documentation. Alternately, you could make sure that the composer-merge-plugin remains in your root composer.json file, and is configured appropriately to include your custom modules' composer.json files. Switching to a path repository will provide a performance improvement for Composer operations.