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

Composer 2.0 compatibility #45

Merged
merged 4 commits into from
Nov 20, 2020
Merged

Conversation

kienstra
Copy link
Contributor

@kienstra kienstra commented Nov 17, 2020

GCB should work with Composer 2.0, it's bad if you have to revert to an outdated 1.* Composer version to use it.

Changes

  • composer install now works locally with Composer 1.* and 2.*
  • Todo: similar PR for GCB pro

Testing instructions

  1. composer self-update --2 # update Composer to 2.* if it's not there already
  2. composer install
  3. Expected: it installs without error
  4. npm run lint:php
  5. Expected: linting passes
  6. composer self-update --rollback # go back to the Composer version before you did step 1

command: |
CHANGED_FILES="$( git diff HEAD^ HEAD --name-only --diff-filter=ACMRT << parameters.directories >> )"
if [ -z "$CHANGED_FILES" ] && [ -z "$CIRCLE_TAG" ]; then echo "No change to relevant file, exiting job" && circleci-agent step halt; fi
- run: sudo apt-get update && sudo apt-get install libkrb5-dev
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ported from #43 and #44, various fixes to prevent npm ci errors

composer require --dev phpunit/phpunit 5.7.9
WP_TESTS_DIR=~/project/wordpress-develop/tests/phpunit ./vendor/bin/phpunit

js-tests:
executor: php
steps:
- checkout
- conditionally-skip:
directories: js tests/js
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ported from https://github.com/studiopress/genesis-custom-blocks/pull/41/files#r517919253. That was merged into the editor feature branch.

These were deleted in the
editor feature branch,
as the editor is under development.
But they should not be
deleted here.
@@ -9,7 +9,7 @@
},
"require-dev": {
"brain/monkey": "2.4.0",
"dealerdirect/phpcodesniffer-composer-installer": "0.5.0",
"dealerdirect/phpcodesniffer-composer-installer": "0.7.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the main change that allows Composer 2.0

Choose a reason for hiding this comment

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

Does your comment mean that version 0.5.0 of this package was failing with composer 2.0?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I think 0.5.0 caused this message:

$ git checkout develop
$ composer self-update --2 # If needed, changes Composer to 2.*
$ composer install
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Your lock file does not contain a compatible set of packages. Please run composer update.

  Problem 1
    - dealerdirect/phpcodesniffer-composer-installer is locked to version v0.5.0 and an update of this package was not requested.
    - dealerdirect/phpcodesniffer-composer-installer v0.5.0 requires composer-plugin-api ^1.0 -> found composer-plugin-api[2.0.0] but it does not match the constraint.

@kienstra kienstra changed the title Attempt Composer 2.0 compatibility Composer 2.0 compatibility Nov 17, 2020
@kienstra
Copy link
Contributor Author

kienstra commented Nov 18, 2020

Hi @markkelnar and @mindctrl,
Could you please review this? It'll allow us to use the latest (2.*) of Composer. It also works with 1.10.17, and maybe more versions.

Probably no need for functional testing of the plugin, this only touches development files.

Thanks!

Copy link

@markkelnar markkelnar left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@kienstra
Copy link
Contributor Author

Thanks, @markkelnar!

@kienstra kienstra merged commit c1e77d8 into develop Nov 20, 2020
@kienstra kienstra deleted the update/composer-2.0-compatibility branch November 20, 2020 22:05
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