build.xml 3.9 KB

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