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

Fix PHP Gherkin->Messages dependency #1943

Merged
merged 1 commit into from
Mar 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 0 additions & 8 deletions gherkin/php/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 $< > $@
Expand Down
9 changes: 7 additions & 2 deletions gherkin/php/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -26,7 +26,12 @@
"repositories": [
{
"type": "path",
"url": "../../messages/php"
"url": "../../messages/php",
"options": {
"versions": {
"cucumber/messages": "18.0.0"
}
}
}
]
}
5 changes: 3 additions & 2 deletions messages/php/scripts/update-gherkin-dependency.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down