-
Notifications
You must be signed in to change notification settings - Fork 160
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 v2 #189
Commits on Feb 5, 2021
-
Show output to highlight the extra composer update
The message is informative and should be visible to users running Composer. Changed: - Log informing user that the installer is running again with merge settings applied - Visibility of `Logger::log()` method to output non-verbose messages
Configuration menu - View commit details
-
Copy full SHA for a6c3fd7 - Browse repository at this point
Copy the full SHA a6c3fd7View commit details -
Revert lock file when extra composer update failed to complete
Adapted from `RequireCommand` in Composer 2.
Configuration menu - View commit details
-
Copy full SHA for 679b55d - Browse repository at this point
Copy the full SHA 679b55dView commit details -
In Composer v2, packages are solved first (dev and non-dev), then the lock file is written, then packages (dev and/or non-dev) are installed/updated/removed. As such, the closest alternative to the retired PRE_DEPENDENCIES_SOLVING is the new PRE_POOL_CREATE (and not PRE_OPERATIONS_EXEC as has been attempted in various plugins). The use of PRE_DEPENDENCIES_SOLVING in the merge-plugin is used to inject duplicate requirements (usually with a different version constraints) into the solver (while distinguishing between require and require-dev). To support Composer v1 and v2 without overcomplicating things, this commit replaces duplicate link tracking in `ExtraPackage` by back porting Composer 2's new static `MultiConstraint::create()` method which can be used to resolve complex-constraints early on. In turn, this makes the need for `PRE_DEPENDENCIES_SOLVING` obsolete. Bug: T248908 Added: - Allow either ^1.1 or ^2.0 composer-plugin-api - New `PluginInterface` methods - New `MultiConstraint` back port from Composer v2 for v1 Changed: - Replaced `PluginState::$duplicateLinks` with `MultiConstraint` to merge requirements and constraints in `ExtraPackage::mergeOrDefer()` instead of during `PRE_DEPENDENCIES_SOLVING` - Locking condition on `POST_PACKAGE_INSTALL` to force update in Composer v2 - Testing of `POST_PACKAGE_INSTALL` to reflect forced update in Composer v2 - Mocking of `VcsRepository` to support `HttpDownloader` for Composer v2 Removed: - Event `PRE_DEPENDENCIES_SOLVING` and method `MergePlugin::onDependencySolve()` since `ExtraPackage::mergeOrDefer()` handles duplicate package constraints - Mocked event `PRE_DEPENDENCIES_SOLVING` in `MergePluginTest::triggerPlugin()` since duplicates are no longer tracked - Assertions for obsolete `$extraInstalls` from `MergePluginTest::triggerPlugin()`
Configuration menu - View commit details
-
Copy full SHA for ca47835 - Browse repository at this point
Copy the full SHA ca47835View commit details -
Update local repository in example composer.json
Added: - "repositories.only" to limit the repository's scope Changed: - "repositories.type" to "path" to use the plugin from the parent directory
Configuration menu - View commit details
-
Copy full SHA for face63b - Browse repository at this point
Copy the full SHA face63bView commit details -
Improve merging constraints using Intervals helper
Added `Intervals::isSubsetOf()`, from composer/semver v3, to use the smallest possible constraint in `ExtraPackage::mergeConstraints()`. Suggestion made by @Seldaek in: https://github.com/wikimedia/composer-merge-plugin/pull/189/files/a5c96e46520c6877792bc3d5fb01b44b0ab8d275#r511653048
Configuration menu - View commit details
-
Copy full SHA for 4c8cedf - Browse repository at this point
Copy the full SHA 4c8cedfView commit details -
Removed `—lock` from sub-level updating instructions. Does not update sub-levels in Composer v1 or v2.
Configuration menu - View commit details
-
Copy full SHA for d962a36 - Browse repository at this point
Copy the full SHA d962a36View commit details -
Centralize Composer version check to PluginState
Added: - Property and method `PluginState::isComposer1` to resolve Composer's version once Changed: - Class `MergePlugin` to use new `isComposer1` method - Class `ExtraPackage` to use new `isComposer1` method Fixed: - Missing `PluginState` type-hint on `ExtraPackage::mergeOrDefer()`
Configuration menu - View commit details
-
Copy full SHA for c529537 - Browse repository at this point
Copy the full SHA c529537View commit details -
Update MultiConstraint back port
Added: - PHPUnit/PHPCS annotations to ignore file Changed: - Updated to composer/semver v3.2.4
Configuration menu - View commit details
-
Copy full SHA for c3c950a - Browse repository at this point
Copy the full SHA c3c950aView commit details -
Update installation section in README
Added: - Instructions for safely upgrading the plugin to support Composer 2 Changed: - Requirements to indicate Composer compatibility
Configuration menu - View commit details
-
Copy full SHA for 1683470 - Browse repository at this point
Copy the full SHA 1683470View commit details -
Configuration menu - View commit details
-
Copy full SHA for 453dc8a - Browse repository at this point
Copy the full SHA 453dc8aView commit details -
Include MultiConstraint in sniffs and coverage
Fixed: - Syntax issues raised by PHPCS
Configuration menu - View commit details
-
Copy full SHA for 81536f5 - Browse repository at this point
Copy the full SHA 81536f5View commit details -
Update GitHub Actions to test Composer v2
Added: - Action "ramsey/composer-install" to handle installation and caching - Steps to test Composer v1 and Composer v2 as dependencies
Configuration menu - View commit details
-
Copy full SHA for 3a72cc9 - Browse repository at this point
Copy the full SHA 3a72cc9View commit details -
Removed `InstallerEvent` and `InstallerEvents`. Amends 4da0ee8
Configuration menu - View commit details
-
Copy full SHA for e8ea480 - Browse repository at this point
Copy the full SHA e8ea480View commit details -
Fix condition syntax in MultiConstraint
Fixed mix of yoda and non-yoda conditions.
Configuration menu - View commit details
-
Copy full SHA for 86bdb3e - Browse repository at this point
Copy the full SHA 86bdb3eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 3f68047 - Browse repository at this point
Copy the full SHA 3f68047View commit details -
Update plugin name occurrences in README
Normalize naming across file.
Configuration menu - View commit details
-
Copy full SHA for 702596b - Browse repository at this point
Copy the full SHA 702596bView commit details -
Revert force update for Composer 2
Restore original behaviour to only trigger update when lock file is not locked. In Composer 2, it is always locked. Added console log to notify user they may need to perform a manual update. Amends 4da0ee8
Configuration menu - View commit details
-
Copy full SHA for 7e6723b - Browse repository at this point
Copy the full SHA 7e6723bView commit details
Commits on Feb 7, 2021
-
Add non-breaking whitespace to README
To prevent orphan version numbers when paired with software.
Configuration menu - View commit details
-
Copy full SHA for daa4e87 - Browse repository at this point
Copy the full SHA daa4e87View commit details -
Refactor first install of merged requirements
Adds tracking of merged requirements to `ExtraPackage` and `MergePlugin` to control if `MergePlugin::onPostInstallOrUpdate()` needs to trigger a `composer update` to install or update new requirements. The merged requirements are now assigned to `Installer::setUpdateAllowList()` to restrict the update operation to those new requirements. This prevents all other packages (such as root requirements) from being updated. This solution provides consistent support of both the first-install feature and subsequent changes to merge-patterns between Composer 1 and 2. Added: - Property `ExtraPackage::$mergedRequirements` (and getter method) to track new requirements during merging process of `ExtraPackage::mergeOrDefer()`. - Property `MergePlugin::$updateAllowList` (and getter method) to track all new requirements during merging process of `MergePlugin::mergeFile()`. - Conditional statement in `MergePlugin::onPostInstallOrUpdate()` to skip first-install if there are no extra requirements. Changed: - Replaced `PluginState::forceUpdate()` conditional statement in `MergePlugin::onPostInstallOrUpdate()` with `Installer::setUpdateAllowList()` FIxed: - Property tags for `$loaded` and `$loadedNoDev` in `MergePlugin`
Configuration menu - View commit details
-
Copy full SHA for 4195d45 - Browse repository at this point
Copy the full SHA 4195d45View commit details
Commits on Feb 8, 2021
-
Use setUpdateWhitelist for Composer 1
Fixes backwards compatibility with versions older than Composer 1.10.8. Amends 4195d45
Configuration menu - View commit details
-
Copy full SHA for b8b8cb4 - Browse repository at this point
Copy the full SHA b8b8cb4View commit details