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

Support Composer 2 #33

Closed
samdark opened this issue Apr 9, 2020 · 11 comments
Closed

Support Composer 2 #33

samdark opened this issue Apr 9, 2020 · 11 comments
Assignees
Milestone

Comments

@samdark
Copy link
Contributor

samdark commented Apr 9, 2020

composer-plugin-api for upcoming Composer 2 (can be installed with composer self-update --snapshot) has version 2.0.0.

The foxy/foxy package requires composer-plugin-api version 1.0.0 thus can't be used with Composer 2.

@francoispluchino
Copy link
Member

I have not yet had the opportunity to look in more detail the version 2.0 of Composer. Is it just a matter of version constraint? Or, are there more problematic changes for this plugin?

@cebe
Copy link

cebe commented Apr 9, 2020

The interface has changed, see https://github.com/composer/composer/blob/master/UPGRADE-2.0.md#upgrades-guides-for-composer-1x-to-20

@samdark
Copy link
Contributor Author

samdark commented Apr 22, 2020

Looks like the following would work:

  1. Change constraint in composer.json. "composer-plugin-api": "^1.0|^2.0",
  2. In the Foxy class add two dummy methods:
public function deactivate(Composer $composer, IOInterface $io): void
{
      // do nothing
}

public function uninstall(Composer $composer, IOInterface $io): void
{
    // do nothing
}
  1. You may do cleanup in deactivate and uninstall but it doesn't seem to be necessary for the plugin to just work as before.
  2. There could be extras...

@francoispluchino
Copy link
Member

@samdark Thank you! I will try to find some time this weekend to test the compatibility with Composer v2.

@francoispluchino francoispluchino self-assigned this Apr 25, 2020
@francoispluchino francoispluchino added this to the 1.0 milestone Apr 25, 2020
@francoispluchino
Copy link
Member

Compatibility added by b7473e7.

@francoispluchino francoispluchino modified the milestones: 1.0, 1.1 Apr 25, 2020
@samdark
Copy link
Contributor Author

samdark commented Apr 25, 2020

Interesting. Composer 2 fails to install it:

Loading composer repositories with package information
Updating dependencies
Lock file operations: 47 installs, 0 updates, 0 removals
   ...
  - Locking foxy/foxy (dev-master 7efd3d1)
   ...
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 47 installs, 0 updates, 0 removals
  - Installing foxy/foxy (dev-master 7efd3d1): Extracting archive
Plugin initialization failed (Invalid version string "d173af2d7ac1408655df2cf6670ea0262e06d137"), uninstalling plugin
  - Removing foxy/foxy (dev-master 7efd3d1)
    Install of foxy/foxy failed

@samdark
Copy link
Contributor Author

samdark commented Apr 25, 2020

You can try with https://github.com/yiisoft/yii-bootstrap4

@francoispluchino
Copy link
Member

Sure enough, I also get this error now.

@francoispluchino
Copy link
Member

My test was with the master branch and not with a compiled version of Composer. This comes from checking the version of Composer which is a SHA1 and not @package_version@ for the snapshots.

I add this case right away.

@francoispluchino
Copy link
Member

Compatibility with Composer snapshots added by 201420a.

@samdark
Copy link
Contributor Author

samdark commented Apr 25, 2020

Works now. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants