Created
October 23, 2012 07:17
-
-
Save yangboz/0bcc4126314bea336b9b to your computer and use it in GitHub Desktop.
Ant xml example for PHP code check style/PMD/CPD/pdepend/doc/lint/test.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!--@see:http://agile.dzone.com/news/continuous-integration-php --> | |
<project name="AutoPhotobookContinuousIntegrationInPHP/Jenkins" | |
default="build" basedir="."> | |
<!-- $Id: build.xml 102 2012-01-19 14:39:10Z abtris $ --> | |
<property name="output" location="${basedir}/build/" /> | |
<property name="src" location="${basedir}/application/" /> | |
<property name="basedir" value="." /> | |
<!-- Clean dirs --> | |
<target name="clean"> | |
<delete> | |
<fileset dir="${output}" includes="**/*"/> | |
</delete> | |
</target> | |
<!-- Create dirs --> | |
<target name="init"> | |
<mkdir dir="${output}/phpcs/" /> | |
<mkdir dir="${output}/phpmd/" /> | |
<mkdir dir="${output}/cpd/" /> | |
<mkdir dir="${output}/pdepend/" /> | |
<mkdir dir="${output}/api/" /> | |
</target> | |
<!-- Main Target --> | |
<target name="build" depends="clean, init, phpcs,test, phpmd, phpcpd, pdepend,phpdoc,phpcb,phploc,lint" /> | |
<!-- PHPUnit --> | |
<target name="test"> | |
<exec executable="phpunit" failonerror="false" dir="${basedir}/tests"> | |
<arg | |
line=" | |
--log-junit=${output}/logs/phpunit.xml | |
--coverage-clover ${output}/coverage/clover.xml | |
--coverage-html ${output}/coverage/ | |
${basedir}/tests/ApbSAAStestsSuite.php | |
" /> | |
</exec> | |
</target> | |
<!-- PHP CodeSniffer --> | |
<target name="phpcs"> | |
<exec executable="phpcs"> | |
<arg | |
line=" --report=checkstyle | |
--report-file=${output}/phpcs/checkstyle.xml | |
--standard=Zend | |
${src}/controllers/ | |
" /> | |
</exec> | |
</target> | |
<!-- PHP Mess Detector --> | |
<target name="phpmd"> | |
<exec executable="phpmd"> | |
<arg | |
line=" ${src}/controllers/ xml codesize,unusedcode,naming,design | |
--reportfile ${output}/phpmd/messdetector.xml | |
--exclude ${basedir}/tests/ | |
" /> | |
</exec> | |
</target> | |
<!-- PHP Copy/Paste Detector --> | |
<target name="phpcpd"> | |
<exec executable="phpcpd" > | |
<arg line="--log-pmd ${output}/cpd/phpcpd.xml | |
${src}/controllers/" /> | |
</exec> | |
</target> | |
<!-- PHP Depend --> | |
<target name="pdepend"> | |
<exec executable="pdepend" | |
description="Calculate software metrics using PHP_Depend"> | |
<arg | |
line=" | |
--jdepend-xml=${output}/pdepend/jdepend.xml | |
--jdepend-chart=${output}/pdepend/dependencies.svg | |
--overview-pyramid=${output}/pdepend/overview-pyramid.svg | |
--ignore=tests/ | |
${basedir} | |
" /> | |
</exec> | |
</target> | |
<!-- PHP Documetor --> | |
<target name="phpdoc" description="Generate API documentation using PHPDocumentor"> | |
<exec executable="phpdoc"> | |
<arg line=" -d ${basedir}/application/controllers/API | |
-t ${basedir}/build/api | |
-ti AutoPhotobook PHP5 REST API | |
-dn API | |
-ric ${basedir}/ | |
" /> | |
</exec> | |
</target> | |
<!-- PHP Code Browser --> | |
<target name="phpcb" description="Aggregate tool output with PHP_CodeBrowser"> | |
<exec executable="phpcb"> | |
<arg value="--log"/> | |
<arg path="${basedir}/build/logs"/> | |
<arg value="--source"/> | |
<arg path="${src}"/> | |
<arg value="--output"/> | |
<arg path="${basedir}/build/code-browser"/> | |
</exec> | |
</target> | |
<!-- PHP LOC(measure the project size) --> | |
<target name="phploc" description="Measure project size using PHPLOC"> | |
<exec executable="phploc"> | |
<arg value="--log-csv"/> | |
<arg value="${basedir}/build/logs/phploc.csv"/> | |
<arg path="${basedir}/src"/> | |
</exec> | |
</target> | |
<!-- PHP LINT(can be used to perform a syntax check of the project sources) --> | |
<target name="lint"> | |
<apply executable="php" failonerror="true"> | |
<arg value="-l"/> | |
<fileset dir="${src}/controllers/"> | |
<include name="**/*.php"/> | |
<!-- <exclude name="third_party/**/*.php"/>--> | |
<modified/> | |
</fileset> | |
<fileset dir="${src}/models/"> | |
<include name="**/*.php"/> | |
<modified/> | |
</fileset> | |
<!-- <fileset dir="${src}/views/">--> | |
<!-- <include name="**/*.php"/>--> | |
<!-- <modified/>--> | |
<!-- </fileset>--> | |
</apply> | |
</target> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!--@see:http://agile.dzone.com/news/continuous-integration-php --> | |
<project name="XXXContinuousIntegrationInPHP/Jenkins" | |
default="build" basedir="."> | |
<!-- $Id: build.xml 102 2012-01-19 14:39:10Z abtris $ --> | |
<property name="output" location="${basedir}/build/" /> | |
<property name="src" location="${basedir}/application/" /> | |
<property name="basedir" value="." /> | |
<!-- Clean dirs --> | |
<target name="clean"> | |
<delete> | |
<fileset dir="${output}" includes="**/*"/> | |
</delete> | |
</target> | |
<!-- Create dirs --> | |
<target name="init"> | |
<mkdir dir="${output}/phpcs/" /> | |
<mkdir dir="${output}/phpmd/" /> | |
<mkdir dir="${output}/cpd/" /> | |
<mkdir dir="${output}/pdepend/" /> | |
<mkdir dir="${output}/api/" /> | |
</target> | |
<!-- Main Target --> | |
<target name="build" depends="clean, init, phpcs,test, phpmd, phpcpd, pdepend,phpdoc,phpcb,phploc,lint" /> | |
<!-- PHPUnit --> | |
<target name="test"> | |
<exec executable="phpunit" failonerror="false" dir="${basedir}/tests"> | |
<arg | |
line=" | |
--log-junit=${output}/logs/phpunit.xml | |
--coverage-clover ${output}/coverage/clover.xml | |
--coverage-html ${output}/coverage/ | |
${basedir}/tests/ApbSAAStestsSuite.php | |
" /> | |
</exec> | |
</target> | |
<!-- PHP CodeSniffer --> | |
<target name="phpcs"> | |
<exec executable="phpcs"> | |
<arg | |
line=" --report=checkstyle | |
--report-file=${output}/phpcs/checkstyle.xml | |
--standard=Zend | |
${src}/controllers/ | |
" /> | |
</exec> | |
</target> | |
<!-- PHP Mess Detector --> | |
<target name="phpmd"> | |
<exec executable="phpmd"> | |
<arg | |
line=" ${src}/controllers/ xml codesize,unusedcode,naming,design | |
--reportfile ${output}/phpmd/messdetector.xml | |
--exclude ${basedir}/tests/ | |
" /> | |
</exec> | |
</target> | |
<!-- PHP Copy/Paste Detector --> | |
<target name="phpcpd"> | |
<exec executable="phpcpd" > | |
<arg line="--log-pmd ${output}/cpd/phpcpd.xml | |
${src}/controllers/" /> | |
</exec> | |
</target> | |
<!-- PHP Depend --> | |
<target name="pdepend"> | |
<exec executable="pdepend" | |
description="Calculate software metrics using PHP_Depend"> | |
<arg | |
line=" | |
--jdepend-xml=${output}/pdepend/jdepend.xml | |
--jdepend-chart=${output}/pdepend/dependencies.svg | |
--overview-pyramid=${output}/pdepend/overview-pyramid.svg | |
--ignore=tests/ | |
${basedir} | |
" /> | |
</exec> | |
</target> | |
<!-- PHP Documetor --> | |
<target name="phpdoc" description="Generate API documentation using PHPDocumentor"> | |
<exec executable="phpdoc"> | |
<arg line=" -d ${basedir}/application/controllers/API | |
-t ${basedir}/build/api | |
-ti AutoPhotobook PHP5 REST API | |
-dn API | |
-ric ${basedir}/ | |
" /> | |
</exec> | |
</target> | |
<!-- PHP Code Browser --> | |
<target name="phpcb" description="Aggregate tool output with PHP_CodeBrowser"> | |
<exec executable="phpcb"> | |
<arg value="--log"/> | |
<arg path="${basedir}/build/logs"/> | |
<arg value="--source"/> | |
<arg path="${src}"/> | |
<arg value="--output"/> | |
<arg path="${basedir}/build/code-browser"/> | |
</exec> | |
</target> | |
<!-- PHP LOC(measure the project size) --> | |
<target name="phploc" description="Measure project size using PHPLOC"> | |
<exec executable="phploc"> | |
<arg value="--log-csv"/> | |
<arg value="${basedir}/build/logs/phploc.csv"/> | |
<arg path="${basedir}/src"/> | |
</exec> | |
</target> | |
<!-- PHP LINT(can be used to perform a syntax check of the project sources) --> | |
<target name="lint"> | |
<apply executable="php" failonerror="true"> | |
<arg value="-l"/> | |
<fileset dir="${src}/controllers/"> | |
<include name="**/*.php"/> | |
<!-- <exclude name="third_party/**/*.php"/>--> | |
<modified/> | |
</fileset> | |
<fileset dir="${src}/models/"> | |
<include name="**/*.php"/> | |
<modified/> | |
</fileset> | |
<!-- <fileset dir="${src}/views/">--> | |
<!-- <include name="**/*.php"/>--> | |
<!-- <modified/>--> | |
<!-- </fileset>--> | |
</apply> | |
</target> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment