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

Ecosystem Upgrade: Composer Plugin Readiness for 2.0 #8726

Closed
Seldaek opened this issue Apr 1, 2020 · 25 comments
Closed

Ecosystem Upgrade: Composer Plugin Readiness for 2.0 #8726

Seldaek opened this issue Apr 1, 2020 · 25 comments
Assignees
Milestone

Comments

@Seldaek
Copy link
Member

Seldaek commented Apr 1, 2020

Update September: See the list of plugins still lacking support below if you want to help

As we are getting Composer 2.0 closer and closer to a stable release,
and would like to get more people involved with testing it, it is
quite important to get the most common plugins to support our 2.0
branch. Otherwise many users will not be able to try the latest
Composer snapshots when we switch them to 2.0.

If you maintain a Composer plugin and would like to help, here is how:

  • Get a composer 2.0 build by running composer self-update --snapshot

  • Set up a trial project requiring your plugin from a local path repo
    so you can easily work on it and iterate, e.g.

    "repositories": [
        {"type":"path", "url": "../../my-plugin"}
    ],
  • Change your plugin's composer.json to require "composer-plugin-api": "^1.0 || ^2.0" (to begin with, adjust to ^2.0 only if you can't make this work)

  • Update your main plugin entry point class to implement the new
    PluginInterface methods, see e.g.
    composer/installers@d2a9832#diff-e236c450b11f27e4bb81a5069bc619bc

  • Check out the UPGRADE guide for any other changes which might be relevant to you.

  • Run php composer.phar update in that trial project to play with
    your plugin using Composer 2, and fix any issues you run into. If you require other plugins which are not compatible yet, you can bypass that using --ignore-platform-reqs as it will ignore the invalid composer-plugin-api requirements.

  • If at all possible, releasing a version which supports both
    composer-plugin-api ^1.0 and ^2.0 is the best option really as that
    will allow people to use whichever composer version within a project,
    and makes the transition smoother. I am sure the more involved plugins
    will not be able to do this but I think for most it should be
    possible.

  • Finally, report issues to us at
    https://github.com/composer/composer/issues if anything is broken or
    unclear, we'll try to help out ASAP.

Thanks for your attention and help getting the Composer v2 ecosystem up to speed!

@jrfnl
Copy link
Contributor

jrfnl commented Apr 1, 2020

@Seldaek Suggestion: make this a "pinned" issue ;-)

@Seldaek
Copy link
Member Author

Seldaek commented Apr 8, 2020

Published an UPGRADE guide now which might help. I think it covers most relevant changes, but we did change more than that for sure in internal classes.

@greg-1-anderson
Copy link

drupal/core-composer-scaffold and drupal/core-vendor-hardening only need Composer 1 for testing. We can't go up to Composer here until we also bump composer/semver in Drupal core. These plugins work with Composer 2, though, so this should not be an issue.

drupal-composer/drupal-scaffold is deprecated; everyone should switch to drupal/core-composer-scaffold. Note that it is possible to use drupal/core-composer-scaffold from Drupal ^8.9 to install really old versions of Drupal 8, back to Drupal 8.1.0 should work, although technically only 8.7.0+ is supported.

I've got one more plugin from that list that I can update to Composer 2 shortly.

@mcaskill
Copy link
Sponsor Contributor

mcaskill commented Sep 27, 2020

Hi,

I think UPGRADE-2.0.md should explain how locking/updating/installing has changed in Composer 2.
I've noticed across a few plugins that developers not fully aware of the rather drastic change in how Composer operates. Roughly speaking:

  • Composer v1: Composer resolves dependencies (dispatching *_DEPENDENCIES_SOLVING), iterates packages (while dispatching PRE_PACKAGE_* before PRE_FILE_DOWNLOAD), then finally writes the lock file.
  • Composer v2: Composer resolves dependencies (dispatching PRE_POOL_CREATE), writes the lock file, dispatches PRE_OPERATIONS_EXEC, downloads the packages (while dispatching PRE_FILE_DOWNLOAD), then iterates packages (while dispatching PRE_PACKAGE_*).

In particular, people are assuming that PRE_OPERATIONS_EXEC is a replacement for PRE_DEPENDENCIES_SOLVING since they are dispatched in a similar-looking routine. The closest event to the latter would actually be PRE_POOL_CREATE.

Thanks,


[2020-09-28] I've updated my breakdown to include the new events in v2.

@Seldaek
Copy link
Member Author

Seldaek commented Oct 13, 2020

@mcaskill good point thanks, I added detailed notes and a debug mode for events in 3c25d18

@Seldaek
Copy link
Member Author

Seldaek commented Oct 24, 2020

Closing here as Composer 2.0 is out, not that the migration work is over but it probably never will be :)

@Seldaek Seldaek closed this as completed Oct 24, 2020
@Seldaek Seldaek unpinned this issue Feb 12, 2021
andychase added a commit to andychase/ORDatWork that referenced this issue Apr 10, 2022
# Why composer version 1 is required

Currently there is errors about plugin version

```
Problem 1
    - composer/installers is locked to version v1.8.0 and an update of this package was not requested.
    - composer/installers v1.8.0 requires composer-plugin-api ^1.0 -> found composer-plugin-api[2.3.0] but it does not match the constraint.
  Problem 2
    - cweagans/composer-patches is locked to version 1.6.7 and an update of this package was not requested.
    - cweagans/composer-patches 1.6.7 requires composer-plugin-api ^1.0 -> found composer-plugin-api[2.3.0] but it does not match the constraint.
  Problem 3
    - drupal-composer/drupal-scaffold is locked to version 2.3.0 and an update of this package was not requested.
    - drupal-composer/drupal-scaffold 2.3.0 requires composer-plugin-api ^1.0.0 -> found composer-plugin-api[2.3.0] but it does not match the constraint.
  Problem 4
    - oomphinc/composer-installers-extender is locked to version v1.1.2 and an update of this package was not requested.
    - oomphinc/composer-installers-extender v1.1.2 requires composer-plugin-api ^1.0 -> found composer-plugin-api[2.3.0] but it does not match the constraint.
  Problem 5
    - simplesamlphp/composer-module-installer is locked to version v1.1.6 and an update of this package was not requested.
    - simplesamlphp/composer-module-installer v1.1.6 requires composer-plugin-api ^1.0 -> found composer-plugin-api[2.3.0] but it does not match the constraint.
  Problem 6
    - wikimedia/composer-merge-plugin is locked to version v1.4.1 and an update of this package was not requested.
    - wikimedia/composer-merge-plugin v1.4.1 requires composer-plugin-api ^1.0 -> found composer-plugin-api[2.3.0] but it does not match the constraint.
  Problem 7
    - composer/installers v1.8.0 requires composer-plugin-api ^1.0 -> found composer-plugin-api[2.3.0] but it does not match the constraint.
    - jquery/inputmask 5.0.3 requires composer/installers ~1.0 -> satisfiable by composer/installers[v1.8.0].
    - jquery/inputmask is locked to version 5.0.3 and an update of this package was not requested.
```

This link: composer/composer#8726

explains that composer 2 does not support plugins made for composer 1.

# Why php8 is not supported

Some dependencies don't seem to support it. I didn't save the error log from composer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants