From e25f8c486d7228cc9a3460cc7b83d681b23567c2 Mon Sep 17 00:00:00 2001 From: MergeBot Date: Thu, 31 Mar 2022 11:45:07 +0100 Subject: [PATCH] Fix PHP Gherkin->Messages dependency When messages 18.0.0 was released, the constraint in gherkin/php/composer.json was changed to `dev-main||^17.0,^18.0`. This is incorrect because `,` is AND. It should have been `dev-main||^17.0||^18.0` Pre-release of gherkin 23.0.0 removed the dev-main and left it as `^17.0,^18.0`. Despite visual inspection by me this was approved and released. It is currently uninstallable. This removes the script that got rid of 'dev-main', fixes the constraint by removing `^17.0` as there is no php tag for that, and updates the messages script that adds new versions. Fixing this will require a `23.0.1` tag :/ The other issue was builds on main failing. This is because the local 'path repository' that makes gherkin install messages from local filesystem is unable to tell what version the checkout is. It's now forced to be 18.0.0 and only needs updating when gherkin breaks backward support for messages --- gherkin/php/Makefile | 8 -------- gherkin/php/composer.json | 9 +++++++-- messages/php/scripts/update-gherkin-dependency.php | 5 +++-- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/gherkin/php/Makefile b/gherkin/php/Makefile index d2e83af1b5..a82e7b5c75 100644 --- a/gherkin/php/Makefile +++ b/gherkin/php/Makefile @@ -16,14 +16,6 @@ default: .compared .compared: .deps $(TOKENS) $(SOURCES) $(ASTS) $(PICKLES) $(ERRORS) touch $@ -pre-release: remove-messages-dev-dependency - -remove-messages-dev-dependency: - # dependency on messages is like 'dev-main||^12.0,^13.0,...etc - jq '.require["cucumber/messages"] |= sub("dev-main(\\|\\|)?";"")' --indent 4 < composer.json > composer.json.new - mv composer.json.new composer.json -.PHONY: remove-messages-dev-dependency - acceptance/testdata/%.feature.tokens: testdata/%.feature testdata/%.feature.tokens mkdir -p $(@D) bin/gherkin-generate-tokens $< > $@ diff --git a/gherkin/php/composer.json b/gherkin/php/composer.json index 97d5bc14a9..6d7f5b562d 100644 --- a/gherkin/php/composer.json +++ b/gherkin/php/composer.json @@ -15,7 +15,7 @@ "require": { "php": "^8.1", "ext-mbstring": "*", - "cucumber/messages": "^17.0,^18.0" + "cucumber/messages": "^18.0" }, "require-dev": { "phpunit/phpunit": "^9.5", @@ -26,7 +26,12 @@ "repositories": [ { "type": "path", - "url": "../../messages/php" + "url": "../../messages/php", + "options": { + "versions": { + "cucumber/messages": "18.0.0" + } + } } ] } diff --git a/messages/php/scripts/update-gherkin-dependency.php b/messages/php/scripts/update-gherkin-dependency.php index 85db9851d0..e586966ac3 100644 --- a/messages/php/scripts/update-gherkin-dependency.php +++ b/messages/php/scripts/update-gherkin-dependency.php @@ -38,14 +38,15 @@ } // like ^21.0 (same as >=21.0.0 <22.0.0) -$newDependency = ',^'.$matches['major'].'.0'; +$newDependency = '^'.$matches['major'].'.0'; if (str_contains($dependencyString, $newDependency)) { fwrite(STDERR, 'Nothing to update, already depends on ' . $newDependency . "\n"); $newDependency = ''; } -$newDependencyString = $dependencyString . $newDependency; +// '||' is OR +$newDependencyString = $dependencyString . '||' .$newDependency; $json['require']['cucumber/messages'] = $newDependencyString;