Skip to content

Commit

Permalink
Fixes acquia#3 Add build option to create phar file
Browse files Browse the repository at this point in the history
  • Loading branch information
Zlender committed Jan 4, 2016
1 parent 351b778 commit 594af43
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 1 deletion.
28 changes: 28 additions & 0 deletions box.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"directories": ["src"],
"files": [
"LICENSE",
"vendor/guzzle/guzzle/src/Guzzle/Http/Resources/cacert.pem"
],
"finder": [
{
"name": "*.php",
"exclude": [
"phing",
"test",
"tests",
"Test",
"Tests",
"Tester"
],
"in": "vendor"
}
],
"git-version": "package_version",
"main": "vendor/autoload.php",
"output": "build/acquia-sdk.phar",
"stub": true,
"shebang": false,
"compression": "GZ",
"algorithm": "SHA1"
}
40 changes: 39 additions & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<property name="builddir" value="${basedir}/build"/>
<property name="composer" value="${builddir}/composer.phar"/>

<target name="build" depends="lint,composer,phploc,pdepend,phpmd-ci,phpcpd,phpunit"/>
<target name="build" depends="lint,composer,phploc,pdepend,phpmd-ci,phpcpd,phpunit,phar"/>

<target name="clean" description="Cleanup build artifacts">
<delete dir="${builddir}"/>
Expand Down Expand Up @@ -68,6 +68,27 @@
</exec>
</target>

<target name="box-check" depends="prepare">
<available file="${builddir}/box.phar" property="box.present"/>
</target>

<target name="box-download" unless="box.present">
<property name="box.noupdate" value="true"/>
<get src="https://box-project.github.io/box2/installer.php" dest="${builddir}/installer.php"/>
<exec executable="php" dir="${builddir}">
<arg value="installer.php"/>
</exec>
<delete file="${builddir}/installer.php"/>
</target>

<target name="box-update" unless="box.noupdate">
<exec executable="php">
<arg value="${builddir}/box.phar"/>
<arg value="update"/>
<arg value="--quiet"/>
</exec>
</target>

<target name="phploc" depends="composer" description="Measure project size using PHPLOC">
<exec executable="${basedir}/vendor/bin/phploc">
<arg value="--log-csv" />
Expand Down Expand Up @@ -115,4 +136,21 @@
<exec executable="${basedir}/vendor/bin/phpunit" failonerror="true"/>
</target>

<target name="phar" depends="composer,box-check,box-download,box-update" description="Build phar">
<exec executable="php">
<arg value="${builddir}/composer.phar"/>
<arg value="install"/>
<arg value="--no-dev"/>
<arg value="--quiet"/>
</exec>
<exec executable="${builddir}/box.phar">
<arg value="build"/>
</exec>
<exec executable="php">
<arg value="${builddir}/composer.phar"/>
<arg value="install"/>
<arg value="--quiet"/>
</exec>
</target>

</project>

0 comments on commit 594af43

Please sign in to comment.