Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
175 lines (145 sloc) 6.01 KB
<project name="Autoload" default="build" basedir=".">
<target name="clean" description="Cleanup build artifacts">
<delete dir="${basedir}/build/api"/>
<delete dir="${basedir}/build/code-browser"/>
<delete dir="${basedir}/build/coverage"/>
<delete dir="${basedir}/build/logs"/>
<delete dir="${basedir}/build/pdepend"/>
<delete dir="${basedir}/build/phar/_tmp" />
<delete>
<fileset dir="${basedir}/build/phar">
<include name="**/*.phar" />
</fileset>
</delete>
<mkdir dir="${basedir}/build/logs"/>
<mkdir dir="${basedir}/build/pdepend"/>
</target>
<!-- Run unit tests and generate junit.xml and clover.xml -->
<target name="phpunit">
<exec executable="phpunit" failonerror="true"/>
</target>
<!-- Run pdepend, phpmd, phpcpd, and phpcs in parallel -->
<target name="parallelTasks">
<parallel>
<antcall target="pdepend"/>
<antcall target="phpmd"/>
<antcall target="phpcpd"/>
<antcall target="phpcs"/>
</parallel>
</target>
<!-- Generate jdepend.xml and software metrics charts -->
<target name="pdepend">
<exec executable="pdepend">
<arg line="--jdepend-xml=${basedir}/build/logs/jdepend.xml
--jdepend-chart=${basedir}/build/pdepend/dependencies.svg
--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg
src"/>
</exec>
</target>
<!-- Generate pmd.xml -->
<target name="phpmd">
<exec executable="phpmd">
<arg line="src xml codesize,design,naming,unusedcode --reportfile ${basedir}/build/logs/pmd.xml"/>
</exec>
</target>
<!-- Generate pmd-cpd.xml -->
<target name="phpcpd">
<exec executable="phpcpd">
<arg line="--log-pmd ${basedir}/build/logs/pmd-cpd.xml src"/>
</exec>
</target>
<!-- Generate checkstyle.xml -->
<target name="phpcs">
<exec executable="phpcs" output="/dev/null">
<arg line="--report=checkstyle
--report-file=${basedir}/build/logs/checkstyle.xml
--standard=${basedir}/phpcs.xml
src"/>
</exec>
</target>
<target name="phpab" description="Generate autoloader scripts">
<exec executable="${basedir}/phpab.php">
<arg value="--output"/>
<arg path="src/autoload.php"/>
<arg value="--basedir"/>
<arg path="src"/>
<arg path="composer.json"/>
</exec>
</target>
<target name="pear" depends="phar" description="Create a PEAR archive">
<delete dir="${basedir}/build/pear/_tmp"/>
<mkdir dir="${basedir}/build/pear/_tmp"/>
<exec executable="bash" outputproperty="version">
<arg value="-c" />
<arg value="git describe --tags --dirty" />
</exec>
<move file="${basedir}/build/phar/phpab-${version}.phar" tofile="${basedir}/build/pear/_tmp/phpab.phar" />
<copy todir="${basedir}/build/pear/_tmp">
<fileset dir="${basedir}">
<include name="phpab.bat"/>
<include name="package.xml" />
</fileset>
</copy>
<replace file="${basedir}/build/pear/_tmp/package.xml" token="%release%" value="${version}" />
<exec executable="bash" dir="${basedir}/build/pear/_tmp">
<arg value="-c" />
<arg value="pear package" />
</exec>
<move file="${basedir}/build/pear/_tmp/Autoload-${version}.tgz" todir="${basedir}/build/pear" />
<delete dir="${basedir}/build/pear/_tmp"/>
</target>
<target name="phar" description="Create PHAR archive of Autoload Builder and its dependencies">
<delete dir="${basedir}/build/phar/_tmp"/>
<mkdir dir="${basedir}/build/phar/_tmp"/>
<delete>
<fileset dir="${basedir}/build/phar">
<include name="**/*.phar" />
</fileset>
</delete>
<exec executable="bash" outputproperty="version">
<arg value="-c" />
<arg value="git describe --tags --dirty" />
</exec>
<copy todir="${basedir}/build/phar/_tmp/vendor">
<fileset dir="${basedir}/vendor">
<include name="theseer/directoryscanner/src/**" />
<include name="zetacomponents/console-tools/src/**" />
<include name="zetacomponents/base/src/**" />
</fileset>
</copy>
<copy todir="${basedir}/build/phar/_tmp/phpab">
<fileset dir="${basedir}/src"/>
</copy>
<delete>
<fileset dir="${basedir}/build/phar/_tmp">
<include name="**/autoload.php"/>
<include name="**/Autoload.php"/>
<include name="**/Autoload.php.in"/>
<include name="**/package.sig"/>
<include name="**/package.xml"/>
<include name="**/composer.json"/>
<include name="**/*.md"/>
<include name="**/docs/**"/>
<include name="**/design/**"/>
<include name="**/grammar/**"/>
</fileset>
</delete>
<exec executable="${basedir}/phpab.php" failonerror="true">
<arg value="--var" />
<arg value="VERSION=${version}" />
<arg value="--all" />
<arg value="--alias" />
<arg value="phpab.phar" />
<arg value="--phar" />
<arg value="--gzip" />
<arg value="--output" />
<arg path="${basedir}/build/phar/phpab-${version}.phar" />
<arg value="--template" />
<arg path="${basedir}/build/phar/autoload.php.in" />
<arg path="${basedir}/build/phar/_tmp" />
</exec>
<chmod file="${basedir}/build/phar/phpab-${version}.phar" perm="ugo+rx"/>
<delete dir="${basedir}/build/phar/_tmp" />
</target>
<target name="build" depends="clean,parallelTasks,phpunit"/>
</project>
Jump to Line
Something went wrong with that request. Please try again.