Skip to content

Commit

Permalink
Merge pull request #10 from Qafoo/feat/phpab
Browse files Browse the repository at this point in the history
Create phpab extension
  • Loading branch information
jakobwesthoff committed May 30, 2012
2 parents 744910a + 03fe7ef commit f705057
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/resources/defaults.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ phpmd.enabled = true

phpunit.enabled = true

; phpab is a nice tool but not used for all projects, therefore it is off by
; default
phpab.enabled = false

;;;
; Different JavaScript related QA extensions
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/extensions/phpab/phpab.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
phpab.output.src=${commons.srcdir.php}/autoload.php
phpab.output.test=${commons.testdir.php}/autoload.php
127 changes: 127 additions & 0 deletions src/main/xml/exts/phpab.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="ant-build-commons-extensions-phpab" basedir=".">

<!--
Import default properties for this extension.
-->
<property file="${resourcedir}/extensions/phpab/phpab.properties" />

<!--
Import utilized extensions
-->
<import file="enabled.xml" />
<import file="availability.xml" />
<import file="pear.xml" />

<!--
Shortcut for the "phpab:phpab" target
-->
<target name="phpab" depends="phpab:phpab" />

<!--
Execute the phpab task only, if a php source directory is available
-->
<target name="phpab:phpab">
<common.enabled.antcall target="-phpab:phpab"
property="phpab.enabled" />
</target>

<!--
Runs the phpab cli tool against the project source code.
-->
<target name="-phpab:phpab"
depends="-phpab:install-or-upgrade,
-phpab:before~hook,
-phpab:run,
-phpab:after~hook" />

<!--
Remove old generted phpab autoload files
May be called as a static entry point for cleanup
-->
<target name="phpab:clean">
<delete file="${phpab.output.src}" />
<delete file="${phpab.output.test}" />
</target>

<!--
Run phpab on the php src as well as testdir
-->
<target name="-phpab:run"
depends="phpab:clean,
-phpab:run-src,
-phpab:run-test" />

<!--
This target runs phpab against the project's source code and generates
the requested autoload file.
-->
<target name="-phpab:run-src"
depends="availability:php-srcdir-is-available"
if="availability:php-srcdir-is-available">
<exec executable="${commons.executable.php}"
failonerror="true"
taskname="phpab" >
<arg value="-d" />
<arg value="include_path=${pear.local.include.path}" />
<arg value="${pear.local.bindir}/phpab" />
<arg value="--output" />
<arg value="${phpab.output.src}" />
<arg value="${commons.srcdir.php}" />
</exec>
</target>

<!--
This target runs phpab against the project's test code and generates
the requested autoload file.
-->
<target name="-phpab:run-test"
depends="availability:php-testdir-is-available"
if="availability:php-testdir-is-available">
<exec executable="${commons.executable.php}"
failonerror="true"
taskname="phpab" >
<arg value="-d" />
<arg value="include_path=${pear.local.include.path}" />
<arg value="${pear.local.bindir}/phpab" />
<arg value="--output" />
<arg value="${phpab.output.test}" />
<arg value="${commons.testdir.php}" />
</exec>
</target>

<!--
This target tries to a) install phpab if it isn't already installed
in the project's local pear installation or b) upgrade a previous
installed version of phpab.
-->
<target name="-phpab:install-or-upgrade">
<antcall target="-pear:package-install-or-upgrade">
<param name="in.pear.package.file" value="phpab" />
<param name="in.pear.package.name" value="Autoload" />
<param name="in.pear.package.channel" value="pear.netpirates.net" />
</antcall>
</target>

<!--
Extension point that can be used by a build file to add additional build
steps right before the build environment starts the phpab cli script.
-->
<extension-point name="-phpab:before~hook" />

<!--
Extension point that can be used by a build file to add additional build
steps after the build environment has complete the phpab creation.
-->
<extension-point name="-phpab:after~hook" />

<!--
Hook phpab into the build process. It should be executed right after
the compile step.
-->
<target name="-phpab:compile:after~hooked"
extensionOf="-compile:after~hook"
depends="phpab:phpab" />

</project>

0 comments on commit f705057

Please sign in to comment.