Skip to content

Commit 370e4d9

Browse files
committed
Define the package target to build a phar archive
1 parent 0bc529a commit 370e4d9

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

Makefile

+18-1
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,23 @@ phpunit: tools/phpunit
4141
tools/phpunit
4242
.PHONY: phpunit
4343

44-
tools: tools/php-cs-fixer tools/deptrac tools/infection
44+
tools: tools/php-cs-fixer tools/deptrac tools/infection tools/phpab
4545
.PHONY: tools
4646

47+
package: install tools/phpab
48+
$(eval VERSION=$(shell git describe --abbrev=0 --tags 2> /dev/null | sed -e 's/^v//' || echo 'dev'))
49+
@echo $(VERSION)
50+
rm -rf build/phar && mkdir -p build/phar
51+
cp LICENSE build/phar/
52+
sed -e 's/@@version@@/$(VERSION)/g' manifest.xml.in > build/phar/manifest.xml
53+
mkdir -p build/phar/zalas-phpunit-injector-extension && cp -r src build/phar/zalas-phpunit-injector-extension/
54+
ifeq ($(CI),true)
55+
tools/phpab --all --static --once --phar --key .travis/phpunit-injector-extension-private.pem --output build/zalas-phpunit-injector-extension.phar build/phar
56+
else
57+
tools/phpab --all --static --once --phar --output build/zalas-phpunit-injector-extension-$(VERSION).phar build/phar
58+
endif
59+
.PHONY: package
60+
4761
vendor: install
4862

4963
vendor/bin/phpunit: install
@@ -62,3 +76,6 @@ tools/infection: tools/infection.pubkey
6276

6377
tools/infection.pubkey:
6478
curl -Ls https://github.com/infection/infection/releases/download/0.8.1/infection.phar.pubkey -o tools/infection.pubkey
79+
80+
tools/phpab:
81+
curl -Ls https://github.com/theseer/Autoload/releases/download/1.24.1/phpab-1.24.1.phar -o tools/phpab && chmod +x tools/phpab

manifest.xml.in

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<phar xmlns="https://phar.io/xml/manifest/1.0">
3+
<contains name="zalas/phpunit-injector" version="@@version@@" type="extension">
4+
<extension for="phpunit/phpunit" compatible="^7.0"/>
5+
</contains>
6+
7+
<copyright>
8+
<author name="Jakub Zalas" email="[email protected]"/>
9+
<license type="MIT" url="https://github.com/jakzal/phpunit-injector/blob/master/LICENSE"/>
10+
</copyright>
11+
12+
<requires>
13+
<php version="^7.1"/>
14+
</requires>
15+
</phar>

0 commit comments

Comments
 (0)