1
0
Fork 0

Fix phar build

pull/10343/head
Jordi Boggiano 2021-12-09 22:19:03 +01:00
parent 96486d81cb
commit ed08c40ab5
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
3 changed files with 19 additions and 25 deletions

View File

@ -31,7 +31,7 @@
"justinrainbow/json-schema": "^5.2.11", "justinrainbow/json-schema": "^5.2.11",
"psr/log": "^1.0 || ^2.0", "psr/log": "^1.0 || ^2.0",
"seld/jsonlint": "^1.4", "seld/jsonlint": "^1.4",
"seld/phar-utils": "^1.0", "seld/phar-utils": "^1.2",
"symfony/console": "^5.4.1 || ^6.0", "symfony/console": "^5.4.1 || ^6.0",
"symfony/filesystem": "^5.4 || ^6.0", "symfony/filesystem": "^5.4 || ^6.0",
"symfony/finder": "^5.4 || ^6.0", "symfony/finder": "^5.4 || ^6.0",

14
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "274d271909468b2a6c06b562724a1662", "content-hash": "9c8e9d945b0cbc11f0600b7f0224ac91",
"packages": [ "packages": [
{ {
"name": "composer/ca-bundle", "name": "composer/ca-bundle",
@ -732,16 +732,16 @@
}, },
{ {
"name": "seld/phar-utils", "name": "seld/phar-utils",
"version": "1.1.2", "version": "1.2.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/Seldaek/phar-utils.git", "url": "https://github.com/Seldaek/phar-utils.git",
"reference": "749042a2315705d2dfbbc59234dd9ceb22bf3ff0" "reference": "9f3452c93ff423469c0d56450431562ca423dcee"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/749042a2315705d2dfbbc59234dd9ceb22bf3ff0", "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/9f3452c93ff423469c0d56450431562ca423dcee",
"reference": "749042a2315705d2dfbbc59234dd9ceb22bf3ff0", "reference": "9f3452c93ff423469c0d56450431562ca423dcee",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -774,9 +774,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/Seldaek/phar-utils/issues", "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", "name": "symfony/console",

View File

@ -50,25 +50,13 @@ class Compiler
unlink($pharFile); unlink($pharFile);
} }
// TODO in v2.3 always call with an array $process = new Process(array('git', 'log', '--pretty=%H', '-n1', 'HEAD'), __DIR__);
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__);
}
if ($process->run() != 0) { 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.'); 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()); $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__); $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__);
}
if ($process->run() != 0) { 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.'); 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() $finder->files()
->ignoreVCS(true) ->ignoreVCS(true)
->notPath('/\/(composer\.(json|lock)|[A-Z]+\.md|\.gitignore|appveyor.yml|phpunit\.xml\.dist|phpstan\.neon\.dist|phpstan-config\.neon)$/') ->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('/bin\/(jsonlint|validate-json|simple-phpunit|phpstan|phpstan\.phar)(\.bat)?$/')
->notPath('symfony/debug/Resources/ext/') ->notPath('symfony/console/Resources/completion.bash')
->notPath('justinrainbow/json-schema/demo/') ->notPath('justinrainbow/json-schema/demo/')
->notPath('justinrainbow/json-schema/dist/') ->notPath('justinrainbow/json-schema/dist/')
->notPath('composer/installed.json') ->notPath('composer/installed.json')
@ -205,7 +193,13 @@ class Compiler
$util->updateTimestamps($this->versionDate); $util->updateTimestamps($this->versionDate);
$util->save($pharFile, \Phar::SHA512); $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',
]);
} }
/** /**