Bez popisu

build.xml 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project name="File_Iterator" default="build">
  3. <property name="php" value="php"/>
  4. <property name="phpunit" value="phpunit"/>
  5. <target name="build"
  6. depends="prepare,lint,phploc,pdepend,phpmd-ci,phpcs-ci,phpcpd,phpcb"/>
  7. <target name="build-parallel"
  8. depends="prepare,lint,tools-parallel,phpcb"/>
  9. <target name="tools-parallel"
  10. description="Run tools in parallel">
  11. <parallel threadCount="2">
  12. <sequential>
  13. <antcall target="pdepend"/>
  14. <antcall target="phpmd-ci"/>
  15. </sequential>
  16. <antcall target="phpcpd"/>
  17. <antcall target="phpcs-ci"/>
  18. <antcall target="phploc"/>
  19. </parallel>
  20. </target>
  21. <target name="clean" description="Cleanup build artifacts">
  22. <delete dir="${basedir}/build/api"/>
  23. <delete dir="${basedir}/build/code-browser"/>
  24. <delete dir="${basedir}/build/coverage"/>
  25. <delete dir="${basedir}/build/logs"/>
  26. <delete dir="${basedir}/build/pdepend"/>
  27. </target>
  28. <target name="prepare" depends="clean,phpab"
  29. description="Prepare for build">
  30. <mkdir dir="${basedir}/build/api"/>
  31. <mkdir dir="${basedir}/build/code-browser"/>
  32. <mkdir dir="${basedir}/build/coverage"/>
  33. <mkdir dir="${basedir}/build/logs"/>
  34. <mkdir dir="${basedir}/build/pdepend"/>
  35. </target>
  36. <target name="phpab" description="Generate autoloader scripts">
  37. <exec executable="phpab">
  38. <arg value="--output" />
  39. <arg path="File/Iterator/Autoload.php" />
  40. <arg value="--template" />
  41. <arg path="File/Iterator/Autoload.php.in" />
  42. <arg value="--indent" />
  43. <arg value=" " />
  44. <arg path="File" />
  45. </exec>
  46. </target>
  47. <target name="lint">
  48. <apply executable="${php}" failonerror="true">
  49. <arg value="-l" />
  50. <fileset dir="${basedir}/File">
  51. <include name="**/*.php" />
  52. <modified />
  53. </fileset>
  54. <!--
  55. <fileset dir="${basedir}/Tests">
  56. <include name="**/*.php" />
  57. <modified />
  58. </fileset>
  59. -->
  60. </apply>
  61. </target>
  62. <target name="phploc" description="Measure project size using PHPLOC">
  63. <exec executable="phploc">
  64. <arg value="--log-csv" />
  65. <arg value="${basedir}/build/logs/phploc.csv" />
  66. <arg path="${basedir}/File" />
  67. </exec>
  68. </target>
  69. <target name="pdepend"
  70. description="Calculate software metrics using PHP_Depend">
  71. <exec executable="pdepend">
  72. <arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml" />
  73. <arg value="--jdepend-chart=${basedir}/build/pdepend/dependencies.svg" />
  74. <arg value="--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg" />
  75. <arg path="${basedir}/File" />
  76. </exec>
  77. </target>
  78. <target name="phpmd"
  79. description="Perform project mess detection using PHPMD">
  80. <exec executable="phpmd">
  81. <arg path="${basedir}/File" />
  82. <arg value="text" />
  83. <arg value="${basedir}/build/phpmd.xml" />
  84. </exec>
  85. </target>
  86. <target name="phpmd-ci"
  87. description="Perform project mess detection using PHPMD">
  88. <exec executable="phpmd">
  89. <arg path="${basedir}/File" />
  90. <arg value="xml" />
  91. <arg value="${basedir}/build/phpmd.xml" />
  92. <arg value="--reportfile" />
  93. <arg value="${basedir}/build/logs/pmd.xml" />
  94. </exec>
  95. </target>
  96. <target name="phpcs"
  97. description="Find coding standard violations using PHP_CodeSniffer">
  98. <exec executable="phpcs">
  99. <arg value="--standard=${basedir}/build/PHPCS" />
  100. <arg value="--extensions=php" />
  101. <arg value="--ignore=Autoload.php" />
  102. <arg path="${basedir}/File" />
  103. </exec>
  104. </target>
  105. <target name="phpcs-ci"
  106. description="Find coding standard violations using PHP_CodeSniffer">
  107. <exec executable="phpcs" output="/dev/null">
  108. <arg value="--report=checkstyle" />
  109. <arg value="--report-file=${basedir}/build/logs/checkstyle.xml" />
  110. <arg value="--standard=${basedir}/build/PHPCS" />
  111. <arg value="--extensions=php" />
  112. <arg value="--ignore=Autoload.php" />
  113. <arg path="${basedir}/File" />
  114. </exec>
  115. </target>
  116. <target name="phpcpd" description="Find duplicate code using PHPCPD">
  117. <exec executable="phpcpd">
  118. <arg value="--log-pmd" />
  119. <arg value="${basedir}/build/logs/pmd-cpd.xml" />
  120. <arg path="${basedir}/File" />
  121. </exec>
  122. </target>
  123. <target name="phpunit" description="Run unit tests with PHPUnit">
  124. <condition property="phpunit_cmd" value="${php} ${phpunit}" else="${phpunit}">
  125. <not>
  126. <equals arg1="${phpunit}" arg2="phpunit" />
  127. </not>
  128. </condition>
  129. <exec executable="${phpunit_cmd}" failonerror="true"/>
  130. </target>
  131. <target name="phpcb"
  132. description="Aggregate tool output with PHP_CodeBrowser">
  133. <exec executable="phpcb">
  134. <arg value="--log" />
  135. <arg path="${basedir}/build/logs" />
  136. <arg value="--source" />
  137. <arg path="${basedir}/File" />
  138. <arg value="--output" />
  139. <arg path="${basedir}/build/code-browser" />
  140. </exec>
  141. </target>
  142. </project>