From ed08c40ab51abb6b4118be9600c0e8f1cda12ae6 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 9 Dec 2021 22:19:03 +0100 Subject: [PATCH] Fix phar build --- composer.json | 2 +- composer.lock | 14 +++++++------- src/Composer/Compiler.php | 28 +++++++++++----------------- 3 files changed, 19 insertions(+), 25 deletions(-) diff --git a/composer.json b/composer.json index 3141e0ad8..432509098 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,7 @@ "justinrainbow/json-schema": "^5.2.11", "psr/log": "^1.0 || ^2.0", "seld/jsonlint": "^1.4", - "seld/phar-utils": "^1.0", + "seld/phar-utils": "^1.2", "symfony/console": "^5.4.1 || ^6.0", "symfony/filesystem": "^5.4 || ^6.0", "symfony/finder": "^5.4 || ^6.0", diff --git a/composer.lock b/composer.lock index 1ddfc319d..90a10ba80 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "274d271909468b2a6c06b562724a1662", + "content-hash": "9c8e9d945b0cbc11f0600b7f0224ac91", "packages": [ { "name": "composer/ca-bundle", @@ -732,16 +732,16 @@ }, { "name": "seld/phar-utils", - "version": "1.1.2", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/Seldaek/phar-utils.git", - "reference": "749042a2315705d2dfbbc59234dd9ceb22bf3ff0" + "reference": "9f3452c93ff423469c0d56450431562ca423dcee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/749042a2315705d2dfbbc59234dd9ceb22bf3ff0", - "reference": "749042a2315705d2dfbbc59234dd9ceb22bf3ff0", + "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/9f3452c93ff423469c0d56450431562ca423dcee", + "reference": "9f3452c93ff423469c0d56450431562ca423dcee", "shasum": "" }, "require": { @@ -774,9 +774,9 @@ ], "support": { "issues": "https://github.com/Seldaek/phar-utils/issues", - "source": "https://github.com/Seldaek/phar-utils/tree/1.1.2" + "source": "https://github.com/Seldaek/phar-utils/tree/1.2.0" }, - "time": "2021-08-19T21:01:38+00:00" + "time": "2021-12-10T11:20:11+00:00" }, { "name": "symfony/console", diff --git a/src/Composer/Compiler.php b/src/Composer/Compiler.php index 7490eb576..5b5e740b3 100644 --- a/src/Composer/Compiler.php +++ b/src/Composer/Compiler.php @@ -50,25 +50,13 @@ class Compiler unlink($pharFile); } - // TODO in v2.3 always call with an array - if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) { - $process = new Process(array('git', 'log', '--pretty="%H"', '-n1', 'HEAD'), __DIR__); - } else { - // @phpstan-ignore-next-line - $process = new Process('git log --pretty="%H" -n1 HEAD', __DIR__); - } + $process = new Process(array('git', 'log', '--pretty=%H', '-n1', 'HEAD'), __DIR__); if ($process->run() != 0) { throw new \RuntimeException('Can\'t run git log. You must ensure to run compile from composer git repository clone and that git binary is available.'); } $this->version = trim($process->getOutput()); - // TODO in v2.3 always call with an array - if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) { - $process = new Process(array('git', 'log', '-n1', '--pretty=%ci', 'HEAD'), __DIR__); - } else { - // @phpstan-ignore-next-line - $process = new Process('git log -n1 --pretty=%ci HEAD', __DIR__); - } + $process = new Process(array('git', 'log', '-n1', '--pretty=%ci', 'HEAD'), __DIR__); if ($process->run() != 0) { throw new \RuntimeException('Can\'t run git log. You must ensure to run compile from composer git repository clone and that git binary is available.'); } @@ -137,8 +125,8 @@ class Compiler $finder->files() ->ignoreVCS(true) ->notPath('/\/(composer\.(json|lock)|[A-Z]+\.md|\.gitignore|appveyor.yml|phpunit\.xml\.dist|phpstan\.neon\.dist|phpstan-config\.neon)$/') - ->notPath('/bin\/(jsonlint|validate-json|simple-phpunit)(\.bat)?$/') - ->notPath('symfony/debug/Resources/ext/') + ->notPath('/bin\/(jsonlint|validate-json|simple-phpunit|phpstan|phpstan\.phar)(\.bat)?$/') + ->notPath('symfony/console/Resources/completion.bash') ->notPath('justinrainbow/json-schema/demo/') ->notPath('justinrainbow/json-schema/dist/') ->notPath('composer/installed.json') @@ -205,7 +193,13 @@ class Compiler $util->updateTimestamps($this->versionDate); $util->save($pharFile, \Phar::SHA512); - Linter::lint($pharFile); + Linter::lint($pharFile, [ + 'vendor/symfony/console/Attribute/AsCommand.php', + 'vendor/symfony/polyfill-intl-grapheme/bootstrap80.php', + 'vendor/symfony/polyfill-intl-normalizer/bootstrap80.php', + 'vendor/symfony/polyfill-mbstring/bootstrap80.php', + 'vendor/symfony/service-contracts/Attribute/SubscribedService.php', + ]); } /**