如何为PHPUnit构建自己的phar存档?

时间:2014-03-04 02:04:57

标签: phpunit phar

我从Github下载了当前版本的PHPUnit并做了一个小的自定义。我现在想为它创建自己的phar存档。我看到有a build.xml file included with PHPUnit that looks like it contains the directives needed for creation of the phar archive,但在阅读了phar之后,我仍然不清楚PHPUnit会发生什么命令。任何建议表示赞赏!

1 个答案:

答案 0 :(得分:2)

克隆回购。我想你已经有了这个但是要完整

$ git clone https://github.com/sebastianbergmann/phpunit

改变它

$ cd phpunit

build.xml文件(大多数)意味着Ant用作构建管理系统。要弄清楚项目(-p)提供哪些目标,只需问问自己:

$ ant -p

然后你应该得到这个输出:

Buildfile: /private/tmp/phpunit/build.xml

Main targets:

clean       Cleanup build artifacts
composer    Install dependencies with Composer
pdepend     Calculate software metrics using PHP_Depend
pear        Create PEAR package of PHPUnit and all its dependencies (release)
phar        Create PHAR archive of PHPUnit and all its dependencies (release)
phar-alpha  Create PHAR archive of PHPUnit and all its dependencies (alpha)
phar-beta   Create PHAR archive of PHPUnit and all its dependencies (beta)
phpab       Generate autoloader script
phpcpd      Find duplicate code using PHPCPD
phpcs       Find coding standard violations using PHP_CodeSniffer
phpcs-ci    Find coding standard violations using PHP_CodeSniffer
phpdox      Generate software project documentation using phpDox
phploc      Measure project size using PHPLOC
phpmd       Perform project mess detection using PHPMD
phpmd-ci    Perform project mess detection using PHPMD
phpunit     Run unit tests with PHPUnit
prepare     Prepare for build

Default target: build

其余的很简单 - 只需输入

即可

$ ant phar

该任务将安装Composer(即使您已经拥有它,但将其复制到当前文件夹中)并下载所有依赖项。