1 <?xml version="1.0" encoding="UTF-8"?>
3 <project name="phpMyAdmin" default="build" basedir=".">
4 <property name="source" value="."/>
5 <property name="source_comma_sep" value="."/>
6 <property environment="env"/>
7 <property name="env.PHPUNIT_XML" value="phpunit.xml.dist"/>
8 <property name="env.PHPUNIT_ARGS" value="--testsuite unit"/>
10 <target name="clean" description="Clean up and create artifact directories">
11 <delete dir="${basedir}/build/api"/>
12 <delete dir="${basedir}/build/code-browser"/>
13 <delete dir="${basedir}/build/coverage"/>
14 <delete dir="${basedir}/build/logs"/>
15 <delete dir="${basedir}/build/pdepend"/>
17 <mkdir dir="${basedir}/build/api"/>
18 <mkdir dir="${basedir}/build/code-browser"/>
19 <mkdir dir="${basedir}/build/coverage"/>
20 <mkdir dir="${basedir}/build/logs"/>
21 <mkdir dir="${basedir}/build/pdepend"/>
24 <target name="phpunit" description="Run unit tests using PHPUnit and generates junit.xml and clover.xml">
25 <exec executable="${basedir}/vendor/bin/phpunit" failonerror="true">
26 <arg line="--configuration ${env.PHPUNIT_XML} ${env.PHPUNIT_ARGS}"/>
30 <target name="phpunit-nocoverage" description="Run unit tests using PHPUnit and generates junit.xml">
31 <exec executable="${basedir}/vendor/bin/phpunit" failonerror="true">
32 <arg line="--configuration --no-coverage ${env.PHPUNIT_ARGS}"/>
36 <target name="pdepend" description="Generate jdepend.xml and software metrics charts using PHP_Depend">
37 <exec executable="pdepend">
38 <arg line="'--jdepend-xml=${basedir}/build/logs/jdepend.xml'
39 '--jdepend-chart=${basedir}/build/pdepend/dependencies.svg'
40 '--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg'
41 ${source_comma_sep}" />
45 <target name="phpmd" description="Generate pmd.xml using PHPMD">
46 <exec executable="phpmd">
47 <arg line="${source_comma_sep}
49 codesize,design,naming,unusedcode
50 --exclude test,build,vendor,tmp
51 --reportfile '${basedir}/build/logs/pmd.xml'" />
55 <target name="phpcpd" description="Generate pmd-cpd.xml using PHPCPD">
56 <exec executable="phpcpd">
57 <arg line="--log-pmd '${basedir}/build/logs/pmd-cpd.xml'
66 <target name="phploc" description="Generate phploc.csv">
67 <exec executable="phploc">
68 <arg line="--log-csv '${basedir}/build/logs/phploc.csv'
77 <target name="phpcs-config" description="PHPCS configuration tweaking">
78 <exec executable="${basedir}/vendor/bin/phpcs">
79 <arg line="--config-set installed_paths ${basedir}/vendor/doctrine/coding-standard/lib,${basedir}/vendor/phpmyadmin/coding-standard,${basedir}/vendor/slevomat/coding-standard" />
83 <target name="phpcs" description="Generate checkstyle.xml using PHP_CodeSniffer excluding third party libraries" depends="phpcs-config">
84 <exec executable="${basedir}/vendor/bin/phpcs">
87 --report-file='${basedir}/build/logs/checkstyle.xml'
92 <target name="phpstan" description="Run phpstan static code analysis">
93 <exec executable="${basedir}/vendor/bin/phpstan" failonerror="true">
94 <redirector error="/dev/stdout" output="${basedir}/build/logs/phpstan.xml"/>
95 <arg line="analyse --error-format=checkstyle"/>
99 <target name="phpdoc" description="Generate API documentation using Doctum">
100 <!-- ant phpdoc -Denv.DOCTUM_BIN_PATH="/usr/bin/doctum" -->
101 <!-- please use 5.3.0 as a minimum version -->
102 <!-- Download the latest 5.x.x version -->
103 <!-- curl -o /bin/doctum https://doctum.long-term.support/releases/5/doctum.phar && chmod +x /bin/doctum -->
104 <property name="env.DOCTUM_BIN_PATH" value="/bin/doctum"/>
105 <exec executable="${env.DOCTUM_BIN_PATH}" failonerror="true">
106 <redirector error="${basedir}/build/logs/doctum.xml"/>
107 <arg line="--no-interaction update ./test/doctum-config.php -v --force --no-progress --no-ansi --output-format=checkstyle" />
111 <target name="phpcb" description="Aggregate tool output with PHP_CodeBrowser">
112 <exec executable="phpcb">
113 <arg line="--log '${basedir}/build/logs'
115 --output '${basedir}/build/code-browser'" />
119 <target name="eslint" description="Javascript checks">
120 <apply executable="${basedir}/node_modules/.bin/eslint" output="${basedir}/build/logs/eslint.xml" parallel="true">
121 <arg line="--format=checkstyle js/src" />
122 <fileset dir="${basedir}">
123 <include name="js/src/**/*.js" />
128 <target name="locales" description="Generate locales">
129 <exec executable="./scripts/generate-mo" failonerror="true">
130 <arg line="--quiet" />
134 <target name="lint" description="Perform syntax check of sourcecode files">
135 <apply executable="php" failonerror="true">
138 <fileset dir="${basedir}">
139 <include name="libraries/**/*.php" />
140 <include name="setup/**/*.php" />
141 <include name="test/**/*.php" />
142 <include name="*.php" />
148 <target name="build" depends="clean,phpunit,pdepend,phpmd,phpcpd,phpcs,phpdoc,phploc,phpcb,lint,eslint,locales"/>