Problem/Motivation
If someone tries to install Drupal core via Composer, it will install it in vendor/drupal/core. To get Drupal installed in the required core folder a custom installer should be provided.
Proposed resolution
Drupal should reference composer/installers as a dependency of a Drupal.
Since it is a dependency of Drupal, not Drupal core, the dependency does not need to be added to the repository and Drupal core makes no assumptions of how it will be installed.
Only when someone executes composer update (from the root of Drupal) will the 3rd-party library be installed. If they never run that command, they'll never get the library.
Steps to test
Inside your Drupal repository root run:
$ rm -r composer.lock core
$ composer install
Afterwards there should be no changes other than in composer.json.
Note that I (tstoeckler) had to also add the following to the repositories section of composer.json:
{
"type": "vcs",
"url": "git@github.com:composer/installers.git"
}
But it that seems to be a separate issue that I've had before and seems to be somehow related to my environment.
Beta phase evaluation
| Issue priority | Major because projects should be able to use composer to manage a Drupal project with a minimum of fuss. |
|---|---|
| Disruption | Not disruptive at all - only affects installation of Drupal using composer which atm does not work. This is a step along the way. |
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | composer_installers-2373197-6.patch | 296 bytes | davidwbarratt |
Comments
Comment #1
davidwbarratt commentedComment #2
davidwbarratt commentedComment #3
davidwbarratt commentedComment #4
davidwbarratt commentedComment #5
davidwbarratt commentedI'm going to assume that the next release will be
1.0.20when that is released, the version number should be changed to:For more information on the Caret operator please see:
https://getcomposer.org/doc/01-basic-usage.md#next-significant-release-t...
Comment #6
davidwbarratt commentedComposer Installers just released
1.0.20so using that in the version constraint.Comment #7
tstoecklerYes, this makes sense. Thanks!
Comment #8
tstoecklerActually, I think we should add the install-paths stuff as well, otherwise adding the installers is kind of pointless.
Comment #9
davidwbarratt commented#8,
No longer necessary, it's been added to Composer Installers' code base:
https://github.com/composer/installers/pull/208
and is included in the 1.0.20 release (hence the version constraint)
Comment #10
davidwbarratt commentedI've updated this doc with the most recent instructions, if this gets commited I'll update it again:
https://www.drupal.org/node/2404989
Comment #11
tstoecklerAhh yes, I forgot that they provide defaults. I'll give it a spin later to see if it works for me now.
Comment #12
tstoecklerNice, this works really, really well.
As
drupal/coreis now available on Packagist this actually works.Updated the issue summary with some steps to test this.
Comment #13
tstoecklerComment #14
webchickNew external libraries need sign-off from Dries, so assigning. It might be helpful to explain in the issue summary what this gets us (in plain English for the non-Composer-savvy, if possible. :D).
Comment #15
davidwbarratt commented#14,
We're not really adding an external library, just a reference to one (hence why it's in the main
composer.jsonand notcore/composer.json).Does that make sense? Basically only when someone executes
composer updatewill the 3rd-party library be installed. If they never run that command, they'll never get the library.Comment #16
davidwbarratt commentedI've updated the issue summary and title so it makes more sense to the non-Composer folks. :)
Comment #17
davidwbarratt commentedAlso, we're asking users to add the line anyways:
https://www.drupal.org/node/2404989
Comment #18
alexpott@webchick as @davidwbarratt says this is not adding a new dependency to core - it is part of getting a composer only Drupal project working. So I feel okay to commit this. I've added the beta evaluation to the summary.
Committed c81f327 and pushed to 8.0.x. Thanks!
Comment #20
davidwbarratt commentedThanks @alexpott !
I've updated the documentation to reflect the change:
https://www.drupal.org/node/2404989