build.xml 4.2 KB

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