build.xml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project name="ownCloud" default="build" xmlns:jsl="antlib:com.googlecode.jslint4java">
  3. <!-- the target 'build' can be used by developers for command line builds -->
  4. <target name="build" depends="prepare,lint,jslint,phploc,pdepend,phpmd,phpcs,phpcpd,phpdoc,phpunit"/>
  5. <!-- the target 'build-ci' is used within our Jenkins CI-server http://ci.tmit.eu -->
  6. <target name="build-ci" depends="prepare,lint,jslint-ci,phploc,pdepend,phpmd-ci,phpcs-ci,phpcpd-ci,phpdoc,phpunit,phpcb-ci"/>
  7. <!-- the target 'build-pullrequests' is used within our Jenkins CI-server for pull request analysis -->
  8. <target name="build-pullrequests" depends="prepare,lint,jslint-ci"/>
  9. <target name="clean" description="Cleanup build artifacts">
  10. <delete dir="${basedir}/build/api"/>
  11. <delete dir="${basedir}/build/code-browser"/>
  12. <delete dir="${basedir}/build/coverage"/>
  13. <delete dir="${basedir}/build/logs"/>
  14. <delete dir="${basedir}/build/pdepend"/>
  15. </target>
  16. <target name="prepare" depends="clean"
  17. description="Prepare for build">
  18. <mkdir dir="${basedir}/build/api"/>
  19. <mkdir dir="${basedir}/build/code-browser"/>
  20. <mkdir dir="${basedir}/build/coverage"/>
  21. <mkdir dir="${basedir}/build/logs"/>
  22. <mkdir dir="${basedir}/build/pdepend"/>
  23. </target>
  24. <!-- php syntax analysis -->
  25. <target name="lint">
  26. <apply executable="php" failonerror="true">
  27. <arg value="-l" />
  28. <fileset dir="${basedir}">
  29. <include name="**/*.php" />
  30. <exclude name="**/3rdparty/**" />
  31. <exclude name="**/l10n/**" />
  32. <!-- modified / -->
  33. </fileset>
  34. </apply>
  35. </target>
  36. <!-- javascript lint -->
  37. <target name="jslint-ci" description="Run the JSLint tool on JS files">
  38. <jsl:jslint options="white,sloppy,vars,bitwise,eqeq,browser" haltOnFailure="false">
  39. <jsl:predef>
  40. jQuery,$$,OC,$,oc_webroot,oc_appswebroots,oc_current_user,t,Files,FileList,FileActions,localStorage,OCCategories,EventSource,OCdialog,SVGSupport,dragOptions,dragOptions,folderDropOptions,formatDate,humanFileSize,procesSelection,relative_modified_date,scanFiles,simpleFileSize,simpleSize
  41. </jsl:predef>
  42. <!-- jsl:formatter type="plain" / -->
  43. <jsl:formatter type="xml" destfile="build/logs/jslint.xml" />
  44. <fileset dir="${basedir}" includes="**/*.js" excludes="**/*.min.js,**/3rdparty/**" />
  45. </jsl:jslint>
  46. </target>
  47. <target name="jslint" description="Run the JSLint tool on JS files">
  48. <jsl:jslint options="white,sloppy,vars,bitwise,eqeq,browser" haltOnFailure="false">
  49. <jsl:predef>
  50. jQuery,$$,OC,$,oc_webroot,oc_appswebroots,oc_current_user,t,Files,FileList,FileActions,localStorage,OCCategories,EventSource,OCdialog,SVGSupport,dragOptions,dragOptions,folderDropOptions,formatDate,humanFileSize,procesSelection,relative_modified_date,scanFiles,simpleFileSize,simpleSize
  51. </jsl:predef>
  52. <jsl:formatter type="plain" />
  53. <fileset dir="${basedir}" includes="**/*.js" excludes="**/*.min.js,**/3rdparty/**" />
  54. </jsl:jslint>
  55. </target>
  56. <target name="phploc" description="Measure project size using PHPLOC">
  57. <exec executable="phploc">
  58. <arg value="--log-csv" />
  59. <arg value="${basedir}/build/logs/phploc.csv" />
  60. <arg path="${basedir}" />
  61. </exec>
  62. </target>
  63. <target name="pdepend"
  64. description="Calculate software metrics using PHP_Depend">
  65. <exec executable="pdepend">
  66. <arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml" />
  67. <arg value="--jdepend-chart=${basedir}/build/pdepend/dependencies.svg" />
  68. <arg value="--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg" />
  69. <arg value="--ignore=${basedir}/3rdparty/"/>
  70. <arg path="${basedir}" />
  71. </exec>
  72. </target>
  73. <target name="phpmd-ci"
  74. description="Perform project mess detection using PHPMD creating a log file for the continuous integration server">
  75. <exec executable="phpmd">
  76. <arg path="${basedir}" />
  77. <arg value="xml" />
  78. <arg value="${basedir}/build/phpmd.xml" />
  79. <arg value="--reportfile" />
  80. <arg value="${basedir}/build/logs/pmd.xml" />
  81. <arg value="--exclude" />
  82. <arg value="${basedir}/3rdparty/" />
  83. </exec>
  84. </target>
  85. <target name="phpmd"
  86. description="Perform project mess detection using PHPMD creating a log file for the continuous integration server">
  87. <exec executable="phpmd">
  88. <arg path="${basedir}" />
  89. <arg value="xml" />
  90. <arg value="${basedir}/build/phpmd.xml" />
  91. <arg value="--exclude" />
  92. <arg value="${basedir}/3rdparty/" />
  93. </exec>
  94. </target>
  95. <target name="phpcs-ci"
  96. description="Find coding standard violations using PHP_CodeSniffer creating a log file for the continuous integration server">
  97. <exec executable="phpcs" >
  98. <arg value="-p" />
  99. <arg value="-v" />
  100. <arg value="--tab-width=4" />
  101. <arg value="--report=checkstyle" />
  102. <arg value="--report-file=${basedir}/build/logs/checkstyle.xml" />
  103. <arg value="--standard=${basedir}/build/phpcs.xml" />
  104. <arg path="${basedir}" />
  105. </exec>
  106. </target>
  107. <target name="phpcs"
  108. description="Find coding standard violations using PHP_CodeSniffer creating a log file for the continuous integration server">
  109. <exec executable="phpcs" >
  110. <arg value="-p" />
  111. <arg value="-v" />
  112. <arg value="--tab-width=4" />
  113. <arg value="--standard=${basedir}/build/phpcs.xml" />
  114. <arg path="${basedir}" />
  115. </exec>
  116. </target>
  117. <target name="phpcpd" description="Find duplicate code using PHPCPD">
  118. <exec executable="phpcpd">
  119. <arg value="--exclude" />
  120. <arg value="${basedir}/3rdparty/" />
  121. <arg path="${basedir}" />
  122. </exec>
  123. </target>
  124. <target name="phpcpd-ci" description="Find duplicate code using PHPCPD">
  125. <exec executable="phpcpd">
  126. <arg value="--log-pmd" />
  127. <arg value="${basedir}/build/logs/pmd-cpd.xml" />
  128. <arg value="--exclude" />
  129. <arg value="${basedir}/3rdparty/" />
  130. <arg path="${basedir}" />
  131. </exec>
  132. </target>
  133. <!-- No idea if we need this within this build file. This is part of the release which is not contained within this script. -->
  134. <target name="phpdoc"
  135. description="Generate API documentation using PHPDocumentor">
  136. <!-- exec executable="phpdox"/ -->
  137. </target>
  138. <!-- currently we use autotest.sh for executing the unit tests against 3 different database setups -->
  139. <target name="phpunit" description="Run unit tests with PHPUnit">
  140. <echo message="TODO: phpunit goes here"/>
  141. <!-- exec executable="phpunit" failonerror="true"/ -->
  142. </target>
  143. <target name="phpcb-ci"
  144. description="Aggregate tool output with PHP_CodeBrowser">
  145. <exec executable="phpcb">
  146. <arg value="--log" />
  147. <arg path="${basedir}/build/logs" />
  148. <arg value="--source" />
  149. <arg path="${basedir}" />
  150. <arg value="--output" />
  151. <arg path="${basedir}/build/code-browser" />
  152. </exec>
  153. </target>
  154. </project>