The project needs a composer.json for Drupal CI automated tests to work Drupal 9 tests.
Having a new warning after Updating Upgrade Status 8.x-2.2 released 10 April 2020
#3123996: Check if composer.json is not Drupal 9 compatible, if it exists
The drupal/core requirement is not Drupal 9 compatible. Having a composer.json is not a requirement for Drupal 9 compatibility but if there is one, it should include a drupal/core requirement compatible with Drupal 9.
For example:
composer create-project drupal/recommended-project:~9 /var/www/html/test/drupal9test1allowed_formats -vvv
cd /var/www/html/test/drupal9test1allowed_formats
And then
composer require 'drupal/allowed_formats:^1.0'
or the dev branch
composer require 'drupal/allowed_formats:1.x-dev'
Find out that in the .info.yml
We do have ^8.7.7 || ^9
It could be changed to ^8 || ^9 or ^8.8 || ^9 or ^8.7.7 || ^8 || ^9
To have it work for both Drupal 8 and Drupal 9
When we test in Drupal 9 we can get the following issue
- drupal/allowed_formats 1.x-dev requires drupal/core ^8.7.7 || ^9 -> satisfiable by drupal/core[8.7.10, 8.7.11, 8.7.12, 8.7.13, 8.7.14, 8.7.7, 8.7.8, 8.7.9, 8.7.x-dev, 8.8.0, 8.8.0-alpha1, 8.8.0-beta1, 8.8.0-rc1, 8.8.1, 8.8.2, 8.8.3, 8.8.4, 8.8.5, 8.8.6, 8.8.7, 8.8.8, 8.8.x-dev, 8.9.0, 8.9.0-beta1, 8.9.0-beta2, 8.9.0-beta3, 8.9.0-rc1, 8.9.1, 8.9.x-dev, 9.0.0, 9.0.0-alpha1, 9.0.0-alpha2, 9.0.0-beta1, 9.0.0-beta2, 9.0.0-beta3, 9.0.0-rc1, 9.0.1, 9.0.x-dev, 9.1.x-dev].
- Can only install one of: drupal/core[9.0.0-alpha1, 8.7.1].
- Can only install one of: drupal/core[9.0.x-dev, 8.7.1].
- Can only install one of: drupal/core[9.1.x-dev, 8.7.1].
- Can only install one of: drupal/core[8.8.0-alpha1, 8.7.1].
- Can only install one of: drupal/core[8.8.x-dev, 8.7.1].
- Can only install one of: drupal/core[8.9.x-dev, 8.7.1].
- Can only install one of: drupal/core[8.7.x-dev, 8.7.1].
- Conclusion: install drupal/core 8.7.1
It's important to update the composer with the full project set of config and have the following.
+ "require": {
+ "drupal/core": "^8 || ^9"
+ }
| Comment | File | Size | Author |
|---|---|---|---|
| #31 | allowed_formats-add_composer_json_and_update_core_requirements-3151386-31.patch | 1.66 KB | nord102 |
| #29 | comp.png | 28.45 KB | grayle |
| #22 | 3151386-22.patch | 1.26 KB | grayle |
| #21 | 3151386-21.patch | 418 bytes | grayle |
| #15 | 3151386-15.patch | 1.67 KB | rajab natshah |
Comments
Comment #2
gnanagowthaman sankar commentedHi @Mohammed J. Razem,
Here by i attached the patch. Please review and let me know for the changes.
Thanks & regards,
Gnanagowthaman Sankar
Comment #3
mohammed j. razemPatch is not applying.
Comment #4
mohammed j. razemComment #5
gnanagowthaman sankar commentedHi @Mohammed J. Razem,
I modified the patch. Please review and let me know for changes.
Thanks & regards,
GnanagowthamanSankar
Comment #6
rajab natshahComment #7
rajab natshahComment #8
rajab natshahComment #9
rajab natshahComment #10
rajab natshahComment #11
rajab natshahComment #12
rajab natshahComment #13
rajab natshahComment #14
rajab natshahFind out that in the .info.yml
We do have
^8.7.7 || ^9It should be changed to
^8 || ^9To have it work for both Drupal 8 and Drupal 9
When we test in Drupal 9 we can get the following issue
Comment #15
rajab natshahComment #16
rajab natshahComment #17
bramdriesenI assume this was actually set to 8.7.7 for a reason.
Comment #18
rajab natshahThank you Bram for the notice.
- core_version_requirement: ^8.7.7 || ^9will not allow to be installed in ^8.8 for example
To have the full test cases with physical Drupal core files
^8.7.7 is stronger than ^8.7
It will force to use Drupal 8.7.*
Caret Version Range (^)
https://getcomposer.org/doc/articles/versions.md#caret-version-range-
The ^ operator behaves very similarly but it sticks closer to semantic versioning, and will always allow non-breaking updates. For example ^1.2.3 is equivalent to >=1.2.3 <2.0.0 as none of the releases until 2.0 should break backwards compatibility. For pre-1.0 versions it also acts with safety in mind and treats ^0.3 as >=0.3.0 <0.4.0.
This is the recommended operator for maximum interoperability when writing library code.
Please have a look at
Versions and constraints
Comment #19
rajab natshahWhen we test in Drupal 9 or Drupal 8.8.* we can get the following issue
Comment #20
rajab natshahIt could be changed to
^8 || ^9or^8.8 || ^9or^8.7.7 || ^8 || ^9Comment #21
grayle commentedTime stops for no man. I'd suggest
^8.8 || ^9, and remove the requirement from composer.json. Drupal.org should take care of that one on its own.https://www.drupal.org/node/3070687
Comment #22
grayle commentedOr with composer.json file for fanciness. Still no core requirement, also removed repositories entry. Doesn't work anyway for dependencies.
https://getcomposer.org/doc/faqs/why-can%27t-composer-load-repositories-...
Comment #23
grayle commentedComment #24
bramdriesenLooks great to me :-)
Comment #25
rajab natshahWe do need the following in the composer
as in patch #15
we do not have that or require in #22
Comment #26
rajab natshahReal physical testing with Drupal 9 is important in this case
For example:
And then
composer require 'drupal/allowed_formats:^1.0'or the dev branch
composer require 'drupal/allowed_formats:1.x-dev'Comment #27
grayle commentedI don't know if drupal.org does it for the dev branch, but for actual releases it adds in the drupal/core requirement.
Unless it isn't working. It can't hurt to put it in afaik, it's just essentially duplication of code.
Comment #28
rajab natshah#3123996: Check if composer.json is not Drupal 9 compatible, if it exists
Comment #29
grayle commentedIs it specifically for CI that we're trying to fix stuff? Because I'll be honest, don't have too much experience with that thing so chances are that you'll indeed have to add it to composer.json to have it run correctly if something's wonky there.
But I've applied my patch locally, and ran upgrade status (2.9) and it says everything is a-ok.
And I can require this module's 1.3 release in a drupal 9 project as well.
That's in a fresh D9 created with
composer create-project drupal/recommended-project:^9.0 drupal9Comment #30
rajab natshah#12
#22
Comment #31
nord102Re-rolled to accommodate ^8.8 || ^9 for the info.yml > core_version_requirement and composer.json > require
Comment #33
nord102