Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate phar file #35

Merged
merged 1 commit into from
Jun 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/composer.lock
/vendor/
/bin/box.phar
/build
14 changes: 13 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,16 @@ php:
- '7.1'
- '7.2'

script: make check
script:
- make check
- make dist

deploy:
provider: releases
api_key: $GITHUB_API_KEY
file_glob: true
file: build/*
skip_cleanup: true
on:
tags: true
php: '7.1'
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,12 @@ integration-tests: vendor
coding-standards: vendor
vendor/bin/phpcs -p --colors
vendor/bin/phpmd src/ text phpmd.xml

bin/box.phar:
curl -LS https://github.com/humbug/box/releases/download/3.0.0-beta.3/box.phar -o bin/box.phar
chmod a+x bin/box.phar

dist: bin/box.phar
mkdir build
bin/box.phar compile

16 changes: 16 additions & 0 deletions box.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"chmod": "0755",
"directories": [

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src and vendor should be unnecessary here, but it requires to make sure there is a composer.lock and that the dependencies have been installed (Box can remove the dev deps so a plain composer install is enough)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@theofidry thanks for the hint, and sorry for the late reply. I noticed that our phar was quite big (18.5 MB) because of dev dependencies so I have been playing a bit with the box.json. It seems that the removal of dev dependencies does not occur when we specify the vendor directory in the directories key of box.json, is that correct?

Unfortunately, it seems that if I remove src and vendor from the directories list, they are excluded from the phar altogether (except for vendor which only contains autoload.php and the composer directory). If I omit the directories key completely, the src and vendor directories are included correctly but the config directory is missing. This seems to be according the documentation, but doesn't really work for us.

Is there any way to include the config directory but still let Box remove our dev dependencies? Specifying it using directories-bin seems to work, but that feels a bit like abusing the option.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that the removal of dev dependencies does not occur when we specify the vendor directory in the directories key of box.json, is that correct?

Yes, a typical case justifying that behaviour is one that may need to actually include a dev-only directory from vendor to the PHAR.

I think directories-bin is correct: it doesn't need to be processed per se. The issue is if you start to use directories it's the sign for box that you wanna manage your dependencies more manually.

"src",
"config",
"vendor"
],
"files": [
"LICENSE.txt",
"README.md"
],
"git-version": "package_version",
"main": "bin/release",
"output": "build/release-tool.phar",
"stub": true
}