- First commit to issue fork.
In Drupal 8, contributed modules may require Composer dependencies, but Drupal core itself will not require site builders and developers to use Composer to assemble a site's code base. This means that contributed modules currently have to ensure their Composer dependencies are installed themselves, which is a task too complex and important to reinvent in every project.
In order to solve this problem we need to determine two things:
We propose adding a build_dependency[]
key to info.yml
files that allow extension developers to explicitly declare that composer is a build requirement.
This requires extension maintainers to take an extra step of declaring composer as a dependency.
It has some added benefits where that metadata could be useful beyond just Drupal's runtime/install time. For instance, we could modify project pages to alert users without composer abilities that they cannot use the extension in the first place
If we determine that an extension requires composer, we must then determine whether or not that requirement has been fullfilled. If it has not, we need to alert the user that a module cannot be installed, or needs to be uninstalled (Already installed modules may go from not requiring composer to requiring composer).
There are couple of proposed approaches to this as well:
Solution A would actually calculate the required dependencies. Since composer supports a variety of dependency declarations (replace, provides, requires, conflict etc), the only sure way to calculate would be to use composer code itself to calculate. Composer's dependency calculation is *extremly slow*, and cannot likely work in an environment where there are web requests involved. Because Composer is a build tool, and should not be utilized at runtime for codebase validation.
Solution B gives us a list of extensions that have been installed with composer. There are two proposed implementations for this solution:
Implementation a. uses an artifact from composers build process, but is not part of a published api, and as such might someday change.
Implementation b. shields us from those changes, and gives us complete control over the format of the file we're using to check.
------------------------------
Stating the problem:
These are composer dependency declarations supported by packages.drupal.org (from @Mixologic #309)
Situation #1: Non-Composer users will install Drupal 8 from a tarball. They will place contrib modules in modules/ using tarballs.
Desired behavior: If a contrib module has a Composer-based dependency which is not present, the user will be prevented from installing that contrib module. All the restrictions of hook_requirements() returning REQUIREMENT_ERROR will be present: The status page will show an error, the site installer won't work, and update.php will not be able to perform an update.
Situation #2: A user is using a contrib module installed as a tarball. This contrib module has an update, and in the update, it introduces a composer.json file which means there are now Composer-based dependencies.
Desired behavior: The same as #1, except the module is already installed so we can't prevent that. We can show the error in the status page, and we can refuse to update. It might be the case that the module will cause a crash, but that's outside of scope here. We only want to make a good-faith effort to tell the user they should start using Composer.
Situation #3: A user is using a contrib module installed as a tarball. This module has Composer-based dependencies which are always present in Drupal 8 (such as a symfony component). An update to the contrib module changes the dependency version constraints to a higher version than is present in Drupal 8.
Desired behavior: Prevent the user from performing the update to this module, because its dependencies are not met.
Situation #4: A user has contrib modules installed through a mixture of tarball installation and Composer-managed installation. The tarball and Composer-based modules have conflicting requirements and should not be able to both be present.
Desired behavior: Prevent the user from updating the tarball module, which should inform them that they should use Composer to manage that module (once all the conflicts are resolved).
General rules of thumb for proposed solutions:
1) Do not make Drupal have a dependency on composer/composer.
2) Introduce as few complexities as possible, in order to leave room for more robust solutions within the Composer layer.
From #261 → :
The situation is: A user is trying to install an extention, where:
Then we can assume that, regardless of whether or not that particular extension contains any replace or conflict information, that composer has not been run to retrieve it's dependencies, and that it was installed using some other method than composer.
We do not have to concern ourselves if a module has a require on anything drupal/* because they will be one of the following:
When we have library types on drupal.org, that are not subtree splits of core itself, we may need to have a namespace for those (drupal/lib-libraryname) so we do not count them as a filled dependency. (could also be drupal-lib/libraryname too. )
Require all modules that are part of a Composer package to be installed/built through Composer prior to installing/enabling it within Drupal.
This is done by compiling a list of Drupal extensions that are Composer packages, and their installation paths during composer install
and composer update
. Whenever a module is enabled, we check if it's part of a Composer package, and if the extension's path lies anywhere within the paths of installed packages, Drupal considers it installed/built through Composer. This is based on Composer's own restriction that it cannot install one package into another.
An advantage of this approach is that the coupling between Drupal and Composer remains small, and extensions can take full advantage of any requirements specifications and package links Composer allows, as well as class autoloading without having to bootstrap Drupal.
One additional Composer item will appear in the status report, indicating whether all necessary Composer dependencies have been installed or not. This is the same requirement that can prevent modules from being installed.
From #120 Jan 6 2016
No code compatibility breaks.
Potentially adds a new api for extension developers to express their dependency on a particular build tool.
This requires any module with a Composer file to be part of the Composer build, before it can be installed within Drupal.
Needs work
11.0 🔥
extension system
Enhances developer experience.
It is used to alert the framework manager core committer(s) that an issue significantly impacts (or has the potential to impact) multiple subsystems or represents a significant change or addition in architecture or public APIs, and their signoff is needed (see the governance policy draft for more information). If an issue significantly impacts only one subsystem, use Needs subsystem maintainer review instead, and make sure the issue component is set to the correct subsystem.
Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.
There is consensus among core maintainers that this is a major issue. Only core committers should add this tag.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.