Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

233 lines (169 sloc) 7.72 KB
<?xml version="1.0" encoding="UTF-8"?>
<project name="Sonata Block Bundle" basedir="." default="build:main">
<!-- Config files -->
<property name="dir.config" value="${project.basedir}" />
<property name="config.phpunit" value="${dir.config}/phpunit.xml.dist" />
<property name="config.pmd" value="${dir.config}/pmd.xml.dist" />
<!-- Build paths -->
<property name="" value="${project.basedir}/build" />
<property name="dir.reports" value="${}/reports" />
<property name="dir.reports.check" value="${dir.reports}/check" />
<property name="dir.reports.test" value="${dir.reports}/test" />
<property name="dir.reports.test.unit" value="${dir.reports.test}/unit" />
<property name="dir.reports.test.coverage" value="${dir.reports.test}/coverage" />
<property name="" value="${}/docs" />
<property name="" value="${}/api" />
<property name="" value="${}/rst" />
<property name="" value="${}/php" />
<!-- Source paths -->
<property name="dir.src" value="${project.basedir}" />
<property name="dir.src.rst" value="${dir.src}/Resources/doc" />
<!-- Source fileset (used by check tasks) -->
<fileset id="sourcecode" dir="${dir.src}">
<include name="**/*.php" />
<exclude name="**/*Test.php" />
<exclude name="vendor/**/*.php" />
<!-- BUILD TASKS -->
<!-- Main (default) task -->
<target name="build:main"
depends="build:clean, build:prepare, build:check, build:test, build:doc"
description="Run all test and build everything"/>
<!-- Clean previous build files -->
<target name="build:clean"
description="Clean previous build files">
<delete dir="${}" verbose="true" />
<!-- Prepare build (performed by each build:* task when called as standalone) -->
<target name="build:prepare"
description="Prepare build">
<mkdir dir="${}" />
<!-- Check Project -->
<target name="build:check"
description="Check source code"
depends="build:prepare, check:prepare, check:cs, check:md, check:cpd"/>
<!-- Test Project -->
<target name="build:test"
description="Perform all tests"
depends="build:prepare, test:prepare, test:unit"/>
<!-- Generate documentation -->
<target name="build:doc"
depends="build:prepare, doc:prepare, doc:api"
description="Generate API documentation"/>
<!-- Prepare check (performed by each check:* task when called as standalone) -->
<target name="check:prepare"
description="Create check directories">
<mkdir dir="${dir.reports.check}" />
<!-- CodeSniffer with Symfony2 convention -->
<target name="check:cs"
description="Generate PHP_CodeSniffer report">
<phpcodesniffer standard="Symfony2" showSniffs="true" showWarnings="true">
<fileset refid="sourcecode" />
<config name="error_severity" value="1"/>
<config name="warning_severity" value="5"/>
<formatter type="checkstyle" outfile="${dir.reports.check}/checkstyle.xml" />
<!-- PHP Copy and Paste Detector -->
<target name="check:cpd"
description="Generate phpcpd report"
<fileset refid="sourcecode" />
<formatter type="pmd" outfile="${dir.reports.check}/cpd.xml" />
<!-- PHP Mess detector -->
<target name="check:md"
description="Generate phpmd report"
depends="check:prepare" >
<!-- if config.pmd file not found, use default pmd config -->
<not><available file="${config.pmd}"/></not>
<echo msg="phpmd config file not found: ${config.pmd}" />
<property name="config.pmd" value="codesize,unusedcode,naming,design" override="yes"/>
<phpmd rulesets="${config.pmd}">
<fileset refid="sourcecode" />
<formatter type="xml" outfile="${dir.reports.check}/pmd.xml" />
<!-- Prepare test environment (performed by each test:* task when called as standalone) -->
<target name="test:prepare"
description="Prepare the test environment">
<echo msg="Prepare test report directory" />
<mkdir dir="${dir.reports.test}" />
<echo msg="Installing/Updating vendors..." />
<exec command="composer update --dev" passthru="true"/>
<!-- Prepare unit test environment -->
<target name="test:unit:prepare"
description="Prepare the unit test environment"
<mkdir dir="${dir.reports.test.unit}" />
<!-- Execute unit tests and code coverage -->
<target name="test:unit"
description="Perform unit tests and code coverage"
depends="test:prepare, test:unit:prepare">
<exec executable="phpunit" logoutput="true">
<arg line="--log-junit ${dir.reports.test.unit}/phpunit.xml" />
<arg line="--coverage-clover ${dir.reports.test.coverage}/clover.xml" />
<arg line="--coverage-html ${dir.reports.test.coverage}/html" />
<arg line="-c ${config.phpunit}" />
<!-- Prepare the documentation environment -->
<target name="doc:prepare"
description="Prepare the documentation">
<mkdir dir="${}" />
<!-- Prepare the Api documentation -->
<target name="doc:api:prepare"
description="Prepare the API documentation">
<mkdir dir="${}" />
<!-- Generate the Api documentation -->
<target name="doc:api"
description="Generate API documentation"
depends="doc:prepare, doc:api:prepare">
<exec executable="apigen" logoutput="true" passthru="true">
<arg line="--source ${dir.src}" />
<arg line="--exclude */vendor/*" />
<arg line="--exclude */Tests/*" />
<arg line="--destination ${}" />
<!-- Prepare the phpDoc documentation -->
<target name="doc:php:prepare"
description="Prepare the Php documentation">
<mkdir dir="${}" />
<!-- Build the phpDoc documentation -->
<target name="doc:php"
description="Generate Php documentation"
depends="doc:prepare, doc:php:prepare">
<exec executable="phpdoc" logoutput="true" passthru="true">
<arg line="--directory ${dir.src}" />
<arg line="--ignore '*/vendor/*,*/Tests/*'" />
<arg line="--target ${}" />
<arg line="--sourcecode" />
<!-- Generate the RST documentation -->
<target name="doc:rst"
description="Generate RST documentation"
<!-- delete previous directory (sphinx refuses to work on an existing directory) -->
<delete dir="${}"/>
<exec command="sphinx-build -C -a -b html ${dir.src.rst} ${}" passthru="true" />
Jump to Line
Something went wrong with that request. Please try again.