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:
20
build.xml
20
build.xml
@@ -1,28 +1,30 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<project name="Meritoo Package" basedir="." default="build:main" phingVersion="2.14.0">
|
<project name="Meritoo Package" basedir="." default="build:main" phingVersion="2.14.0">
|
||||||
<!-- Properties -->
|
<!-- Properties -->
|
||||||
<if>
|
<if>
|
||||||
<available file="phing/properties" property="custom.properties.available"/>
|
<available file="${project.basedir}/phing/properties" property="custom.properties.available"/>
|
||||||
<then>
|
<then>
|
||||||
<property file="phing/properties"/>
|
<property file="${project.basedir}/phing/properties"/>
|
||||||
</then>
|
</then>
|
||||||
<else>
|
<else>
|
||||||
<property file="phing/properties.dist"/>
|
<property file="${project.basedir}/phing/properties.dist"/>
|
||||||
</else>
|
</else>
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<!-- Default / main target -->
|
<!-- Default / main target -->
|
||||||
<target name="build:main"
|
<target name="build:main"
|
||||||
depends="build:app, build:tests"
|
depends="build:app,
|
||||||
description="Builds everything and runs all tests"/>
|
build:tests"
|
||||||
|
/>
|
||||||
|
|
||||||
<!-- Build app -->
|
<!-- Build app -->
|
||||||
<target name="build:app" description="Prepares app to build and tests">
|
<target name="build:app">
|
||||||
<phing phingfile="phing/app.xml" haltonfailure="true"/>
|
<phing phingfile="${project.basedir}/phing/app.xml" haltonfailure="true"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Build tests -->
|
<!-- Build tests -->
|
||||||
<target name="build:tests" description="Runs all tests, checks and creates docs">
|
<target name="build:tests">
|
||||||
<phing phingfile="phing/tests.xml" haltonfailure="true"/>
|
<phing phingfile="${project.basedir}/phing/tests.xml" haltonfailure="true"/>
|
||||||
</target>
|
</target>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
101
phing/app.xml
101
phing/app.xml
@@ -1,107 +1,104 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<project name="Meritoo Package" basedir="." default="build:main" phingVersion="2.16.0">
|
<project name="Meritoo Package" basedir="." default="build:main" phingVersion="2.16.0">
|
||||||
<!-- Properties -->
|
<!-- Properties -->
|
||||||
<if>
|
<if>
|
||||||
<available file="phing/properties" property="custom.properties.available"/>
|
<available file="${project.basedir}/phing/properties" property="custom.properties.available"/>
|
||||||
<then>
|
<then>
|
||||||
<property file="phing/properties"/>
|
<property file="${project.basedir}/phing/properties"/>
|
||||||
</then>
|
</then>
|
||||||
<else>
|
<else>
|
||||||
<property file="phing/properties.dist"/>
|
<property file="${project.basedir}/phing/properties.dist"/>
|
||||||
</else>
|
</else>
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<!-- Filesets -->
|
<!-- Filesets -->
|
||||||
<import file="phing/filesets.xml"/>
|
<import file="${project.basedir}/phing/filesets.xml"/>
|
||||||
|
|
||||||
<!-- Default / main target -->
|
<!-- Default / main target -->
|
||||||
<target name="build:main"
|
<target name="build:main"
|
||||||
depends="build:app"
|
depends="build:app"
|
||||||
description="Builds the application"/>
|
/>
|
||||||
|
|
||||||
<!-- App target -->
|
<!-- App target -->
|
||||||
<target name="build:app"
|
<target name="build:app"
|
||||||
depends="app:clean, app:composer, app:vendors, app:composer-validate, app:checkout"
|
depends="app:clean,
|
||||||
description="Prepares app to build."/>
|
app:composer:self-update,
|
||||||
|
app:composer:install,
|
||||||
|
app:composer:validate,
|
||||||
|
app:checkout"
|
||||||
|
/>
|
||||||
|
|
||||||
<!-- Updates Composer -->
|
<!-- Updates Composer -->
|
||||||
<target name="app:composer" description="Updates Composer">
|
<target name="app:composer:self-update">
|
||||||
<echo msg="Updating Composer..."/>
|
|
||||||
|
|
||||||
<if>
|
<if>
|
||||||
<available file="composer.phar"/>
|
<not>
|
||||||
|
<available file="${composer.path}" property="composer.local.unavailable"/>
|
||||||
|
</not>
|
||||||
<then>
|
<then>
|
||||||
<echo msg="[Skipped] Downloading of Composer skipped, because exist in the project..."/>
|
|
||||||
</then>
|
|
||||||
<else>
|
|
||||||
<if>
|
<if>
|
||||||
<os family="windows"/>
|
<os family="windows"/>
|
||||||
<then>
|
<then>
|
||||||
<fail message="Composer not found! Go to http://getcomposer.org/download and download the Composer."/>
|
<fail message="Composer not found! Go to http://getcomposer.org/download and download the Composer."/>
|
||||||
</then>
|
</then>
|
||||||
<else>
|
<else>
|
||||||
<exec command="${composer.download_command}" checkreturn="true"/>
|
<exec command="${composer.download_command}" checkreturn="true" passthru="true"/>
|
||||||
</else>
|
</else>
|
||||||
</if>
|
</if>
|
||||||
</else>
|
</then>
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<!-- Update Composer -->
|
<!-- Update Composer -->
|
||||||
<composer command="selfupdate"/>
|
<composer php="${composer.php}" composer="${composer.path}" command="selfupdate">
|
||||||
|
<arg value="--ansi"/>
|
||||||
|
</composer>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Validates composer.* files -->
|
<!-- Validates composer.* files -->
|
||||||
<target name="app:composer-validate" description="Validates composer.* files">
|
<target name="app:composer:validate" depends="app:composer:install">
|
||||||
<echo msg="Validating composer.* files..."/>
|
<composer php="${composer.php}" composer="${composer.path}" command="validate">
|
||||||
|
<arg value="--no-check-all"/>
|
||||||
<!-- Validate Composer -->
|
<arg value="--strict"/>
|
||||||
<composer command="validate">
|
<arg value="--ansi"/>
|
||||||
<arg line="--no-check-all --strict"/>
|
|
||||||
</composer>
|
</composer>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Project clean -->
|
<!-- Project clean -->
|
||||||
<target name="app:clean" description="Clears app's directories">
|
<target name="app:clean">
|
||||||
<echo msg="Cleaning project..."/>
|
|
||||||
<if>
|
<if>
|
||||||
<equals arg1="${env}" arg2="prod"/>
|
<equals arg1="${env}" arg2="prod"/>
|
||||||
<then>
|
<then>
|
||||||
<echo message="[Skipped] Cleaning project (and directories cleanup) skipped, because of 'prod' environment..."/>
|
<echo message="[Skipped] Cleaning project (and directories cleanup) -> 'prod' environment"/>
|
||||||
</then>
|
</then>
|
||||||
<else>
|
<else>
|
||||||
<echo msg="Cleaning directories (making them empty)..."/>
|
|
||||||
<foreach list="${directoriesToEmpty}" param="directory" target="app:clean:empty"/>
|
<foreach list="${directoriesToEmpty}" param="directory" target="app:clean:empty"/>
|
||||||
</else>
|
</else>
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<echo msg="Preparing directories structure..."/>
|
|
||||||
<foreach list="${directoriesToCheck}" param="directory" target="app:clean:check"/>
|
<foreach list="${directoriesToCheck}" param="directory" target="app:clean:check"/>
|
||||||
|
|
||||||
<echo msg="Creating .gitkeep files..."/>
|
|
||||||
<touch file="${dir.cache}/.gitkeep"/>
|
<touch file="${dir.cache}/.gitkeep"/>
|
||||||
<touch file="${dir.logs}/.gitkeep"/>
|
<touch file="${dir.logs}/.gitkeep"/>
|
||||||
<touch file="${dir.sessions}/.gitkeep"/>
|
<touch file="${dir.sessions}/.gitkeep"/>
|
||||||
|
|
||||||
<echo msg="Setting permissions of directories..."/>
|
|
||||||
<foreach list="${directoriesToEmpty}" param="directory" target="app:permissions"/>
|
<foreach list="${directoriesToEmpty}" param="directory" target="app:permissions"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Cleaning directory (making empty) directory -->
|
<!-- Cleaning directory (making empty) directory -->
|
||||||
<target name="app:clean:empty" description="Empties directory">
|
<target name="app:clean:empty">
|
||||||
<if>
|
<if>
|
||||||
<available file="${directory}" type="dir"/>
|
<available file="${directory}" type="dir" property="dir_is_available"/>
|
||||||
<then>
|
<then>
|
||||||
<echo message="Cleaning directory (making empty) ${directory}..."/>
|
|
||||||
<delete includeemptydirs="true" dir="${directory}"/>
|
<delete includeemptydirs="true" dir="${directory}"/>
|
||||||
</then>
|
</then>
|
||||||
</if>
|
</if>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Checking if directory exists -->
|
<!-- Checking if directory exists -->
|
||||||
<target name="app:clean:check" description="Checks if directories exist">
|
<target name="app:clean:check">
|
||||||
<if>
|
<if>
|
||||||
<not>
|
<not>
|
||||||
<available file="${directory}" type="dir"/>
|
<available file="${directory}" type="dir" property="dir_is_available"/>
|
||||||
</not>
|
</not>
|
||||||
<then>
|
<then>
|
||||||
<if>
|
<if>
|
||||||
@@ -121,40 +118,24 @@
|
|||||||
</if>
|
</if>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Project Install/update vendors -->
|
<!-- Installs vendors -->
|
||||||
<target name="app:vendors" description="Installs / updates vendors">
|
<target name="app:composer:install" depends="app:composer:self-update">
|
||||||
<echo msg="Installing / updating vendors..."/>
|
|
||||||
|
|
||||||
<if>
|
|
||||||
<istrue value="${composer.self-update}"/>
|
|
||||||
<then>
|
|
||||||
<composer php="${composer.php}" composer="${composer.path}" command="self-update"/>
|
|
||||||
</then>
|
|
||||||
</if>
|
|
||||||
|
|
||||||
<composer php="${composer.php}" composer="${composer.path}" command="install">
|
<composer php="${composer.php}" composer="${composer.path}" command="install">
|
||||||
<arg value="--optimize-autoloader"/>
|
<arg value="--optimize-autoloader"/>
|
||||||
<arg value="--prefer-dist"/>
|
<arg value="--ansi"/>
|
||||||
<arg value="--classmap-authoritative"/>
|
|
||||||
</composer>
|
</composer>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Clearing cache -->
|
<!-- Clearing cache -->
|
||||||
<target name="app:cache" description="Clears project cache and logs">
|
<target name="app:cache">
|
||||||
<echo msg="Clearing cache..."/>
|
|
||||||
|
|
||||||
<if>
|
<if>
|
||||||
<istrue value="${cache.clearWithWarmup}"/>
|
<istrue value="${cache.clearWithWarmup}"/>
|
||||||
<then>
|
<then>
|
||||||
<echo message="...with warm up"/>
|
|
||||||
|
|
||||||
<SymfonyConsole console="bin/console" command="cache:clear">
|
<SymfonyConsole console="bin/console" command="cache:clear">
|
||||||
<arg name="env" value="${env}"/>
|
<arg name="env" value="${env}"/>
|
||||||
</SymfonyConsole>
|
</SymfonyConsole>
|
||||||
</then>
|
</then>
|
||||||
<else>
|
<else>
|
||||||
<echo message="...without warm up"/>
|
|
||||||
|
|
||||||
<SymfonyConsole console="bin/console" command="cache:clear">
|
<SymfonyConsole console="bin/console" command="cache:clear">
|
||||||
<arg name="env" value="${env}"/>
|
<arg name="env" value="${env}"/>
|
||||||
<arg name="no-warmup"/>
|
<arg name="no-warmup"/>
|
||||||
@@ -164,9 +145,7 @@
|
|||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Clearing cache (faster) -->
|
<!-- Clearing cache (faster) -->
|
||||||
<target name="app:cache:faster" description="Clears project cache and logs (faster)">
|
<target name="app:cache:faster">
|
||||||
<echo msg="Clearing cache (faster)..."/>
|
|
||||||
|
|
||||||
<SymfonyConsole console="bin/console" command="cache:clear">
|
<SymfonyConsole console="bin/console" command="cache:clear">
|
||||||
<arg name="env" value="${env}"/>
|
<arg name="env" value="${env}"/>
|
||||||
<arg name="no-optional-warmers"/>
|
<arg name="no-optional-warmers"/>
|
||||||
@@ -174,16 +153,14 @@
|
|||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Warming up cache -->
|
<!-- Warming up cache -->
|
||||||
<target name="app:cache:warmup" description="Warms up project cache">
|
<target name="app:cache:warmup">
|
||||||
<echo msg="Warming up cache..."/>
|
|
||||||
|
|
||||||
<SymfonyConsole console="bin/console" command="cache:warmup">
|
<SymfonyConsole console="bin/console" command="cache:warmup">
|
||||||
<arg name="env" value="${env}"/>
|
<arg name="env" value="${env}"/>
|
||||||
</SymfonyConsole>
|
</SymfonyConsole>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Setting permissions of given directory -->
|
<!-- Setting permissions of given directory -->
|
||||||
<target name="app:permissions" description="Sets permissions of one of the core directories">
|
<target name="app:permissions">
|
||||||
<if>
|
<if>
|
||||||
<not>
|
<not>
|
||||||
<os family="windows"/>
|
<os family="windows"/>
|
||||||
|
|||||||
20
phing/composer-install.sh
Normal file
20
phing/composer-install.sh
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
EXPECTED_SIGNATURE="$(curl -L https://composer.github.io/installer.sig)"
|
||||||
|
# Original line (with wget):
|
||||||
|
# EXPECTED_SIGNATURE="$(wget -q -O - https://composer.github.io/installer.sig)"
|
||||||
|
|
||||||
|
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
||||||
|
ACTUAL_SIGNATURE="$(php -r "echo hash_file('SHA384', 'composer-setup.php');")"
|
||||||
|
|
||||||
|
if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]
|
||||||
|
then
|
||||||
|
>&2 echo 'ERROR: Invalid installer signature'
|
||||||
|
rm composer-setup.php
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
php composer-setup.php --quiet
|
||||||
|
RESULT=$?
|
||||||
|
rm composer-setup.php
|
||||||
|
exit $RESULT
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<project name="Meritoo Package" basedir="." default="build:main" phingVersion="2.16.0">
|
<project name="Meritoo Package" basedir="." default="build:main" phingVersion="2.16.0">
|
||||||
<!-- Filesets -->
|
<!-- Filesets -->
|
||||||
<fileset id="cache" dir="${dir.cache}">
|
<fileset id="cache" dir="${dir.cache}">
|
||||||
|
|||||||
@@ -1,19 +1,3 @@
|
|||||||
# --------------------------------------------------------------------------------
|
|
||||||
# Information
|
|
||||||
# --------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# Property files contain key/value pairs
|
|
||||||
# key = value
|
|
||||||
#
|
|
||||||
# Property keys may contain alphanumeric chars and colons, but
|
|
||||||
# not special chars. This way you can create pseudo-namespaces
|
|
||||||
#
|
|
||||||
# You can refer to values of other properties by enclosing their keys in "${}".
|
|
||||||
# Example: dir.js = ${dir.public}/js
|
|
||||||
#
|
|
||||||
# Everything behind the equal sign is the value, you do
|
|
||||||
# not have to enclose strings: text=This is some text, Your OS is ${php.os}
|
|
||||||
|
|
||||||
# --------------------------------------------------------------------------------
|
# --------------------------------------------------------------------------------
|
||||||
# Common, e.g. default environment
|
# Common, e.g. default environment
|
||||||
# --------------------------------------------------------------------------------
|
# --------------------------------------------------------------------------------
|
||||||
@@ -36,20 +20,18 @@ cache.clearWithWarmup = false
|
|||||||
# Composer
|
# Composer
|
||||||
# --------------------------------------------------------------------------------
|
# --------------------------------------------------------------------------------
|
||||||
|
|
||||||
composer.download_command = php -r "eval('?>'.file_get_contents('https://getcomposer.org/installer'));"
|
# Command used to download Composer
|
||||||
|
|
||||||
# Path to composer executable or composer.phar file
|
|
||||||
#
|
#
|
||||||
composer.path = composer.phar
|
composer.download_command = bash ${project.basedir}/phing/composer-install.sh
|
||||||
|
|
||||||
|
# Path to composer executable or downloaded composer.phar file
|
||||||
|
#
|
||||||
|
composer.path = ${project.basedir}/composer.phar
|
||||||
|
|
||||||
# Path to php executable used by composer
|
# Path to php executable used by composer
|
||||||
#
|
#
|
||||||
composer.php = php
|
composer.php = php
|
||||||
|
|
||||||
# Self update of the composer
|
|
||||||
#
|
|
||||||
composer.self-update = false
|
|
||||||
|
|
||||||
# --------------------------------------------------------------------------------
|
# --------------------------------------------------------------------------------
|
||||||
# Directories
|
# Directories
|
||||||
# --------------------------------------------------------------------------------
|
# --------------------------------------------------------------------------------
|
||||||
@@ -67,7 +49,7 @@ dir.tests = ${project.basedir}/tests
|
|||||||
# Build directories
|
# Build directories
|
||||||
#
|
#
|
||||||
dir.build = ${project.basedir}/build
|
dir.build = ${project.basedir}/build
|
||||||
dir.reports = ${dir.build}/logs
|
dir.reports = ${dir.build}/reports
|
||||||
dir.reports.pdepend = ${dir.reports}/pdepend
|
dir.reports.pdepend = ${dir.reports}/pdepend
|
||||||
dir.reports.coverage = ${dir.reports}/phpunit_coverage
|
dir.reports.coverage = ${dir.reports}/phpunit_coverage
|
||||||
|
|
||||||
@@ -88,12 +70,15 @@ dir.docker.logs = ${dir.docker}/logs/nginx
|
|||||||
|
|
||||||
# Path of the PHP Coding Standards Fixer (http://cs.sensiolabs.org)
|
# Path of the PHP Coding Standards Fixer (http://cs.sensiolabs.org)
|
||||||
#
|
#
|
||||||
tests.cs_fixer.path = ./vendor/bin/php-cs-fixer
|
tests.cs_fixer.command = ./vendor/bin/php-cs-fixer fix --verbose
|
||||||
|
|
||||||
# Test database path
|
# Test database path
|
||||||
#
|
#
|
||||||
tests.database = ${dir.data.temporary}/database.sqlite
|
tests.database = ${dir.data.temporary}/database.sqlite
|
||||||
|
|
||||||
# Path of the framework used to run unit tests
|
# Paths of frameworks used to run tests:
|
||||||
|
# - PHPUnit (unit tests)
|
||||||
|
# - Infection (mutation tests)
|
||||||
#
|
#
|
||||||
tests.framework.path = ./vendor/bin/phpunit --verbose --no-coverage
|
tests.phpunit.command = ./vendor/bin/phpunit --verbose --no-coverage
|
||||||
|
tests.mutation.command = ./vendor/bin/infection --threads=5
|
||||||
|
|||||||
226
phing/tests.xml
226
phing/tests.xml
@@ -1,230 +1,136 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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>
|
<project name="Meritoo Package" basedir="." default="build:main" phingVersion="2.16.0">
|
||||||
2017-02-23
|
<autoloader/>
|
||||||
-->
|
|
||||||
<autoloader />
|
|
||||||
|
|
||||||
<!-- Properties -->
|
<!-- Properties -->
|
||||||
<if>
|
<if>
|
||||||
<available file="phing/properties" property="custom.properties.available"/>
|
<available file="${project.basedir}/phing/properties" property="custom.properties.available"/>
|
||||||
<then>
|
<then>
|
||||||
<property file="phing/properties"/>
|
<property file="${project.basedir}/phing/properties"/>
|
||||||
</then>
|
</then>
|
||||||
<else>
|
<else>
|
||||||
<property file="phing/properties.dist"/>
|
<property file="${project.basedir}/phing/properties.dist"/>
|
||||||
</else>
|
</else>
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<!-- Filesets -->
|
<!-- Filesets -->
|
||||||
<fileset id="sourcecode" dir="${dir.src}">
|
<fileset id="sourcecode" dir="${dir.src}">
|
||||||
<include name="**/*.php" />
|
<include name="**/*.php"/>
|
||||||
<exclude name="*Test.php" />
|
<exclude name="*Test.php"/>
|
||||||
<exclude name="**/*Test.php" />
|
<exclude name="**/*Test.php"/>
|
||||||
<exclude name="**/Resources/**" />
|
<exclude name="**/Resources/**"/>
|
||||||
<exclude name="**/DataFixtures/**" />
|
<exclude name="**/DataFixtures/**"/>
|
||||||
<exclude name="**/Tests/**" />
|
<exclude name="**/Tests/**"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
<fileset id="tests" dir="${dir.tests}">
|
<fileset id="tests" dir="${dir.tests}">
|
||||||
<include name="**/*Test*.php" />
|
<include name="**/*Test*.php"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
|
|
||||||
<!-- Default / main target -->
|
<!-- Default / main target -->
|
||||||
<target name="build:main"
|
<target name="build:main"
|
||||||
depends="build:fix-coding-standards, build:clean, build:prepare, build:check, build:test, app:checkout"
|
depends="build:fix-coding-standards,
|
||||||
description="Runs all tests and builds everything" />
|
build:clean,
|
||||||
<!--
|
build:prepare,
|
||||||
Before:
|
build:check,
|
||||||
depends="build:fix-coding-standards, build:clean, build:prepare, build:check, build:test, build:doc, app:checkout"
|
build:test,
|
||||||
|
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
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!-- Fixing coding standards using the PHP Coding Standards Fixer (http://cs.sensiolabs.org) -->
|
<!-- 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">
|
<target name="build:fix-coding-standards">
|
||||||
<echo msg="Fixing coding standards using the PHP Coding Standards Fixer (http://cs.sensiolabs.org)..." />
|
<exec command="${tests.cs_fixer.command}" passthru="true"/>
|
||||||
|
|
||||||
<!--
|
|
||||||
Attention.
|
|
||||||
Rules for formatting are defined in /.php_cs.dist file.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<exec
|
|
||||||
passthru="true"
|
|
||||||
command="${tests.cs_fixer.path} fix --verbose"
|
|
||||||
/>
|
|
||||||
</target>
|
</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 -->
|
<!-- Check target -->
|
||||||
<target name="build:check"
|
<target name="build:check"
|
||||||
depends="check:cs, check:md, check:cpd, check:depend, check:loc"
|
depends="check:cs,
|
||||||
description="Analyzes code" />
|
check:md,
|
||||||
|
check:cpd,
|
||||||
|
check:depend,
|
||||||
|
check:loc"
|
||||||
|
/>
|
||||||
|
|
||||||
<!-- Test target -->
|
<!-- Test target -->
|
||||||
<target name="build:test"
|
<target name="build:test"
|
||||||
depends="test:unit"
|
depends="test:phpunit,
|
||||||
description="Executes all tests" />
|
test:infection"
|
||||||
|
/>
|
||||||
|
|
||||||
<!-- Project build clean -->
|
<!-- Project build clean -->
|
||||||
<target name="build:clean" description="Cleans up build directories">
|
<target name="build:clean">
|
||||||
<echo msg="Cleaning docs and reports directories..." />
|
<delete dir="${dir.reports}"/>
|
||||||
<!--<delete dir="${dir.docs}" />-->
|
|
||||||
<delete dir="${dir.reports}" />
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Project build prepare -->
|
<!-- Project build prepare -->
|
||||||
<target name="build:prepare" description="Create build directories">
|
<target name="build:prepare">
|
||||||
<echo msg="Creating build directories..." />
|
<mkdir dir="${dir.reports}"/>
|
||||||
<!--<mkdir dir="${dir.docs}" />-->
|
<mkdir dir="${dir.reports.pdepend}"/>
|
||||||
<!--<mkdir dir="${dir.docs.phpdoc2}" />-->
|
|
||||||
<mkdir dir="${dir.reports}" />
|
|
||||||
<mkdir dir="${dir.reports.pdepend}" />
|
|
||||||
<mkdir dir="${dir.reports.coverage}"/>
|
<mkdir dir="${dir.reports.coverage}"/>
|
||||||
</target>
|
</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 -->
|
<!-- Symfony2 code sniffer -->
|
||||||
<!--
|
<target name="check:cs">
|
||||||
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..." />
|
|
||||||
<phpcodesniffer standard="PSR2" showWarnings="true">
|
<phpcodesniffer standard="PSR2" showWarnings="true">
|
||||||
<fileset refid="sourcecode" />
|
<fileset refid="sourcecode"/>
|
||||||
<formatter type="checkstyle" outfile="${dir.reports}/checkstyle.xml" />
|
<formatter type="checkstyle" outfile="${dir.reports}/checkstyle.xml"/>
|
||||||
<formatter type="csv" outfile="${dir.reports}/checkstyle.csv" />
|
<formatter type="csv" outfile="${dir.reports}/checkstyle.csv"/>
|
||||||
<formatter type="summary" outfile="${dir.reports}/checkstyle_summary.txt" />
|
<formatter type="summary" outfile="${dir.reports}/checkstyle_summary.txt"/>
|
||||||
</phpcodesniffer>
|
</phpcodesniffer>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- copy/paste detector -->
|
<!-- copy/paste detector -->
|
||||||
<target name="check:cpd" description="Checks similar code blocks.">
|
<target name="check:cpd">
|
||||||
<echo msg="Checking similar code blocks..." />
|
|
||||||
<phpcpd>
|
<phpcpd>
|
||||||
<fileset refid="sourcecode" />
|
<fileset refid="sourcecode"/>
|
||||||
<formatter type="pmd" outfile="${dir.reports}/pmd-cpd.xml" />
|
<formatter type="pmd" outfile="${dir.reports}/pmd-cpd.xml"/>
|
||||||
</phpcpd>
|
</phpcpd>
|
||||||
|
|
||||||
<!--
|
|
||||||
Previous / old version
|
|
||||||
|
|
||||||
Meritoo <github@meritoo.pl>
|
|
||||||
2017-02-22
|
|
||||||
|
|
||||||
<exec command="phpcpd \-\-log-pmd=${dir.reports}/pmd-cpd.xml ${dir.src}" />
|
|
||||||
-->
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Mess detector -->
|
<!-- Mess detector -->
|
||||||
<target name="check:md" description="Generate code metrics">
|
<target name="check:md">
|
||||||
<echo msg="Generating code metrics..." />
|
|
||||||
<phpmd rulesets="codesize,controversial,design,naming,unusedcode">
|
<phpmd rulesets="codesize,controversial,design,naming,unusedcode">
|
||||||
<fileset refid="sourcecode" />
|
<fileset refid="sourcecode"/>
|
||||||
<formatter type="html" outfile="${dir.reports}/phpmd.html" />
|
<formatter type="html" outfile="${dir.reports}/phpmd.html"/>
|
||||||
<formatter type="text" outfile="${dir.reports}/phpmd.txt" />
|
<formatter type="text" outfile="${dir.reports}/phpmd.txt"/>
|
||||||
</phpmd>
|
</phpmd>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Code dependency -->
|
<!-- Code dependency -->
|
||||||
<target name="check:depend" description="Checks coupling and dependency">
|
<target name="check:depend">
|
||||||
<echo msg="Checking coupling and dependency..." />
|
|
||||||
<phpdepend>
|
<phpdepend>
|
||||||
<fileset refid="sourcecode" />
|
<fileset refid="sourcecode"/>
|
||||||
<logger type="jdepend-xml" outfile="${dir.reports.pdepend}/jdepend.xml" />
|
<logger type="jdepend-xml" outfile="${dir.reports.pdepend}/jdepend.xml"/>
|
||||||
<logger type="jdepend-chart" outfile="${dir.reports.pdepend}/dependencies.svg" />
|
<logger type="jdepend-chart" outfile="${dir.reports.pdepend}/dependencies.svg"/>
|
||||||
<logger type="overview-pyramid" outfile="${dir.reports.pdepend}/overview-pyramid.svg" />
|
<logger type="overview-pyramid" outfile="${dir.reports.pdepend}/overview-pyramid.svg"/>
|
||||||
</phpdepend>
|
</phpdepend>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Measure the size and analyzing the structure of a project -->
|
<!-- 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">
|
<target name="check:loc">
|
||||||
<echo msg="Measuring the size and analyzing the structure of a project..." />
|
|
||||||
<phploc reportType="txt" reportName="phploc" reportDirectory="${dir.reports}">
|
<phploc reportType="txt" reportName="phploc" reportDirectory="${dir.reports}">
|
||||||
<fileset refid="sourcecode" />
|
<fileset refid="sourcecode"/>
|
||||||
</phploc>
|
</phploc>
|
||||||
|
|
||||||
<!--
|
|
||||||
Previous / old version
|
|
||||||
|
|
||||||
Meritoo <github@meritoo.pl>
|
|
||||||
2017-02-22
|
|
||||||
|
|
||||||
<exec command="phploc \-\-log-csv=${dir.reports}/phploc.csv ${dir.src}" />
|
|
||||||
-->
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Unit tests -->
|
<!-- PHPUnit tests -->
|
||||||
<target name="test:unit" description="Runs unit tests">
|
<target name="test:phpunit">
|
||||||
<echo msg="Running unit tests..." />
|
<exec command="${tests.phpunit.command}" passthru="true"/>
|
||||||
<exec command="${tests.framework.path}" passthru="true"/>
|
</target>
|
||||||
|
|
||||||
|
<!-- Run mutation testing -->
|
||||||
|
<target name="test:infection">
|
||||||
|
<exec command="${tests.mutation.command}" passthru="true"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Checkout and finalization -->
|
<!-- Checkout and finalization -->
|
||||||
<target name="app:checkout">
|
<target name="app:checkout">
|
||||||
<tstamp>
|
<tstamp>
|
||||||
<format property="date_end" pattern="%Y-%m-%d %H:%M" />
|
<format property="date_end" pattern="%Y-%m-%d %H:%M"/>
|
||||||
</tstamp>
|
</tstamp>
|
||||||
|
|
||||||
<echo msg="--------------------------------------------" />
|
<echo msg="--------------------------------------------"/>
|
||||||
<echo msg="Build tests finished at: ${date_end}" />
|
<echo msg="Build tests finished at: ${date_end}"/>
|
||||||
<echo msg="--------------------------------------------" />
|
<echo msg="--------------------------------------------"/>
|
||||||
</target>
|
</target>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
Reference in New Issue
Block a user