From f5db191c8ef1d6a8918954ecae0a7d8037b13ade Mon Sep 17 00:00:00 2001 From: David Zuelke Date: Fri, 22 Nov 2024 17:25:02 -0500 Subject: [PATCH] Allow latest Composer if no lock file present We're bumping the plugin-api-version for the no lock file present case to allow Composer 2.8 which works with PHP 8.4 (to allow clean boots, and builds without deprecation errors). This is a very inconsequential change for users that have no lock file, as no lock file means no package installs, plugins, etc. --- CHANGELOG.md | 4 ++++ bin/util/platform.php | 4 +++- test/spec/composer-2_spec.rb | 6 +++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b44cebb15..e07cf73f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ - PHP/8.4.1 [David Zuelke] +### CHG + +- Use latest Composer (instead of 2.2 LTS) if no lock file is present [David Zuelke] + ## [v259] - 2024-11-21 ### ADD diff --git a/bin/util/platform.php b/bin/util/platform.php index c744dfbc2..817cc2e7d 100755 --- a/bin/util/platform.php +++ b/bin/util/platform.php @@ -194,7 +194,9 @@ function mkmetas($package, array &$metapaks, &$have_runtime_req = false) { if($metapaks) $repositories[] = ["type" => "package", "package" => $metapaks]; } else { // default to using Composer 2 if there is no lock file - $lock["plugin-api-version"] = "2.2.0"; + // 2.6.0 will allow any current 2.x Composer version (see further below), which means 2.8 is possible + // that matters because the LTS Composer 2.2 (which we'd get if we used "2.2.0" here) throws countless deprecation warnings + $lock["plugin-api-version"] = "2.6.0"; } // if no PHP is required anywhere, we need to add something diff --git a/test/spec/composer-2_spec.rb b/test/spec/composer-2_spec.rb index 65d32f0be..5f13a4fe9 100644 --- a/test/spec/composer-2_spec.rb +++ b/test/spec/composer-2_spec.rb @@ -43,10 +43,10 @@ end end context "with only an index.php" do - it "builds using Composer 2.2" do + it "builds using Composer 2.3 or later" do new_app_with_stack_and_platrepo('test/fixtures/default').deploy do |app| - expect(app.output).to match(/- composer \(2\.2\./) - expect(app.output).to match(/Composer version 2\.2\./) + expect(app.output).to match(/- composer \(2\.([3-9]|\d{2,})\./) + expect(app.output).to match(/Composer version 2\.([3-9]|\d{2,}\.)/) end end end