Sin descripción

build.xml 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project name="PHP_Timer" 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,phpunit,phpcb"/>
  7. <target name="build-parallel"
  8. depends="prepare,lint,tools-parallel,phpunit,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="PHP/Timer/Autoload.php" />
  40. <arg value="--template" />
  41. <arg path="PHP/Timer/Autoload.php.in" />
  42. <arg value="--indent" />
  43. <arg value=" " />
  44. <arg path="PHP" />
  45. </exec>
  46. </target>
  47. <target name="lint">
  48. <apply executable="${php}" failonerror="true">
  49. <arg value="-l" />
  50. <fileset dir="${basedir}/PHP">
  51. <include name="**/*.php" />
  52. <modified />
  53. </fileset>
  54. <fileset dir="${basedir}/Tests">
  55. <include name="**/*.php" />
  56. <modified />
  57. </fileset>
  58. </apply>
  59. </target>
  60. <target name="phploc" description="Measure project size using PHPLOC">
  61. <exec executable="phploc">
  62. <arg value="--log-csv" />
  63. <arg value="${basedir}/build/logs/phploc.csv" />
  64. <arg path="${basedir}/PHP" />
  65. </exec>
  66. </target>
  67. <target name="pdepend"
  68. description="Calculate software metrics using PHP_Depend">
  69. <exec executable="pdepend">
  70. <arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml" />
  71. <arg value="--jdepend-chart=${basedir}/build/pdepend/dependencies.svg" />
  72. <arg value="--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg" />
  73. <arg path="${basedir}/PHP" />
  74. </exec>
  75. </target>
  76. <target name="phpmd"
  77. description="Perform project mess detection using PHPMD">
  78. <exec executable="phpmd">
  79. <arg path="${basedir}/PHP" />
  80. <arg value="text" />
  81. <arg value="${basedir}/build/phpmd.xml" />
  82. </exec>
  83. </target>
  84. <target name="phpmd-ci"
  85. description="Perform project mess detection using PHPMD">
  86. <exec executable="phpmd">
  87. <arg path="${basedir}/PHP" />
  88. <arg value="xml" />
  89. <arg value="${basedir}/build/phpmd.xml" />
  90. <arg value="--reportfile" />
  91. <arg value="${basedir}/build/logs/pmd.xml" />
  92. </exec>
  93. </target>
  94. <target name="phpcs"
  95. description="Find coding standard violations using PHP_CodeSniffer">
  96. <exec executable="phpcs">
  97. <arg value="--standard=${basedir}/build/PHPCS" />
  98. <arg value="--extensions=php" />
  99. <arg value="--ignore=Autoload.php" />
  100. <arg path="${basedir}/PHP" />
  101. </exec>
  102. </target>
  103. <target name="phpcs-ci"
  104. description="Find coding standard violations using PHP_CodeSniffer">
  105. <exec executable="phpcs" output="/dev/null">
  106. <arg value="--report=checkstyle" />
  107. <arg value="--report-file=${basedir}/build/logs/checkstyle.xml" />
  108. <arg value="--standard=${basedir}/build/PHPCS" />
  109. <arg value="--extensions=php" />
  110. <arg value="--ignore=Autoload.php" />
  111. <arg path="${basedir}/PHP" />
  112. </exec>
  113. </target>
  114. <target name="phpcpd" description="Find duplicate code using PHPCPD">
  115. <exec executable="phpcpd">
  116. <arg value="--log-pmd" />
  117. <arg value="${basedir}/build/logs/pmd-cpd.xml" />
  118. <arg path="${basedir}/PHP" />
  119. </exec>
  120. </target>
  121. <target name="phpunit" description="Run unit tests with PHPUnit">
  122. <condition property="phpunit_cmd" value="${php} ${phpunit}" else="${phpunit}">
  123. <not>
  124. <equals arg1="${phpunit}" arg2="phpunit" />
  125. </not>
  126. </condition>
  127. <exec executable="${phpunit_cmd}" failonerror="true"/>
  128. </target>
  129. <target name="phpcb"
  130. description="Aggregate tool output with PHP_CodeBrowser">
  131. <exec executable="phpcb">
  132. <arg value="--log" />
  133. <arg path="${basedir}/build/logs" />
  134. <arg value="--source" />
  135. <arg path="${basedir}/PHP" />
  136. <arg value="--output" />
  137. <arg path="${basedir}/build/code-browser" />
  138. </exec>
  139. </target>
  140. </project>