build.xml 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Set some basic project information and targets -->
  3. <project name="ss-panel" default="build">
  4. <target name="build"
  5. depends="prepare, lint, phploc, phpmd, phpcpd, phpcs, phpunit"/>
  6. <target name="build-parallel"
  7. depends="prepare,lint, tools-parallel, phpcpd, phpunit"/>
  8. <property environment="env"/>
  9. <target name="tools-parallel" description="Run tools in parallel">
  10. <parallel threadCount="2">
  11. <sequential>
  12. <antcall target="phpmd"/>
  13. </sequential>
  14. <antcall target="phpcpd"/>
  15. <antcall target="phpcs"/>
  16. <antcall target="phploc"/>
  17. <antcall target="phpdox"/>
  18. </parallel>
  19. </target>
  20. <!-- Clean up from previous builds -->
  21. <target name="clean" description="Cleanup build artifacts">
  22. <delete dir="${basedir}/build/coverage"/>
  23. <delete dir="${basedir}/build/logs"/>
  24. <delete dir="${basedir}/build/api"/>
  25. <delete dir="${basedir}/app/cache"/>
  26. </target>
  27. <!-- Prepare for the new build -->
  28. <target name="prepare" depends="clean" description="Prepare for build">
  29. <mkdir dir="${basedir}/build/coverage"/>
  30. <mkdir dir="${basedir}/build/logs"/>
  31. <mkdir dir="${basedir}/build/api"/>
  32. <mkdir dir="${basedir}/app/cache"/>
  33. </target>
  34. <!-- Lint the PHP files in app dir. Linting the whole ZF framework library takes forever -->
  35. <target name="lint" description="Perform syntax check of sourcecode files">
  36. <apply executable="php" failonerror="true">
  37. <arg value="-l" />
  38. <fileset dir="${basedir}/app">
  39. <include name="**/*.php" />
  40. <modified />
  41. </fileset>
  42. </apply>
  43. </target>
  44. <!-- PHPLoc (Lines Of Code) report -->
  45. <target name="phploc" description="Measure project size using PHPLOC">
  46. <exec executable="./vendor/bin/phploc">
  47. <arg value="--log-csv" />
  48. <arg value="${basedir}/logs/phploc.csv" />
  49. <arg path="${basedir}/app" />
  50. </exec>
  51. </target>
  52. <!-- PHP Mess Detector -->
  53. <target name="phpmd" description="Perform project mess detection using PHPMD creating a log file for the continuous integration server">
  54. <exec executable="./vendor/bin/phpmd">
  55. <arg path="${basedir}/app" />
  56. <arg value="xml" />
  57. <arg value="codesize,unusedcode,naming" />
  58. <arg value="--reportfile" />
  59. <arg value="${basedir}/build/logs/pmd.xml" />
  60. </exec>
  61. </target>
  62. <!-- PHP Copy Paste Detector -->
  63. <target name="phpcpd" description="Find duplicate code using PHPCPD">
  64. <exec executable="./vendor/bin/phpcpd">
  65. <arg value="--log-pmd" />
  66. <arg value="${basedir}/build/logs/pmd-cpd.xml" />
  67. <arg path="${basedir}/app" />
  68. </exec>
  69. </target>
  70. <!-- PHP Code Sniffer - tokenises PHP, JS and CSS files and detects violations of defined coding standards -->
  71. <target name="phpcs" description="Check code with PHP Code Sniffer">
  72. <exec executable="./vendor/bin/phpcs">
  73. <arg value="-n" />
  74. <arg path="${basedir}/app" />
  75. </exec>
  76. </target>
  77. <!-- Kick off phpunit - this requires 3.4.1 because of assertType(), deprecated in 3.5.x and removed from 3.6.x. -->
  78. <target name="phpunit">
  79. <exec dir="./tests" executable="./vendor/bin/phpunit" failonerror="true" description="Run unit tests with PHPUnit">
  80. <env key="app_ENV" value="testing"/>
  81. <arg line="--verbose --stderr" />
  82. </exec>
  83. </target>
  84. </project>