XML   42

build xml

Guest on 18th May 2022 08:28:25 AM

  1. <!--  build xml  -->
  2. <project name="services_openstreetmap" default="main" phingVersion="2.11.0">
  3. <property name="builddir" value="build"/>
  4. <available file="${builddir}/docs" property="docs_exist" value="Y"/>
  5. <available file="${builddir}/logs/pmd.xml" property="pmd_exist" value="Y"/>
  6. <available file="${builddir}/logs/checkstyle.xml" property="phpcs_exist" value="Y"/>
  7. <available file="${builddir}/coverage" property="coverage_exist" value="Y"/>
  8. <available file="${builddir}/pdepend" property="pdepend_exist" value="Y"/>
  9. <available file="/usr/local/bin/phpcpd.phar" property="phpcpd_phar" value="Y"/>
  10. <available file="/usr/local/bin/phploc.phar" property="phploc_phar" value="Y"/>
  11. <fileset dir="tests" id="tests" includes="**/*.php"/>
  12. <fileset dir="Services" id="Services" includes="**/*.php"/>
  13. <target name="prepare">
  14. <mkdir dir="${builddir}"/>
  15. <mkdir dir="${builddir}/logs"/>
  16. <mkdir dir="${builddir}/coverage"/>
  17. </target>
  18. <target name="main" depends="prepare,clean,lint,phpcs,phpmd,docs,test,phpcpd,phploc,phpdepend"/>
  19. <target name="clean" depends="clean_phpunit,clean_pmd,clean_phpcs,clean_docs,clean_phploc,clean_phpcpd,clean_phpdepend" description="Clean out all files."/>
  20. <target name="clean_docs" if="docs_exist">
  21. <delete dir="${builddir}/docs" includeemptydirs="yes"/>
  22. </target>
  23. <target name="clean_phpcpd">
  24. <delete verbose="yes">
  25. <fileset dir="${builddir}/logs">
  26. <include name="pmd-cpd.csv"/>
  27. </fileset>
  28. </delete>
  29. </target>
  30. <target name="clean_phpcs" description="Clean PHPCS files." if="phpcs_exist">
  31. <delete verbose="yes">
  32. <fileset dir="${builddir}/logs">
  33. <include name="**.*"/>
  34. </fileset>
  35. </delete>
  36. </target>
  37. <target name="clean_phpdepend" description="Clean phpdepend files" if="pdepend_exist">
  38. <delete verbose="yes">
  39. <fileset dir="${builddir}/logs">
  40. <include name="jdepend.xml"/>
  41. </fileset>
  42. </delete>
  43. <delete dir="${builddir}/pdepend" includeemptydirs="yes"/>
  44. </target>
  45. <target name="clean_phploc">
  46. <delete verbose="yes">
  47. <fileset dir="${builddir}/logs">
  48. <include name="phploc.csv"/>
  49. </fileset>
  50. </delete>
  51. </target>
  52. <target name="clean_phpunit" if="coverage_exist">
  53. <delete verbose="yes">
  54. <fileset dir="${builddir}/coverage/">
  55. <include name="coverage.xml"/>
  56. <include name="coverage.db"/>
  57. </fileset>
  58. </delete>
  59. <delete verbose="no" dir="${builddir}/coverage" includeemptydirs="yes"/>
  60. </target>
  61. <target name="clean_pmd" description="Clean Mess Detector file[s]." if="pmd_exist">
  62. <delete verbose="yes">
  63. <fileset dir="${builddir}/logs">
  64. <include name="pmd.xml"/>
  65. </fileset>
  66. </delete>
  67. </target>
  68. <target name="delete_build" description="Delete build directory.">
  69. <delete dir="${builddir}" includeemptydirs="yes"/>
  70. </target>
  71. <target name="docs" description="Generate Documentation" depends="clean_docs">
  72. <mkdir dir="build/docs"/>
  73. <touch file="build/docs/index.html"/>
  74. <!--
  75.        <phpdoc2 title="Services_Openstreetmap" destdir="build/docs">
  76.            <fileset refid="Services"/>
  77.        </phpdoc2>
  78.         -->
  79. </target>
  80. <target name="phpcpd" description="Generate pmd-cpd.xml using PHPCPD" depends="prepare">
  81. <if>
  82. <equals arg1="${phpcpd_phar}" arg2="Y"/>
  83. <then>
  84. <phpcpd pharLocation="/usr/local/bin/phpcpd.phar">
  85. <formatter type="pmd" outfile="${builddir}/logs/pmd-cpd.xml"/>
  86. <fileset refid="Services"/>
  87. </phpcpd>
  88. </then>
  89. <else>
  90. <phpcpd>
  91. <formatter type="pmd" outfile="${builddir}/logs/pmd-cpd.xml"/>
  92. <fileset refid="Services"/>
  93. </phpcpd>
  94. </else>
  95. </if>
  96. </target>
  97. <target name="phpcs" description="coding standards">
  98. <phpcodesniffer format="checkstyle" standard="PEAR" haltonerror="no">
  99. <formatter type="checkstyle" outfile="${builddir}/logs/checkstyle.xml"/>
  100. <fileset refid="Services"/>
  101. </phpcodesniffer>
  102. </target>
  103. <target name="phpdepend" description="Calculate software metrics using PHP_Depend" depends="prepare">
  104. <mkdir dir="${builddir}/pdepend"/>
  105. <phpdepend>
  106. <logger type="jdepend-xml" outfile="${builddir}/logs/jdepend.xml"/>
  107. <logger type="jdepend-chart" outfile="${builddir}/pdepend/dependencies.svg"/>
  108. <logger type="overview-pyramid" outfile="${builddir}/pdepend/overview-pyramid.svg"/>
  109. <fileset refid="Services"/>
  110. <fileset refid="tests"/>
  111. </phpdepend>
  112. </target>
  113. <target name="phploc" description="Measure project size using PHPLOC" depends="prepare">
  114. <if>
  115. <equals arg1="${phploc_phar}" arg2="Y"/>
  116. <then>
  117. <phploc pharLocation="/usr/local/bin/phploc.phar" countTests="true" reportType="csv" reportName="phploc" reportDirectory="${builddir}/logs">
  118. <fileset refid="Services"/>
  119. <fileset refid="tests"/>
  120. </phploc>
  121. </then>
  122. <else>
  123. <phploc countTests="true" reportType="csv" reportName="phploc" reportDirectory="${builddir}/logs">
  124. <fileset refid="Services"/>
  125. <fileset refid="tests"/>
  126. </phploc>
  127. </else>
  128. </if>
  129. </target>
  130. <target name="phpmd" description="PHP Mess Detector.">
  131. <phpmd rulesets="unusedcode">
  132. <fileset refid="Services"/>
  133. <formatter type="xml" outfile="build/logs/pmd.xml"/>
  134. </phpmd>
  135. </target>
  136. <target name="lint" description="Check syntax">
  137. <phplint>
  138. <fileset refid="Services"/>
  139. <fileset refid="tests"/>
  140. </phplint>
  141. </target>
  142. <target name="prepare">
  143. <mkdir dir="${builddir}/logs"/>
  144. <mkdir dir="${builddir}/coverage"/>
  145. </target>
  146. <target name="test" description="run unit tests" depends="lint,clean_phpunit,prepare">
  147. <echo msg="Run unit tests"/>
  148. <mkdir dir="tests/coverage"/>
  149. <coverage-setup database="./coverage.db">
  150. <fileset dir="tests" includes="**/*.php"/>
  151. <fileset dir="Services" includes="**/*.php"/>
  152. </coverage-setup>
  153. <phpunit printsummary="yes" codecoverage="yes" pharlocation="/usr/local/bin/phpunit">
  154. <formatter type="clover" outfile="${builddir}/logs/clover.xml"/>
  155. <formatter type="xml" outfile="${builddir}/logs/junit.xml"/>
  156. <formatter type="plain" usefile="no"/>
  157. <batchtest>
  158. <fileset refid="tests"/>
  159. </batchtest>
  160. </phpunit>
  161. <coverage-report outfile="coverage.xml">
  162. <report todir="tests/coverage" usesorttable="yes" styledir="/usr/share/php/data/phing/etc"/>
  163. </coverage-report>
  164. </target>
  165. <target name="clean" depends="clean_phpunit,clean_docs,clean_pmd"/>
  166. <target name="clean_phpunit" if="coverage_exist">
  167. <delete verbose="yes">
  168. <fileset dir="tests/coverage">
  169. <include name="**.*"/>
  170. </fileset>
  171. </delete>
  172. <delete verbose="no" dir="tests/coverage"/>
  173. </target>
  174. <target name="clean_docs" if="docs_exist">
  175. <delete verbose="yes">
  176. <fileset dir="build/docs">
  177. <include name="**.*"/>
  178. </fileset>
  179. </delete>
  180. </target>
  181. <target name="clean_pmd" description="Clean Mess Detector file[s]." if="pmd_exist">
  182. <delete verbose="yes">
  183. <fileset dir="build">
  184. <include name="phpmd.xml"/>
  185. </fileset>
  186. </delete>
  187. </target>
  188. <target name="stan">
  189. <phpstan command="analyse" level="7" paths="Services"/>
  190. </target>
  191. </project>

Raw Paste


Login or Register to edit or fork this paste. It's free.