Problem/Motivation
Drupal 8.8.0 introduced native support for Composer directly in Drupal core. With the introduction of Composer also came the new top-level composer
directory, which contains components that are not part of the drupal/core
subtree split.
The following Composer-related components exist:
- Generator: Modifies the metapackages when composer.lock is updated.
- Metapackage: Contains exported dependency version constraints, e.g. drupal/core-recommended.
- Plugin: Contains Composer plugins, e.g. drupal/core-composer-scaffold.
- Template: Contains template projects used to create new Drupal sites, e.g. drupal/legacy-project.
These new components should each be considered for mention in the Drupal 8 backwards compatibility and internal API policy (backend) documentation page, so that this policy can better inform backporting decisions as changes are made to these new components.
Generator
The generators cannot be used or extended from a Drupal site. Their only function to to run during composer update
operations to keep the metapackages in sync with Drupal's composer.lock file. Everything in the Generator directory should therefore be considered @internal.
Metapackage
The Metapackages only contain composer.json files. Each metapackage creates a subtree split with tagged versions that match the versions of drupal/core. No backwards-compatible-breaking change should be introduced in a minor update of a metapackage. Since the metapackages are generated from the composer.lock file, maintaining compatibility in the composer.lock file will also maintain compatibility in the metapackages. Therefore, no specific b/c policy documentation change is needed for the metapackages.
Plugins
The core Drupal Composer plugin classes are not intended to be called or used directly. All of the Composer plugins should therefore be treated as @internal. API changes that break compatibility with older versions of the plugin should therefore be permissible, provided that the behavior and data structures of the plugin remain compatible.
Note, however, that special care must be taken for plugins that run update hooks. It is possible that Composer may load some parts of a plugin before the update operation. If the plugin itself is updated, then the post-update hook and post-install hook will be called using the new version of the plugin. This can cause failures if classes loaded earlier (from the earlier version of the plugin) are incompatible.
For a fix for one example of this, see https://github.com/drupal-composer/drupal-scaffold/pull/82
Templates
The template projects are used to create new Drupal sites, and are also used to generate the downloadable tarballs on drupal.org. Everything in the templates directory should therefore be subject to the backwards compatibility policy.
Proposed resolution
The new headings should appear just before the existing section Minor releases vs. patch releases.
Proposed text for Composer plugins:
- #Composer Plugins
- Composer plugins in the Drupal repository are not included in Drupal download archives, but are instead packages separately. Subclassing code from Composer plugins is not supported. All classes and methods in Composer plugins are considered internal, and should explicitly marked as such for the avoidance of doubt. In the context of a Composer plugin,
@internal
means that the class or method is internal to that plugin only, and should not be used from other Composer plugins or from any other part Drupal core outside of that plugin. Commands provided by Composer plugins must follow the rules for command line tools and scripts.
Proposed text for Commandline tools:
The implementation for all command line tools and scripts packaged in Drupal are considered to be @internal. However, the parameters and options accepted by these tools are themselves considered to be a public API. Changes to parameters and options must follow the rules for backwards compatibility.
Proposed text for Configuration elements:
Configuration elements that Drupal sites and modules must provide in order to work correctly are also considered to be part of the API, and must remain compatible from one release of Drupal to another. Configuration elements that are to be removed or changed must also follow the rules for backwards compatibility.
- #Composer Scaffold Configuration
- Drupal sites that follow the Recommended project or Legacy project templates for Composer-managed sites may contain scaffold configuration elements in their top-level composer.json file. This configuration include specifications for file mappings, the location of the Drupal web root, and other settings. See the documentation on Using Drupal's Composer Scaffold for details on the available settings.
- #Project Message Configuration
- The Project Message plugin allows project templates to include follow-on instructions for sites created from the template. See the Project Message README for details.
- #Vendor Hardening Configuration
- The Vendor Hardening plugin allows Composer-managed sites to provide lists of directories to remove. See the Vendor Hardening README for details.
No part of any of the configuration enumerated above will be changed or removed in a breaking way.
Remaining tasks
Refine the proposed policy as needed and reach agreement on the policy. Update the Drupal 8 backwards compatibility and internal API policy (backend) documentation page with the approved text.