build.xml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project name="pChart" default="build" basedir=".">
  3. <property name="source" value="src" />
  4. <target name="clean" description="Cleanup build artifacts">
  5. <delete dir="${basedir}/build/api"/>
  6. <delete dir="${basedir}/build/code-browser"/>
  7. <delete dir="${basedir}/build/logs"/>
  8. <delete dir="${basedir}/build/pdepend"/>
  9. </target>
  10. <target name="prepare" depends="clean" description="Prepare for build">
  11. <mkdir dir="${basedir}/build/api"/>
  12. <mkdir dir="${basedir}/build/code-browser"/>
  13. <mkdir dir="${basedir}/build/logs"/>
  14. <mkdir dir="${basedir}/build/pdepend"/>
  15. </target>
  16. <target name="build"
  17. depends="prepare,lint,phploc,pdepend,phpmd-ci,phpcs-ci,phpcpd,phpdoc,phpcb"/>
  18. <target name="build-parallel"
  19. depends="prepare,lint,tools-parallel,phpcb"/>
  20. <target name="tools-parallel" description="Run tools in parallel">
  21. <parallel threadCount="2">
  22. <sequential>
  23. <antcall target="pdepend"/>
  24. <antcall target="phpmd-ci"/>
  25. </sequential>
  26. <antcall target="phpcpd"/>
  27. <antcall target="phpcs-ci"/>
  28. <antcall target="phploc"/>
  29. <antcall target="phpdoc"/>
  30. </parallel>
  31. </target>
  32. <target name="lint" description="Perform syntax check of sourcecode files">
  33. <apply executable="php" failonerror="true">
  34. <arg value="-l" />
  35. <fileset dir="${basedir}/src">
  36. <include name="**/*.php" />
  37. <modified />
  38. </fileset>
  39. </apply>
  40. <exec executable="composer" failonerror="true">
  41. <arg value="validate" />
  42. </exec>
  43. </target>
  44. <target name="phploc" description="Measure project size using PHPLOC">
  45. <exec executable="phploc">
  46. <arg value="--log-csv" />
  47. <arg value="${basedir}/build/logs/phploc.csv" />
  48. <arg path="${basedir}/src" />
  49. </exec>
  50. </target>
  51. <target name="pdepend" description="Calculate software metrics using PHP_Depend">
  52. <exec executable="pdepend">
  53. <arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml" />
  54. <arg value="--jdepend-chart=${basedir}/build/pdepend/dependencies.svg" />
  55. <arg value="--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg" />
  56. <arg path="${basedir}/src" />
  57. </exec>
  58. </target>
  59. <target name="phpmd"
  60. description="Perform project mess detection using PHPMD and print human readable output. Intended for usage on the command line before committing.">
  61. <exec executable="phpmd">
  62. <arg path="${basedir}/src" />
  63. <arg value="text" />
  64. <arg value="${basedir}/build/phpmd.xml" />
  65. </exec>
  66. </target>
  67. <target name="phpmd-ci" description="Perform project mess detection using PHPMD creating a log file for the continuous integration server">
  68. <exec executable="phpmd">
  69. <arg path="${basedir}/src" />
  70. <arg value="xml" />
  71. <arg value="${basedir}/build/phpmd.xml" />
  72. <arg value="--reportfile" />
  73. <arg value="${basedir}/build/logs/pmd.xml" />
  74. </exec>
  75. </target>
  76. <target name="phpcs"
  77. description="Find coding standard violations using PHP_CodeSniffer and print human readable output. Intended for usage on the command line before committing.">
  78. <exec executable="phpcs">
  79. <arg value="--standard=PSR1" />
  80. <arg path="${basedir}/src" />
  81. </exec>
  82. </target>
  83. <target name="phpcs-ci" description="Find coding standard violations using PHP_CodeSniffer creating a log file for the continuous integration server">
  84. <exec executable="phpcs" output="/dev/null">
  85. <arg value="--report=checkstyle" />
  86. <arg value="--report-file=${basedir}/build/logs/checkstyle.xml" />
  87. <arg value="--standard=PSR1" />
  88. <arg path="${basedir}/src" />
  89. </exec>
  90. </target>
  91. <target name="phpcpd" description="Find duplicate code using PHPCPD">
  92. <exec executable="phpcpd">
  93. <arg value="--log-pmd" />
  94. <arg value="${basedir}/build/logs/pmd-cpd.xml" />
  95. <arg path="${basedir}/src" />
  96. </exec>
  97. </target>
  98. <target name="phpcb" description="Aggregate tool output with PHP_CodeBrowser">
  99. <exec executable="phpcb">
  100. <arg value="--log" />
  101. <arg path="${basedir}/build/logs" />
  102. <arg value="--source" />
  103. <arg path="${basedir}/src" />
  104. <arg value="--output" />
  105. <arg path="${basedir}/build/code-browser" />
  106. </exec>
  107. </target>
  108. <target name="phpdoc" description="Generate API documentation.">
  109. <exec executable="phpdoc">
  110. <arg value="-d"/>
  111. <arg value="${basedir}/src"/>
  112. <arg value="-t"/>
  113. <arg value="${basedir}/build/api/"/>
  114. </exec>
  115. </target>
  116. </project>