PHP Classes

File: build.xml

Recommend this page to a friend!
  Classes of Maik Greubel   Caribu Console   build.xml   Download  
File: build.xml
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Caribu Console
Read and process console shell commands
Author: By
Last change:
Date: 6 years ago
Size: 12,116 bytes
 

Contents

Class file image Download
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE project> <project name="caribu-console" default="build"> <property name="builddir" value="${basedir}/build" /> <property name="logdir" value="${builddir}/logs" /> <property name="vendordir" value="${basedir}/vendor" /> <property name="srcdir" value="${basedir}/src" /> <property name="testsdir" value="${basedir}/tests"/> <property name="phpbin" value="php"/> <!-- ========================================================================================================= --> <macrodef name="call-php"> <attribute name="failOnError" default="true"/> <element name="extArgs" optional="n"/> <sequential> <exec executable="${phpbin}" resultproperty="exitcode" failonerror="@{failOnError}"> <extArgs/> </exec> </sequential> </macrodef> <!-- ========================================================================================================= --> <!-- Default build target --> <target name="build" depends="prepare,update-deps,lint,phploc-ci,pdepend,phpmd-ci,phpcs-ci,phpcpd-ci,phpunit,phpdox" description="Run a default build" /> <!-- Parallel build target --> <target name="build-parallel" depends="prepare,update-deps,lint,tools-parallel,phpunit,phpdox" description="Run a parallel executing tasks build" /> <!-- Perform a build without without updating the dependencies --> <target name="no-update" depends="prepare,lint,tools-parallel,phpunit,phpdox" description="Runs build without updating dependencies" /> <!-- ========================================================================================================= --> <!-- Clean the build directory --> <target name="clean" unless="clean.done" description="Cleanup build artifacts"> <delete dir="${builddir}/api" /> <delete dir="${builddir}/coverage" /> <delete dir="${logdir}" /> <delete dir="${builddir}/pdepend" /> <delete dir="${builddir}/phpdox" /> <property name="clean.done" value="true" /> </target> <!-- ========================================================================================================= --> <!-- Retrieve composer.phar --> <target name="get-composer" description="Retrieve composer from remote"> <get src="https://getcomposer.org/composer.phar" dest="composer.phar"/> </target> <!-- Update the dependencies using composer (enabled by default) --> <target name="update-deps" depends="get-composer" description="Runs build including updating depedendencies"> <call-php> <extargs> <arg value="composer.phar" /> <arg value="-v" /> <arg value="-n" /> <arg value="update" /> </extargs> </call-php> </target> <!-- ========================================================================================================= --> <!-- Perform a parallel build of various tasks --> <target name="tools-parallel" description="Run tools in parallel"> <parallel threadCount="2"> <sequential> <antcall target="pdepend" /> <antcall target="phpmd-ci" /> </sequential> <antcall target="phpcpd-ci" /> <antcall target="phpcs-ci" /> <antcall target="phploc-ci" /> </parallel> </target> <!-- Prepare task --> <target name="prepare" unless="prepare.done" depends="clean" description="Prepare for build by creating essential directories"> <mkdir dir="${builddir}/api" /> <mkdir dir="${builddir}/coverage" /> <mkdir dir="${logdir}" /> <mkdir dir="${builddir}/pdepend" /> <mkdir dir="${builddir}/phpdox" /> <property name="prepare.done" value="true" /> </target> <!-- ========================================================================================================= --> <!-- General source code syntax check --> <target name="lint" description="Perform syntax check of sourcecode files"> <apply executable="${phpbin}" failonerror="false"> <arg value="-l" /> <fileset dir="${srcdir}"> <include name="**/*.php" /> <modified /> </fileset> <fileset dir="${testsdir}"> <include name="**/*.php" /> <modified /> </fileset> </apply> </target> <!-- ========================================================================================================= --> <!-- Lines of code check --> <target name="phploc" description="Measure project size using PHPLOC and print human readable output. Intended for usage on the command line."> <call-php> <extargs> <arg value="${vendordir}/phploc/phploc/phploc"/> <arg value="--count-tests" /> <arg path="${srcdir}" /> <arg path="${testsdir}" /> </extargs> </call-php> </target> <!-- ========================================================================================================= --> <!-- Lines of code check for continous integration --> <target name="phploc-ci" depends="prepare" description="Measure project size using PHPLOC and log result in CSV and XML format. Intended for usage within a continuous integration environment."> <call-php> <extargs> <arg value="${vendordir}/phploc/phploc/phploc"/> <arg value="--count-tests" /> <arg value="--log-csv" /> <arg path="${logdir}/phploc.csv" /> <arg value="--log-xml" /> <arg path="${logdir}/phploc.xml" /> <arg path="${srcdir}" /> <arg path="${testsdir}" /> </extargs> </call-php> </target> <!-- ========================================================================================================= --> <!-- Metrics calculation --> <target name="pdepend" depends="prepare" description="Calculate software metrics using PHP_Depend and log result in XML format. Intended for usage within a continuous integration environment."> <call-php failOnError="false"> <extargs> <arg value="${vendordir}/pdepend/pdepend/src/bin/pdepend"/> <arg value="--jdepend-xml=${logdir}/jdepend.xml" /> <arg value="--jdepend-chart=${builddir}/pdepend/dependencies.svg" /> <arg value="--overview-pyramid=${builddir}/pdepend/overview-pyramid.svg" /> <arg path="${srcdir}" /> </extargs> </call-php> </target> <!-- ========================================================================================================= --> <!-- Mess detection --> <target name="phpmd" description="Perform project mess detection using PHPMD and print human readable output. Intended for usage on the command line before committing."> <call-php> <extargs> <arg value="${vendordir}/phpmd/phpmd/src/bin/phpmd"/> <arg path="${srcdir}" /> <arg value="text" /> <arg path="${basedir}/phpmd.xml" /> </extargs> </call-php> </target> <!-- ========================================================================================================= --> <!-- Mess detection for command line --> <target name="phpmd-ci" depends="prepare" description="Perform project mess detection using PHPMD and log result in XML format. Intended for usage within a continuous integration environment."> <call-php failOnError="false"> <extargs> <arg value="${vendordir}/phpmd/phpmd/src/bin/phpmd"/> <arg path="${srcdir}" /> <arg value="xml" /> <arg path="${basedir}/phpmd.xml" /> <arg value="--reportfile" /> <arg path="${logdir}/pmd.xml" /> </extargs> </call-php> </target> <!-- ========================================================================================================= --> <!-- Checkstyle for continous integration --> <target name="phpcs-ci" depends="prepare" description="Find coding standard violations using PHP_CodeSniffer and log result in XML format. Intended for usage within a continuous integration environment."> <call-php failOnError="false"> <extargs> <arg value="${vendordir}/squizlabs/php_codesniffer/bin/phpcs"/> <arg value="--report=checkstyle" /> <arg value="--report-file=${logdir}/checkstyle.xml" /> <arg value="--standard=PSR2" /> <arg value="--extensions=php" /> <arg value="--ignore=autoload.php" /> <arg path="${srcdir}" /> </extargs> </call-php> </target> <!-- ========================================================================================================= --> <!-- Copy&Paste detection --> <target name="phpcpd" description="Find duplicate code using PHPCPD and print human readable output. Intended for usage on the command line before committing." > <call-php failOnError="false"> <extargs> <arg value="${vendordir}/sebastian/phpcpd/phpcpd"/> <arg path="${srcdir}" /> </extargs> </call-php> </target> <!-- ========================================================================================================= --> <!-- Copy&Paste detection for continous integration --> <target name="phpcpd-ci" depends="prepare" description="Find duplicate code using PHPCPD and log result in XML format. Intended for usage within a continuous integration environment."> <call-php failOnError="false"> <extargs> <arg value="${vendordir}/sebastian/phpcpd/phpcpd"/> <arg value="--log-pmd" /> <arg path="${logdir}/pmd-cpd.xml" /> <arg path="${srcdir}" /> </extargs> </call-php> </target> <!-- ========================================================================================================= --> <!-- PHPUnit --> <target name="phpunit" depends="prepare" description="Run unit tests with PHPUnit"> <call-php> <extargs> <arg value="${vendordir}/phpunit/phpunit/phpunit"/> <arg value="--configuration" /> <arg path="${basedir}/phpunit.xml" /> <arg value="--coverage-clover" /> <arg path="${logdir}/clover.xml" /> <arg value="--coverage-crap4j" /> <arg path="${logdir}/crap4j.xml" /> <arg value="--log-junit" /> <arg path="${logdir}/junit.xml" /> <arg value="--coverage-html" /> <arg path="${builddir}/coverage/html" /> <arg value="--coverage-xml" /> <arg path="${builddir}/coverage/xml" /> <arg value="--bootstrap" /> <arg path="${vendordir}/autoload.php" /> </extargs> </call-php> </target> <!-- ========================================================================================================= --> <!-- Documentation generation using phpdox --> <target name="phpdox" description="Generate project documentation using phpDox"> <call-php failOnError="false"> <extargs> <arg value="${vendordir}/theseer/phpdox/phpdox"/> </extargs> </call-php> </target> </project>