1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-02 09:37:59 +01:00

Simplify the PHAR build script

This commit is contained in:
Théo FIDRY 2018-04-08 18:36:29 +02:00 committed by Matthew Brown
parent 3119a1f68a
commit 59d32566d2
6 changed files with 32 additions and 79 deletions

20
.gitignore vendored
View File

@ -1,9 +1,11 @@
vendor/ /bin/psalm.phar
.DS_Store /vendor/
phpunit.xml /.DS_Store
composer.lock /.php_cs.cache
.php_cs.cache /.php_cs
.php_cs /.*.swp
.*.swp /.*.swo
.*.swo /composer.lock
/build/logs/ /phpunit.xml
/vendor-bin/*/composer.lock
/vendor-bin/*/vendor/

View File

@ -4,34 +4,8 @@ if ! php -r 'extension_loaded("bz2") or exit(1);' ; then
exit 1 exit 1
fi fi
composer global require 'humbug/php-scoper:^1.0@dev' composer bin box install
composer global require 'humbug/box:3.0.0-alpha.0'
composer install --no-dev
[ -d build ] || mkdir build
[ -d build/psalm ] || mkdir build/psalm
# increase FD limit, or Phar compression will fail
ulimit -Sn 4096
rm -f bin/psalm.phar vendor/bin/box compile
# Prefixes the code to be bundled bin/psalm.phar --config=bin/phar.psalm.xml --root=src
php -d memory_limit=-1 `which php-scoper` add-prefix --prefix='PsalmPhar' --output-dir=build/psalm --force
# Re-dump the loader to account for the prefixing
# and optimize the loader
composer dump-autoload --working-dir=build/psalm --classmap-authoritative --no-dev
chmod 755 build/psalm/psalm
cp bin/phar.psalm.xml build/psalm/psalm.xml
./build/psalm/psalm --config=build/psalm/psalm.xml --root=build/psalm
php -d memory_limit=-1 -d phar.readonly=0 `which box` compile
# clean up build
rm -Rf build/psalm
# reinstall deps (to regenerate autoloader and bring back dev deps)
rm -Rf vendor/*
composer install

View File

@ -1,23 +1,20 @@
{ {
"alias": "psalm.phar", "main" : "psalm",
"base-path": "build/psalm", "output" : "bin/psalm.phar",
"main" : "./psalm",
"output" : "../../build/psalm.phar",
"directories" : [ "directories" : [
"assets", "assets",
"src",
"vendor" "vendor"
], ],
"finder": [
{
"in" : "src"
}
],
"files" : [ "files" : [
"composer.json",
"composer.lock",
"config.xsd" "config.xsd"
], ],
"intercept" : false, "intercept" : false,
"compactors" : [], "compactors" : [
"KevinGH\\Box\\Compactor\\PhpScoper"
],
"chmod" : "0755", "chmod" : "0755",
"shebang" : "#!/usr/bin/env php", "compression": "GZ"
"stub" : true
} }

View File

@ -35,7 +35,8 @@
"phpunit/phpunit": "^5.7.4", "phpunit/phpunit": "^5.7.4",
"friendsofphp/php-cs-fixer": "^2.3|^2.4|^2.5|^2.6|^2.7|^2.8|^2.9", "friendsofphp/php-cs-fixer": "^2.3|^2.4|^2.5|^2.6|^2.7|^2.8|^2.9",
"squizlabs/php_codesniffer": "^3.0", "squizlabs/php_codesniffer": "^3.0",
"php-coveralls/php-coveralls": "^2.0" "php-coveralls/php-coveralls": "^2.0",
"bamarni/composer-bin-plugin": "^1.2"
}, },
"suggest": { "suggest": {
"ext-igbinary": "^2.0.5" "ext-igbinary": "^2.0.5"

View File

@ -1,34 +1,6 @@
<?php <?php
use Isolated\Symfony\Component\Finder\Finder;
return [ return [
'finders' => [
Finder::create()->files()->in('src'),
Finder::create()->files()->in('assets'),
Finder::create()
->files()
->ignoreVCS(true)
->notName('/LICENSE|.*\\.md|.*\\.dist|Makefile|composer\\.json|composer\\.lock/')
->exclude([
'doc',
'test',
'test_old',
'tests',
'Tests',
'vendor-bin',
])
->in('vendor'),
Finder::create()->append([
'composer.json',
'composer.lock',
'config.xsd',
'psalm'
]),
],
'whitelist' => [
],
'patchers' => [ 'patchers' => [
function ($filePath, $prefix, $contents) { function ($filePath, $prefix, $contents) {
// //

View File

@ -0,0 +1,7 @@
{
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"humbug/box": "dev-master"
}
}