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

Autoloader: Support Composer v2.0 #15921

Merged
merged 1 commit into from
Jun 29, 2020
Merged

Autoloader: Support Composer v2.0 #15921

merged 1 commit into from
Jun 29, 2020

Conversation

kbrown9
Copy link
Member

@kbrown9 kbrown9 commented May 25, 2020

Fixes #15793

Composer v2.0 will be released soon, and the autoloader needs to be updated to add support for v2.0.

NOTE: One of Jetpack's dependencies, dealerdirect/phpcodesniffer-composer-installer v0.6.2, requires composer-plugin-api v^1.0 so it's not compatible with Composer 2.0. Adding support for Composer v2.0 is in progress here.

Changes proposed in this Pull Request:

  • Allow version ^2.0 of the composer-plugin-api package.
  • Implement the CustomAutoloaderPlugin::deactivate() and CustomAutoloaderPlug::uninstall() methods which have been added to PluginInterface.

Is this a new feature or does it add/remove features to an existing part of Jetpack?

  • This updates an existing part of Jetpack.

Does this pull request change what data or activity we track or use?

  • No.

Testing instructions:

CustomAutoloaderPlugin must work with both Composer v1.x and v2.0, so we'll test with version 1.10.6 and version 2.0

Test with the latest stable version of Composer, v1.10.6
  1. Run composer --version and confirm that you’re using v1.10.6. If not, use composer self-update --stable to update.

  2. Run composer update and verify that no errors are generated. The Jetpack Autoloader files should be generated:

    • vendor/composer/autoload_classmap_package.php
    • vendor/composer/autoload_files_package.php
    • vendor/autoload_packages.php
Test with the Composer v2.0 snapshot version:
  1. Run composer self-update --snapshot to install v2.0.
  2. Run composer update --ignore-platform-reqs and verify that no errors are generated. The Jetpack Autoloader files listed above should be generated.

NOTE: The —ignore-platform-reqs option is required for this test because one of Jetpack’s dependencies does not support Composer 2.0 (see details above).

  1. You can also test these changes by removing the dealerdirect/phpcodesniffer-composer-installer requirement from Jetpack’s composer.json file, then running composer update. No errors should be generated, and the autoloader files listed above should be created.

Proposed changelog entry for your changes:

  • Autoloader: add support for Composer 2.0

@kbrown9 kbrown9 added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Pri] Normal [Focus] Jetpack DNA labels May 25, 2020
@kbrown9 kbrown9 self-assigned this May 25, 2020
@github-actions github-actions bot added the [Status] Needs Package Release This PR made changes to a package. Let's update that package now. label May 25, 2020
@kbrown9 kbrown9 removed the [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it label May 25, 2020
@jetpackbot
Copy link

jetpackbot commented May 25, 2020

Thank you for the great PR description!

When this PR is ready for review, please apply the [Status] Needs Review label. If you are an a11n, please have someone from your team review the code if possible. The Jetpack team will also review this PR and merge it to be included in the next Jetpack release.

E2E results is available here (for debugging purposes): https://jetpack-e2e-dashboard.herokuapp.com/pr-15921

Scheduled Jetpack release: July 7, 2020.
Scheduled code freeze: June 30, 2020

Generated by 🚫 dangerJS against 588c411

@kbrown9 kbrown9 added the [Status] Needs Review To request a review from Crew. Label will be renamed soon. label May 25, 2020
@kbrown9 kbrown9 modified the milestones: 8.6, 8.7 May 25, 2020
@kraftbj
Copy link
Contributor

kraftbj commented May 28, 2020

You can also test a production version by composer update --no-dev which would work without having to ignore platform deps. Ignore me. I'd thought that should work, but I guess it still parses dev-deps even when --no-dev is passed.

kraftbj
kraftbj previously approved these changes May 28, 2020
@kraftbj kraftbj added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review To request a review from Crew. Label will be renamed soon. labels May 28, 2020
@kraftbj
Copy link
Contributor

kraftbj commented May 28, 2020

In the changelog, we shouldn't declare Composer 2.0 support until after we bump dealerdirect/phpcodesniffer-composer-installer once they've shipped.

@jeherve jeherve added [Package] Autoloader [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! and removed [Status] Ready to Merge Go ahead, you can push that green button! labels Jun 22, 2020
@jeherve
Copy link
Member

jeherve commented Jun 26, 2020

@kbrown9 This now needs a rebase since we've merged the other set of changes.

@kbrown9
Copy link
Member Author

kbrown9 commented Jun 29, 2020

I rebased to resolve a merge conflict and force-pushed the updated commit.

dealerdirect/phpcodesniffer-composer-installer 0.7.0 includes support for Composer 2.0 When we merge PR #16308, we should be ready for Composer 2.0.

@kbrown9 kbrown9 added [Status] Needs Review To request a review from Crew. Label will be renamed soon. and removed [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! labels Jun 29, 2020
@jeherve jeherve added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review To request a review from Crew. Label will be renamed soon. labels Jun 29, 2020
jeherve
jeherve previously approved these changes Jun 29, 2020
Copy link
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

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

This should be ready to merge, but it's going to need another rebase because of #16316.

Add support for Composer 2.0:
 - Allow version ^2.0 of the composer-plugin-api package.
 - Implement the PluginInterface::deactivate() and PluginInterface::uninstall() methods.

Code cleanup:
 - Fix a typo.
@jeherve jeherve merged commit 5d303b7 into master Jun 29, 2020
@jeherve jeherve deleted the add/composer_2_support branch June 29, 2020 16:38
@matticbot matticbot added [Status] Needs Changelog and removed [Status] Ready to Merge Go ahead, you can push that green button! labels Jun 29, 2020
@jeherve jeherve removed the [Status] Needs Package Release This PR made changes to a package. Let's update that package now. label Jul 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Autoloader: prepare the autoloader package for Composer 2.0
5 participants