Merge remote-tracking branch 'origin/master'
[phpmyadmin.git] / build.xml
blobaa6dfe6f1c65c21ca5bbde3969d8be106875b631
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_XML_NOCOVERAGE" value="phpunit.xml.nocoverage"/>
9  <property name="env.PHPUNIT_XML_HHVM" value="phpunit.xml.hhvm"/>
10  <property name="env.PHPUNIT_ARGS" value=""/>
12  <target name="clean" description="Clean up and create artifact directories">
13   <delete dir="${basedir}/build/api"/>
14   <delete dir="${basedir}/build/code-browser"/>
15   <delete dir="${basedir}/build/coverage"/>
16   <delete dir="${basedir}/build/logs"/>
17   <delete dir="${basedir}/build/pdepend"/>
19   <mkdir dir="${basedir}/build/api"/>
20   <mkdir dir="${basedir}/build/code-browser"/>
21   <mkdir dir="${basedir}/build/coverage"/>
22   <mkdir dir="${basedir}/build/logs"/>
23   <mkdir dir="${basedir}/build/pdepend"/>
24  </target>
26  <target name="phpunit" description="Run unit tests using PHPUnit and generates junit.xml and clover.xml">
27   <exec executable="${basedir}/vendor/bin/phpunit" failonerror="true">
28       <arg line="--configuration ${env.PHPUNIT_XML} ${env.PHPUNIT_ARGS}"/>
29   </exec>
30  </target>
32  <target name="phpunit-nocoverage" description="Run unit tests using PHPUnit and generates junit.xml">
33   <exec executable="${basedir}/vendor/bin/phpunit" failonerror="true">
34       <arg line="--configuration ${env.PHPUNIT_XML_NOCOVERAGE} ${env.PHPUNIT_ARGS}"/>
35   </exec>
36  </target>
38  <target name="phpunit-hhvm" description="Run unit tests using PHPUnit with HHVM specific config">
39   <exec executable="${basedir}/vendor/bin/phpunit" failonerror="true">
40       <arg line="--configuration ${env.PHPUNIT_XML_HHVM} ${env.PHPUNIT_ARGS}"/>
41   </exec>
42  </target>
44  <target name="pdepend" description="Generate jdepend.xml and software metrics charts using PHP_Depend">
45   <exec executable="pdepend">
46    <arg line="'--jdepend-xml=${basedir}/build/logs/jdepend.xml'
47               '--jdepend-chart=${basedir}/build/pdepend/dependencies.svg'
48               '--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg'
49               ${source_comma_sep}" />
50   </exec>
51  </target>
53  <target name="phpmd" description="Generate pmd.xml using PHPMD">
54   <exec executable="phpmd">
55    <arg line="${source_comma_sep}
56               xml
57               codesize,design,naming,unusedcode
58               --exclude test,build,tcpdf,php-gettext,bfShapeFiles,PMAStandard,phpseclib,recaptchalib.php,swekey.php,vendor,sql-formatter
59               --reportfile '${basedir}/build/logs/pmd.xml'" />
60   </exec>
61  </target>
63  <target name="phpcpd" description="Generate pmd-cpd.xml using PHPCPD">
64   <exec executable="phpcpd">
65    <arg line="--log-pmd '${basedir}/build/logs/pmd-cpd.xml'
66               --exclude test
67               --exclude PMAStandard
68               --exclude build
69               --exclude vendor
70               --exclude libraries/tcpdf
71               --exclude libraries/php-gettext
72               --exclude libraries/bfShapeFiles
73               --exclude libraries/phpseclib
74               --exclude libraries/plugins/auth/recaptchalib.php
75               --exclude libraries/plugins/auth/swekey/swekey.php
76               --exclude libraries/sql-formatter/
77               ${source}" />
78   </exec>
79  </target>
81  <target name="phploc" description="Generate phploc.csv">
82   <exec executable="phploc">
83    <arg line="--log-csv '${basedir}/build/logs/phploc.csv'
84               --exclude test
85               --exclude PMAStandard
86               --exclude build
87               --exclude vendor
88               --exclude libraries/tcpdf
89               --exclude libraries/php-gettext
90               --exclude libraries/bfShapeFiles
91               --exclude libraries/phpseclib
92               --exclude libraries/plugins/auth/recaptchalib.php
93               --exclude libraries/plugins/auth/swekey/swekey.php
94               --exclude libraries/sql-formatter/
95               ${source}" />
96   </exec>
97  </target>
99  <target name="phpcs" description="Generate checkstyle.xml using PHP_CodeSniffer excluding third party libraries">
100   <exec executable="phpcs">
101    <arg line="
102               --ignore=*/php-gettext/*,*/vendor/*,*/tcpdf/*,*/canvg/*,*/codemirror/*,*/openlayers/*,*/jquery/*,*/jqplot/*,*/build/*,*/bfShapeFiles/*,*/PMAStandard/*,*/phpseclib/*,*/recaptcha/*,*/swekey/*,*/sql-formatter/*
103               --report=checkstyle
104               --extensions=php
105               --report-file='${basedir}/build/logs/checkstyle.xml'
106               --standard=PMAStandard
107               ${source}" />
108   </exec>
109  </target>
111  <target name="phpdoc" description="Generate API documentation using PHPDocumentor">
112   <exec executable="phpdoc">
113    <arg line="-d ${source} -t '${basedir}/build/api'" />
114   </exec>
115  </target>
117  <target name="phpcb" description="Aggregate tool output with PHP_CodeBrowser">
118   <exec executable="phpcb">
119    <arg line="--log    '${basedir}/build/logs'
120               --source '${source}'
121               --output '${basedir}/build/code-browser'" />
122   </exec>
123  </target>
125 <target name="jshint" description="Javascript checks">
126   <apply executable="jshint" output="${basedir}/build/logs/jshint-jslint.xml"  parallel="true">
127    <arg line="--config ./.jshintrc --reporter=jslint" />
128    <fileset dir="${basedir}">
129     <include name="js/pmd/*.js" />
130     <include name="js/*.js" />
131     <include name="setup/*.js" />
132    </fileset>
133   </apply>
134  </target>
136  <target name="jshint-checkstyle" description="Javascript checks">
137   <apply executable="jshint" output="${basedir}/build/logs/jshint-checkstyle.xml"  parallel="true">
138    <arg line="--config ./.jshintrc --reporter=checkstyle" />
139    <fileset dir="${basedir}">
140     <include name="js/pmd/*.js" />
141     <include name="js/*.js" />
142     <include name="setup/*.js" />
143    </fileset>
144   </apply>
145  </target>
147  <target name="locales" description="Generate locales">
148    <exec executable="./scripts/generate-mo" failonerror="true">
149      <arg line="--quiet" />
150    </exec>
151  </target>
153  <target name="lint" description="Perform syntax check of sourcecode files">
154   <apply executable="php" failonerror="true" output="${basedir}/build/logs/lint.log" logError="true">
155    <arg value="-l" />
157    <fileset dir="${basedir}">
158     <include name="libraries/**/*.php" />
159     <include name="setup/**/*.php" />
160     <include name="test/**/*.php" />
161     <include name="*.php" />
162     <modified />
163    </fileset>
164   </apply>
165  </target>
167  <target name="build" depends="clean,phpunit,pdepend,phpmd,phpcpd,phpcs,phpdoc,phploc,phpcb,lint,jshint,locales"/>
168 </project>