1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +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/
.DS_Store
phpunit.xml
composer.lock
.php_cs.cache
.php_cs
.*.swp
.*.swo
/build/logs/
/bin/psalm.phar
/vendor/
/.DS_Store
/.php_cs.cache
/.php_cs
/.*.swp
/.*.swo
/composer.lock
/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
fi
composer global require 'humbug/php-scoper:^1.0@dev'
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
composer bin box install
rm -f bin/psalm.phar
vendor/bin/box compile
# Prefixes the code to be bundled
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
bin/psalm.phar --config=bin/phar.psalm.xml --root=src

View File

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

View File

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

View File

@ -1,34 +1,6 @@
<?php
use Isolated\Symfony\Component\Finder\Finder;
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' => [
function ($filePath, $prefix, $contents) {
//

View File

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