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

Add support for composer-plugin-api ^2 and implement PlginInterface methods from ^2 #52

Merged
merged 1 commit into from
Apr 17, 2020

Conversation

Ayesh
Copy link
Contributor

@Ayesh Ayesh commented Apr 13, 2020

Hi Bilal,

This PR adds support for Composer v2 for this plugin! composer/composer#8726 and has more information on changes.

Composer version 2 has composer-plugin-api version 2. This commit updates the version constraint to ^1 || ^2 so we can support both composer versions.

See What's new in Composer 2 and UPGRADE-2.0 for more changes in API. Empty methods \Bamarni\Composer\Bin\Plugin::deactivate() and \Bamarni\Composer\Bin\Plugin::uninstall() are added to make it compatible both versions.

Travis will report that this builds fails. It is because the composer/composer package is not pinned to a version constraint. Even without these changes, builds fail.

Thank you.

Copy link
Collaborator

@theofidry theofidry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 thanks a lot for looking into it @Ayesh.

Regarding the composer failure, this can be fixed by adding:

composer config minimum-stability dev
composer config prefer-stable true

to the Travis configuration file with maybe a TODO to say this is necessary until Composer 2 is tagged as stable

src/Plugin.php Show resolved Hide resolved
@Ayesh
Copy link
Contributor Author

Ayesh commented Apr 13, 2020

Thanks a lot for your quick response @theofidry.
I force-pushed a commit that fixes spaces vs tabs issue.

Setting composer stability indeed fixed the tests, except for PHP 5.4 and 5.5 that errors with The command "phpenv global 5.5" failed and exited with 1 during ., which I believe is a problem in Travis's end.

@theofidry
Copy link
Collaborator

PHP 5.4 & 5.5 have been quite annoying as of late, so maybe it's time to drop them. Would you mind opening another PR where we remove both of those versions?

@Ayesh
Copy link
Contributor Author

Ayesh commented Apr 17, 2020

@theofidry - I just opened a PR. It removes PHP 5.4 and 5.5 once and for all, and make some improvements in short-array syntax. If it is merged, this PR will not be mergeable without resolving conflicts. I have https://github.com/Ayesh/composer-bin-plugin/tree/composer-test-travis branch that I rebase to this PR, so this PR can be merged as well :)

Thank you 🙏.

@Ayesh Ayesh marked this pull request as draft April 17, 2020 05:53
@theofidry
Copy link
Collaborator

I recommend you to merge #54 (not rebase): the comments are squashed in the end so it's ok and this allows to not mess up with any existing comment when there is any

…ethods from ^2

Composer version 2 has `composer-plugin-api` version 2. This commit updates
the version constraint to `^1 || ^2` so we can support both composer versions.

See https://php.watch/articles/composer-2 for more changes in API.
Empty methods \Bamarni\Composer\Bin\Plugin::deactivate() and
\Bamarni\Composer\Bin\Plugin::uninstall() are added to make it
compatible both versions.
@Ayesh Ayesh marked this pull request as ready for review April 17, 2020 09:30
@Ayesh
Copy link
Contributor Author

Ayesh commented Apr 17, 2020

Thanks @theofidry . This PR is now based on the merged #54. There were some excessive line issues but they are corrected now.

@theofidry theofidry merged commit 46cb272 into bamarni:master Apr 17, 2020
@theofidry
Copy link
Collaborator

Great, thanks!

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

Successfully merging this pull request may close these issues.

2 participants