build.phing.xml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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. <phplint>
  35. <fileset dir="${basedir}">
  36. <include name="**/*.php"/>
  37. </fileset>
  38. </phplint>
  39. </target>
  40. <target name="pdepend" description="Calculate software metrics using PHP_Depend">
  41. <exec executable="pdepend">
  42. <arg value="--jdepend-xml=${basedir}/tests/logs/jdepend.xml" />
  43. <arg value="--jdepend-chart=${basedir}/tests/pdepend/dependencies.svg" />
  44. <arg value="--overview-pyramid=${basedir}/tests/pdepend/overview-pyramid.svg" />
  45. <arg path="${basedir}" />
  46. </exec>
  47. </target>
  48. <target name="phpmd"
  49. description="Perform project mess detection using PHPMD and print human readable output. Intended for usage on the command line before committing.">
  50. <exec executable="phpmd">
  51. <arg path="${basedir}" />
  52. <arg value="text" />
  53. <arg value="${basedir}/tests/phpmd.xml" />
  54. </exec>
  55. </target>
  56. <target name="phpmd-ci" description="Perform project mess detection using PHPMD creating a log file for the continuous integration server">
  57. <exec executable="phpmd">
  58. <arg path="${basedir}" />
  59. <arg value="xml" />
  60. <arg value="${basedir}/tests/phpmd.xml" />
  61. <arg value="--reportfile" />
  62. <arg value="${basedir}/tests/logs/pmd.xml" />
  63. </exec>
  64. </target>
  65. <target name="phpcs"
  66. description="Find coding standard violations using PHP_CodeSniffer and print human readable output. Intended for usage on the command line before committing.">
  67. <exec executable="phpcs">
  68. <arg value="--standard=${basedir}/tests/phpcs.xml" />
  69. <arg path="${basedir}" />
  70. </exec>
  71. </target>
  72. <target name="phpcs-ci" description="Find coding standard violations using PHP_CodeSniffer creating a log file for the continuous integration server">
  73. <exec executable="phpcs" output="/dev/null">
  74. <arg value="--report=checkstyle" />
  75. <arg value="--report-file=${basedir}/tests/logs/checkstyle.xml" />
  76. <arg value="--standard=${basedir}/tests/phpcs.xml" />
  77. <arg path="${basedir}" />
  78. </exec>
  79. </target>
  80. <target name="simpletest" description="Run simpletests">
  81. <simpletest>
  82. <formatter type="plain"/>
  83. <fileset dir="${basedir}/tests">
  84. <include name="test_suite.php"/>
  85. </fileset>
  86. </simpletest>
  87. </target>
  88. <target name="phpdoc" description="Generate API documentation">
  89. <exec executable="phpdoc">
  90. <arg line="-d ${basedir} -t ${basedir}/logs/docs -i ${basedir}/tests,${basedir}/main/inc/entity,${basedir}/main/inc/lib/symfony,${basedir}/main/inc/lib/phpdocx,${basedir}/main/inc/lib/phpqrcode,${basedir}/main/inc/lib/mpdf,${basedir}/main/inc/lib/internationalization_database/transliteration,${basedir}/main/inc/lib/phpmailer,${basedir}/main/inc/lib/htmlpurifier,${basedir}/main/inc/lib/fckeditor,${basedir}/main/inc/lib/formvalidator,${basedir}/main/upload/users,${basedir}/main/lang,${basedir}/courses,${basedir}/archive,.htaccess" />
  91. </exec>
  92. </target>
  93. <target name="phpcb" description="Aggregate tool output with PHP_CodeBrowser">
  94. <exec executable="phpcb">
  95. <arg value="--log" />
  96. <arg path="${basedir}/tests/logs" />
  97. <arg value="--source" />
  98. <arg path="${basedir}" />
  99. <arg value="--output" />
  100. <arg path="${basedir}/tests/code-browser" />
  101. </exec>
  102. </target>
  103. </project>