-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
Slip stream in composer 2.0 #18
Slip stream in composer 2.0 #18
Conversation
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
Well, now travis fails because codestandard says "closure can be static" but it can't as it wont set the property anymore... Thats why I hate changing code I didn't wrote myself... 👎 |
I didn't write "static" in my example #18 (comment) , you added static yourself, that's why it got error. |
I've applied phpcbf which changed it to Welcome to QA hell. |
Closure binding only works if the function is non-static Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
@weierophinney Any ideas how to raise code coverage? it needs to get merged from both results of |
Wrap the closure (or at least its opening line) with |
No clues whatsoever... maybe @michalbundyra might have ideas? |
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
Codecov Report
@@ Coverage Diff @@
## develop #18 +/- ##
==========================================
Coverage ? 92.33%
Complexity ? 97
==========================================
Files ? 5
Lines ? 339
Branches ? 0
==========================================
Hits ? 313
Misses ? 26
Partials ? 0
Continue to review full report at Codecov.
|
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
Well, I finally got proper codecoverage. Hopefully, thats enough. I also removed dev-dependency of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fantastic - surprised to see you found a way to keep the current functionality with the v2 API - I'm assuming the "POOL" events must be the secret to making that work?
I have no feedback at a technical level. I haven't had time to dive into where and when the POOL events are triggered, but I trust you did the research!
Let's do an alpha or beta release from this, and have people start testing!
@@ -1,14 +1,18 @@ | |||
<?xml version="1.0"?> | |||
<ruleset name="Webimpress Coding Standard"> | |||
<rule ref="./vendor/webimpress/coding-standard/ruleset.xml"/> | |||
<rule ref="./vendor/webimpress/coding-standard/ruleset.xml"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably move to Laminas Coding Standard v2, but that can wait for another PR. 😄
Yah, more or less. Jordi pointed me to this event, but it is being triggered before any package is being downloaded. As I've started to implement the initial version, I realized, that the dependency-plugin was not able to interact due to the fact, that it was not downloaded at the point when the events are triggered (in a project which is being installed for the first time - so without the vendor/ directory available). That was what made me thinking about the way we discussed a few months ago. That other way drove me crazy after a few weeks of developing and thus I tried this approach again. Flow is as follows (for a freshly installed package):
So hopefully, we have the same features as in the first version of this plugin. @weierophinney I would love to see this as a first preview release so contributors can start testing with the new version. |
@boesing Go ahead and merge to develop, and issue a 2.0.0beta1 release. I'm suggesting beta, in case we determine there might be additional features before we do a stable release; that way we can do another beta. Otherwise, we can jump directly from beta to stable if user tests show it working as expected. |
Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
- Removes empty 1.0.5 stub from CHANGELOG - Renames 1.1.0 release to 2.0.0beta1 in CHANGELOG - Adds CHANGELOG entry for #18 - Updates dev branch alias to 2.0.x-dev Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
Just want to give feedback: works great for me with the composer 2.0 plugin :). Just pushed our app to production, using this beta. |
}, | ||
"require-dev": { | ||
"composer/composer": "^1.9", | ||
"dealerdirect/phpcodesniffer-composer-installer": "^0.5.0", | ||
"composer/composer": "^1.9 || ~2.0.0@dev || ^2.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
~2.0.0@dev
can be removed after stable 2.0
|
||
abstract class AbstractDependencyRewriter implements RewriterInterface | ||
{ | ||
/** @var Composer */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be null
/** @var Composer */ | ||
protected $composer; | ||
|
||
/** @var IOInterface */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be null
Description
While trying to migrate to composer 2.0, I've tried many ways on how to achieve the functionality of the current plugin.
The current plugin "slip streams" into the composer process, which is probably the best solution to solve the following scenarios:
If 3rd-party library has a zend-dependency and updates to laminas, there wont be any changes to the project as the laminas package is already required.
If a 3rd-party library has a zend-dependency and requires a newer zend-dependency, the project will just upgrade to the laminas equivalent. No further action needed.
If a 3rd-party library totally drops a zend-dependency and does not need the laminas equivalent, the slip-streamed laminas dependency will automatically being removed from the project if its not needed anymore.
I came up with a way in #15 which should have introduced some more user interactions. The main idea was:
If a 3rd-party library has a zend-dependency, ask the user if he wants to replace that zend-dependency the laminas pendant, write the dependency to
composer.json
of the project and remember that we introduced that dependency due to a non-migrated library.TL;DR
This is finally ready for review.
Story on why I decided to go this way
After many sleepless nights and a total rewrite of the dependency plugin, I realized that this approach would probably be a future proof solution but its way too complex.
The complexity exceeded my brain capacity too often.
Its unmaintainable due to all those possible combinations:
composer.json
as arequire
packagecomposer.json
as arequire-dev
packagecomposer.json
should change therequire
of the laminas equivalent torequire-dev
as there is only a dev-requirement left which requires the zend-packageAnd thats just one of those complex scenarios...
However, after I realized that #15 wont be a solution I am happy with, I started to work on this approach today. I don't know why I tried this earlier (as I was debugging what exactly changed in composer 2.0 that the slip-stream solution we are actually use does not work anymore)... That would probably saved my a ton of work.