mirror of
https://github.com/wiosna-dev/common-library.git
synced 2026-03-12 01:31:45 +01:00
Phing > update configuration
This commit is contained in:
226
phing/tests.xml
226
phing/tests.xml
@@ -1,230 +1,136 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="Meritoo Package" basedir="." default="build:main" phingVersion="2.14.0">
|
||||
<!--
|
||||
The AutoloaderTask is required to load binaries installed by Composer.
|
||||
The "autoloaderpath" attribute of this task is not required, because it's default value is: vendor/autoload.php.
|
||||
|
||||
Meritoo <github@meritoo.pl>
|
||||
2017-02-23
|
||||
-->
|
||||
<autoloader />
|
||||
<project name="Meritoo Package" basedir="." default="build:main" phingVersion="2.16.0">
|
||||
<autoloader/>
|
||||
|
||||
<!-- Properties -->
|
||||
<if>
|
||||
<available file="phing/properties" property="custom.properties.available"/>
|
||||
<available file="${project.basedir}/phing/properties" property="custom.properties.available"/>
|
||||
<then>
|
||||
<property file="phing/properties"/>
|
||||
<property file="${project.basedir}/phing/properties"/>
|
||||
</then>
|
||||
<else>
|
||||
<property file="phing/properties.dist"/>
|
||||
<property file="${project.basedir}/phing/properties.dist"/>
|
||||
</else>
|
||||
</if>
|
||||
|
||||
<!-- Filesets -->
|
||||
<fileset id="sourcecode" dir="${dir.src}">
|
||||
<include name="**/*.php" />
|
||||
<exclude name="*Test.php" />
|
||||
<exclude name="**/*Test.php" />
|
||||
<exclude name="**/Resources/**" />
|
||||
<exclude name="**/DataFixtures/**" />
|
||||
<exclude name="**/Tests/**" />
|
||||
<include name="**/*.php"/>
|
||||
<exclude name="*Test.php"/>
|
||||
<exclude name="**/*Test.php"/>
|
||||
<exclude name="**/Resources/**"/>
|
||||
<exclude name="**/DataFixtures/**"/>
|
||||
<exclude name="**/Tests/**"/>
|
||||
</fileset>
|
||||
<fileset id="tests" dir="${dir.tests}">
|
||||
<include name="**/*Test*.php" />
|
||||
<include name="**/*Test*.php"/>
|
||||
</fileset>
|
||||
|
||||
<!-- Default / main target -->
|
||||
<target name="build:main"
|
||||
depends="build:fix-coding-standards, build:clean, build:prepare, build:check, build:test, app:checkout"
|
||||
description="Runs all tests and builds everything" />
|
||||
<!--
|
||||
Before:
|
||||
depends="build:fix-coding-standards, build:clean, build:prepare, build:check, build:test, build:doc, app:checkout"
|
||||
|
||||
After:
|
||||
depends="build:fix-coding-standards, build:clean, build:prepare, build:check, build:test, app:checkout"
|
||||
|
||||
The "build:doc" task is disabled, because it cannot be installed via Composer:
|
||||
a) phpdocumentor/phpdocumentor v2.9.0 requires symfony/validator ~2.2
|
||||
b) symfony/validator ~2.2 causes to remove symfony/symfony 3.*
|
||||
|
||||
Meritoo <github@meritoo.pl>
|
||||
2017-02-22
|
||||
-->
|
||||
depends="build:fix-coding-standards,
|
||||
build:clean,
|
||||
build:prepare,
|
||||
build:check,
|
||||
build:test,
|
||||
app:checkout"
|
||||
/>
|
||||
|
||||
<!-- Fixing coding standards using the PHP Coding Standards Fixer (http://cs.sensiolabs.org) -->
|
||||
<target name="build:fix-coding-standards" description="Fixes coding standards using the PHP Coding Standards Fixer">
|
||||
<echo msg="Fixing coding standards using the PHP Coding Standards Fixer (http://cs.sensiolabs.org)..." />
|
||||
|
||||
<!--
|
||||
Attention.
|
||||
Rules for formatting are defined in /.php_cs.dist file.
|
||||
-->
|
||||
|
||||
<exec
|
||||
passthru="true"
|
||||
command="${tests.cs_fixer.path} fix --verbose"
|
||||
/>
|
||||
<target name="build:fix-coding-standards">
|
||||
<exec command="${tests.cs_fixer.command}" passthru="true"/>
|
||||
</target>
|
||||
|
||||
<!-- Doc target -->
|
||||
<!--
|
||||
Disabled, because it cannot be installed via Composer:
|
||||
a) phpdocumentor/phpdocumentor v2.9.0 requires symfony/validator ~2.2
|
||||
b) symfony/validator ~2.2 causes to remove symfony/symfony 3.*
|
||||
|
||||
Meritoo <github@meritoo.pl>
|
||||
2017-02-22
|
||||
-->
|
||||
<!--<target name="build:doc"-->
|
||||
<!--depends="build:prepare, doc:phpdoc2"-->
|
||||
<!--description="Generates API documentation" />-->
|
||||
|
||||
<!-- Check target -->
|
||||
<target name="build:check"
|
||||
depends="check:cs, check:md, check:cpd, check:depend, check:loc"
|
||||
description="Analyzes code" />
|
||||
depends="check:cs,
|
||||
check:md,
|
||||
check:cpd,
|
||||
check:depend,
|
||||
check:loc"
|
||||
/>
|
||||
|
||||
<!-- Test target -->
|
||||
<target name="build:test"
|
||||
depends="test:unit"
|
||||
description="Executes all tests" />
|
||||
depends="test:phpunit,
|
||||
test:infection"
|
||||
/>
|
||||
|
||||
<!-- Project build clean -->
|
||||
<target name="build:clean" description="Cleans up build directories">
|
||||
<echo msg="Cleaning docs and reports directories..." />
|
||||
<!--<delete dir="${dir.docs}" />-->
|
||||
<delete dir="${dir.reports}" />
|
||||
<target name="build:clean">
|
||||
<delete dir="${dir.reports}"/>
|
||||
</target>
|
||||
|
||||
<!-- Project build prepare -->
|
||||
<target name="build:prepare" description="Create build directories">
|
||||
<echo msg="Creating build directories..." />
|
||||
<!--<mkdir dir="${dir.docs}" />-->
|
||||
<!--<mkdir dir="${dir.docs.phpdoc2}" />-->
|
||||
<mkdir dir="${dir.reports}" />
|
||||
<mkdir dir="${dir.reports.pdepend}" />
|
||||
<target name="build:prepare">
|
||||
<mkdir dir="${dir.reports}"/>
|
||||
<mkdir dir="${dir.reports.pdepend}"/>
|
||||
<mkdir dir="${dir.reports.coverage}"/>
|
||||
</target>
|
||||
|
||||
<!-- PHPDocumentor2 API documentation target -->
|
||||
<!--
|
||||
Disabled, because it cannot be installed via Composer:
|
||||
a) phpdocumentor/phpdocumentor v2.9.0 requires symfony/validator ~2.2
|
||||
b) symfony/validator ~2.2 causes to remove symfony/symfony 3.*
|
||||
|
||||
Meritoo <github@meritoo.pl>
|
||||
2017-02-22
|
||||
|
||||
<target name="doc:phpdoc2" description="Generates API documentations">
|
||||
<echo msg="Generating API Documentation with phpDocumentor 2..." />
|
||||
<phpdoc2 title="${phing.project.name}"
|
||||
destdir="${dir.docs.phpdoc2}"
|
||||
template="responsive">
|
||||
<fileset refid="sourcecode" />
|
||||
</phpdoc2>
|
||||
</target>
|
||||
-->
|
||||
|
||||
<!-- Symfony2 code sniffer -->
|
||||
<!--
|
||||
Attention 1.
|
||||
To use Symfony2 standards to check coding you have to:
|
||||
copy, symlink or check out repo to a folder called Symfony2 inside the phpcs Standards directory.
|
||||
|
||||
Example:
|
||||
$ pear config-show | grep php_dir
|
||||
$ cd /path/to/pear/PHP/CodeSniffer/Standards
|
||||
$ git clone git://github.com/opensky/Symfony2-coding-standard.git Symfony2
|
||||
|
||||
Attention 2.
|
||||
PSR2 standard is used instead of Symfony2 standard, because after installation squizlabs/php_codesniffer package
|
||||
via Composer the Symfony2 standard is not included / available in this package. In this case the PHP Coding
|
||||
Standards Fixer (http://cs.sensiolabs.org) is used.
|
||||
|
||||
Meritoo <github@meritoo.pl>
|
||||
2017-02-22
|
||||
-->
|
||||
<target name="check:cs" description="Checks coding standard">
|
||||
<echo msg="Checking coding standard..." />
|
||||
<target name="check:cs">
|
||||
<phpcodesniffer standard="PSR2" showWarnings="true">
|
||||
<fileset refid="sourcecode" />
|
||||
<formatter type="checkstyle" outfile="${dir.reports}/checkstyle.xml" />
|
||||
<formatter type="csv" outfile="${dir.reports}/checkstyle.csv" />
|
||||
<formatter type="summary" outfile="${dir.reports}/checkstyle_summary.txt" />
|
||||
<fileset refid="sourcecode"/>
|
||||
<formatter type="checkstyle" outfile="${dir.reports}/checkstyle.xml"/>
|
||||
<formatter type="csv" outfile="${dir.reports}/checkstyle.csv"/>
|
||||
<formatter type="summary" outfile="${dir.reports}/checkstyle_summary.txt"/>
|
||||
</phpcodesniffer>
|
||||
</target>
|
||||
|
||||
<!-- copy/paste detector -->
|
||||
<target name="check:cpd" description="Checks similar code blocks.">
|
||||
<echo msg="Checking similar code blocks..." />
|
||||
<target name="check:cpd">
|
||||
<phpcpd>
|
||||
<fileset refid="sourcecode" />
|
||||
<formatter type="pmd" outfile="${dir.reports}/pmd-cpd.xml" />
|
||||
<fileset refid="sourcecode"/>
|
||||
<formatter type="pmd" outfile="${dir.reports}/pmd-cpd.xml"/>
|
||||
</phpcpd>
|
||||
|
||||
<!--
|
||||
Previous / old version
|
||||
|
||||
Meritoo <github@meritoo.pl>
|
||||
2017-02-22
|
||||
|
||||
<exec command="phpcpd \-\-log-pmd=${dir.reports}/pmd-cpd.xml ${dir.src}" />
|
||||
-->
|
||||
</target>
|
||||
|
||||
<!-- Mess detector -->
|
||||
<target name="check:md" description="Generate code metrics">
|
||||
<echo msg="Generating code metrics..." />
|
||||
<target name="check:md">
|
||||
<phpmd rulesets="codesize,controversial,design,naming,unusedcode">
|
||||
<fileset refid="sourcecode" />
|
||||
<formatter type="html" outfile="${dir.reports}/phpmd.html" />
|
||||
<formatter type="text" outfile="${dir.reports}/phpmd.txt" />
|
||||
<fileset refid="sourcecode"/>
|
||||
<formatter type="html" outfile="${dir.reports}/phpmd.html"/>
|
||||
<formatter type="text" outfile="${dir.reports}/phpmd.txt"/>
|
||||
</phpmd>
|
||||
</target>
|
||||
|
||||
<!-- Code dependency -->
|
||||
<target name="check:depend" description="Checks coupling and dependency">
|
||||
<echo msg="Checking coupling and dependency..." />
|
||||
<target name="check:depend">
|
||||
<phpdepend>
|
||||
<fileset refid="sourcecode" />
|
||||
<logger type="jdepend-xml" outfile="${dir.reports.pdepend}/jdepend.xml" />
|
||||
<logger type="jdepend-chart" outfile="${dir.reports.pdepend}/dependencies.svg" />
|
||||
<logger type="overview-pyramid" outfile="${dir.reports.pdepend}/overview-pyramid.svg" />
|
||||
<fileset refid="sourcecode"/>
|
||||
<logger type="jdepend-xml" outfile="${dir.reports.pdepend}/jdepend.xml"/>
|
||||
<logger type="jdepend-chart" outfile="${dir.reports.pdepend}/dependencies.svg"/>
|
||||
<logger type="overview-pyramid" outfile="${dir.reports.pdepend}/overview-pyramid.svg"/>
|
||||
</phpdepend>
|
||||
</target>
|
||||
|
||||
<!-- Measure the size and analyzing the structure of a project -->
|
||||
<target name="check:loc" description="Measures the size and analyzes the structure of a project">
|
||||
<echo msg="Measuring the size and analyzing the structure of a project..." />
|
||||
<target name="check:loc">
|
||||
<phploc reportType="txt" reportName="phploc" reportDirectory="${dir.reports}">
|
||||
<fileset refid="sourcecode" />
|
||||
<fileset refid="sourcecode"/>
|
||||
</phploc>
|
||||
|
||||
<!--
|
||||
Previous / old version
|
||||
|
||||
Meritoo <github@meritoo.pl>
|
||||
2017-02-22
|
||||
|
||||
<exec command="phploc \-\-log-csv=${dir.reports}/phploc.csv ${dir.src}" />
|
||||
-->
|
||||
</target>
|
||||
|
||||
<!-- Unit tests -->
|
||||
<target name="test:unit" description="Runs unit tests">
|
||||
<echo msg="Running unit tests..." />
|
||||
<exec command="${tests.framework.path}" passthru="true"/>
|
||||
<!-- PHPUnit tests -->
|
||||
<target name="test:phpunit">
|
||||
<exec command="${tests.phpunit.command}" passthru="true"/>
|
||||
</target>
|
||||
|
||||
<!-- Run mutation testing -->
|
||||
<target name="test:infection">
|
||||
<exec command="${tests.mutation.command}" passthru="true"/>
|
||||
</target>
|
||||
|
||||
<!-- Checkout and finalization -->
|
||||
<target name="app:checkout">
|
||||
<tstamp>
|
||||
<format property="date_end" pattern="%Y-%m-%d %H:%M" />
|
||||
<format property="date_end" pattern="%Y-%m-%d %H:%M"/>
|
||||
</tstamp>
|
||||
|
||||
<echo msg="--------------------------------------------" />
|
||||
<echo msg="Build tests finished at: ${date_end}" />
|
||||
<echo msg="--------------------------------------------" />
|
||||
<echo msg="--------------------------------------------"/>
|
||||
<echo msg="Build tests finished at: ${date_end}"/>
|
||||
<echo msg="--------------------------------------------"/>
|
||||
</target>
|
||||
</project>
|
||||
|
||||
Reference in New Issue
Block a user