You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

build.xml 6.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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. <arg value="--exclude" />
  62. <arg value="${basedir}/3rdparty/" />
  63. </exec>
  64. </target>
  65. <target name="pdepend"
  66. description="Calculate software metrics using PHP_Depend">
  67. <exec executable="pdepend">
  68. <arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml" />
  69. <arg value="--jdepend-chart=${basedir}/build/pdepend/dependencies.svg" />
  70. <arg value="--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg" />
  71. <arg value="--ignore=${basedir}/3rdparty/"/>
  72. <arg path="${basedir}" />
  73. </exec>
  74. </target>
  75. <target name="phpmd-ci"
  76. description="Perform project mess detection using PHPMD creating a log file for the continuous integration server">
  77. <exec executable="phpmd">
  78. <arg path="${basedir}" />
  79. <arg value="xml" />
  80. <arg value="${basedir}/build/phpmd.xml" />
  81. <arg value="--reportfile" />
  82. <arg value="${basedir}/build/logs/pmd.xml" />
  83. <arg value="--exclude" />
  84. <arg value="${basedir}/3rdparty/" />
  85. </exec>
  86. </target>
  87. <target name="phpmd"
  88. description="Perform project mess detection using PHPMD creating a log file for the continuous integration server">
  89. <exec executable="phpmd">
  90. <arg path="${basedir}" />
  91. <arg value="xml" />
  92. <arg value="${basedir}/build/phpmd.xml" />
  93. <arg value="--exclude" />
  94. <arg value="${basedir}/3rdparty/" />
  95. </exec>
  96. </target>
  97. <target name="phpcs-ci"
  98. description="Find coding standard violations using PHP_CodeSniffer creating a log file for the continuous integration server">
  99. <exec executable="phpcs" >
  100. <arg value="-p" />
  101. <arg value="-v" />
  102. <arg value="--tab-width=4" />
  103. <arg value="--report=checkstyle" />
  104. <arg value="--report-file=${basedir}/build/logs/checkstyle.xml" />
  105. <arg value="--standard=${basedir}/build/phpcs.xml" />
  106. <arg path="${basedir}" />
  107. </exec>
  108. </target>
  109. <target name="phpcs"
  110. description="Find coding standard violations using PHP_CodeSniffer creating a log file for the continuous integration server">
  111. <exec executable="phpcs" >
  112. <arg value="-p" />
  113. <arg value="-v" />
  114. <arg value="--tab-width=4" />
  115. <arg value="--standard=${basedir}/build/phpcs.xml" />
  116. <arg path="${basedir}" />
  117. </exec>
  118. </target>
  119. <target name="phpcpd" description="Find duplicate code using PHPCPD">
  120. <exec executable="phpcpd">
  121. <arg value="--exclude" />
  122. <arg value="${basedir}/3rdparty/" />
  123. <arg path="${basedir}" />
  124. </exec>
  125. </target>
  126. <target name="phpcpd-ci" description="Find duplicate code using PHPCPD">
  127. <exec executable="phpcpd">
  128. <arg value="--log-pmd" />
  129. <arg value="${basedir}/build/logs/pmd-cpd.xml" />
  130. <arg value="--exclude" />
  131. <arg value="${basedir}/3rdparty/" />
  132. <arg path="${basedir}" />
  133. </exec>
  134. </target>
  135. <!-- No idea if we need this within this build file. This is part of the release which is not contained within this script. -->
  136. <target name="phpdoc"
  137. description="Generate API documentation using PHPDocumentor">
  138. <!-- exec executable="phpdox"/ -->
  139. </target>
  140. <!-- currently we use autotest.sh for executing the unit tests against 3 different database setups -->
  141. <target name="phpunit" description="Run unit tests with PHPUnit">
  142. <echo message="TODO: phpunit goes here"/>
  143. <!-- exec executable="phpunit" failonerror="true"/ -->
  144. </target>
  145. <target name="phpcb-ci"
  146. description="Aggregate tool output with PHP_CodeBrowser">
  147. <exec executable="phpcb">
  148. <arg value="--log" />
  149. <arg path="${basedir}/build/logs" />
  150. <arg value="--source" />
  151. <arg path="${basedir}" />
  152. <arg value="--output" />
  153. <arg path="${basedir}/build/code-browser" />
  154. <arg value="--exclude" />
  155. <arg value="${basedir}/3rdparty/" />
  156. </exec>
  157. </target>
  158. </project>