Merge pull request #17350 from jonahtanjz/17348-fix-html-code-formatting
[phpmyadmin.git] / build.xml
blob4e7215e135728f374a5e814223329e16153b20a5
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"/>
22  </target>
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}"/>
27   </exec>
28  </target>
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}"/>
33   </exec>
34  </target>
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}" />
42   </exec>
43  </target>
45  <target name="phpmd" description="Generate pmd.xml using PHPMD">
46   <exec executable="phpmd">
47    <arg line="${source_comma_sep}
48               xml
49               codesize,design,naming,unusedcode
50               --exclude test,build,vendor,tmp
51               --reportfile '${basedir}/build/logs/pmd.xml'" />
52   </exec>
53  </target>
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'
58               --exclude test
59               --exclude tmp
60               --exclude build
61               --exclude vendor
62               ${source}" />
63   </exec>
64  </target>
66  <target name="phploc" description="Generate phploc.csv">
67   <exec executable="phploc">
68    <arg line="--log-csv '${basedir}/build/logs/phploc.csv'
69               --exclude test
70               --exclude build
71               --exclude vendor
72               --exclude tmp
73               ${source}" />
74   </exec>
75  </target>
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" />
80   </exec>
81  </target>
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">
85    <arg line="
86               --report=checkstyle
87               --report-file='${basedir}/build/logs/checkstyle.xml'
88               ${source}" />
89   </exec>
90  </target>
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"/>
96   </exec>
97  </target>
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" />
108   </exec>
109  </target>
111  <target name="phpcb" description="Aggregate tool output with PHP_CodeBrowser">
112   <exec executable="phpcb">
113    <arg line="--log    '${basedir}/build/logs'
114               --source '${source}'
115               --output '${basedir}/build/code-browser'" />
116   </exec>
117  </target>
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" />
124    </fileset>
125   </apply>
126  </target>
128  <target name="locales" description="Generate locales">
129    <exec executable="./scripts/generate-mo" failonerror="true">
130      <arg line="--quiet" />
131    </exec>
132  </target>
134  <target name="lint" description="Perform syntax check of sourcecode files">
135   <apply executable="php" failonerror="true">
136    <arg value="-l" />
138    <fileset dir="${basedir}">
139     <include name="libraries/**/*.php" />
140     <include name="setup/**/*.php" />
141     <include name="test/**/*.php" />
142     <include name="*.php" />
143     <modified />
144    </fileset>
145   </apply>
146  </target>
148  <target name="build" depends="clean,phpunit,pdepend,phpmd,phpcpd,phpcs,phpdoc,phploc,phpcb,lint,eslint,locales"/>
149 </project>