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 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. <?xml version="1.0"?>
  2. <project name="vaadin-uitest" basedir="." default="publish-local"
  3. xmlns:ivy="antlib:org.apache.ivy.ant">
  4. <description>
  5. Provides a uitest WAR containing Vaadin UI tests
  6. </description>
  7. <include file="../common.xml" as="common" />
  8. <include file="../build.xml" as="vaadin" />
  9. <!-- global properties -->
  10. <property name="module.name" value="vaadin-uitest" />
  11. <property name="uitest.dir" location="${vaadin.basedir}/uitest" />
  12. <property name="result.dir" value="result" />
  13. <property name="theme.result.dir" value="${result.dir}/VAADIN/themes" />
  14. <property name="result.war"
  15. location="${result.dir}/lib/${module.name}-${vaadin.version}.war" />
  16. <path id="classpath.compile.custom">
  17. </path>
  18. <target name="dependencies">
  19. <!-- This is copied from common.xml to be able to add server.test.source
  20. to the source path -->
  21. <ivy:resolve log="download-only" resolveid="common"
  22. conf="build, build-provided" />
  23. <ivy:cachepath pathid="classpath.compile.dependencies"
  24. conf="build, build-provided" />
  25. </target>
  26. <target name="compile" description="Compiles the module"
  27. depends="dependencies">
  28. <fail unless="module.name" message="No module name given" />
  29. <property name="result.dir" location="result" />
  30. <property name="src" location="${result.dir}/../src" />
  31. <property name="classes" location="${result.dir}/classes" />
  32. <property name="server.test.sources" location="${result.dir}/../../server/tests/src" />
  33. <mkdir dir="${classes}" />
  34. <!-- TODO: Get rid of this -->
  35. <javac destdir="${classes}" source="${vaadin.java.version}"
  36. target="${vaadin.java.version}" debug="true" encoding="UTF-8"
  37. includeantruntime="false">
  38. <src path="${server.test.sources}" />
  39. <include name="com/vaadin/tests/data/bean/**" />
  40. <include name="com/vaadin/tests/VaadinClasses.java" />
  41. <include
  42. name="com/vaadin/data/util/sqlcontainer/SQLTestsConstants.java" />
  43. <classpath refid="classpath.compile.dependencies" />
  44. <classpath refid="classpath.compile.custom" />
  45. </javac>
  46. <javac destdir="${classes}" source="${vaadin.java.version}"
  47. target="${vaadin.java.version}" debug="true" encoding="UTF-8"
  48. includeantruntime="false">
  49. <src path="${src}" />
  50. <classpath location="${classes}" />
  51. <classpath refid="classpath.compile.dependencies" />
  52. <classpath refid="classpath.compile.custom" />
  53. </javac>
  54. </target>
  55. <target name="testing-widgetset" depends="dependencies,compile">
  56. <property name="module"
  57. value="com.vaadin.tests.widgetset.TestingWidgetSet" />
  58. <property name="style" value="OBF" />
  59. <property name="localWorkers" value="6" />
  60. <property name="extraParams" value="" />
  61. <property name="module.output.dir" location="${result.dir}/VAADIN/widgetsets" />
  62. <property name="work.dir" location="${result.dir}/work" />
  63. <mkdir dir="${module.output.dir}" />
  64. <echo>Compiling ${module} to ${module.output.dir}</echo>
  65. <!-- compile the module -->
  66. <java classname="com.google.gwt.dev.Compiler" classpathref="classpath.compile.dependencies"
  67. failonerror="yes" fork="yes" maxmemory="512m">
  68. <classpath location="src" />
  69. <classpath location="${classes}" />
  70. <arg value="-workDir" />
  71. <arg value="${work.dir}" />
  72. <arg value="-logLevel" />
  73. <arg value="TRACE" />
  74. <arg value="-war" />
  75. <arg value="${module.output.dir}" />
  76. <arg value="-style" />
  77. <arg value="${style}" />
  78. <arg value="-localWorkers" />
  79. <arg value="${localWorkers}" />
  80. <arg value="-strict" />
  81. <arg line="${extraParams}" />
  82. <arg value="${module}" />
  83. <sysproperty key="vFailIfNotSerializable" value="true" />
  84. <jvmarg value="-Xss8M" />
  85. <jvmarg value="-XX:MaxPermSize=256M" />
  86. <jvmarg value="-Djava.awt.headless=true" />
  87. </java>
  88. </target>
  89. <target name="war"
  90. depends="dependencies, compile, compile-test-themes, testing-widgetset">
  91. <property name="result.dir" location="result" />
  92. <property name="classes" location="${result.dir}/classes" />
  93. <property name="WebContent.dir" location="${vaadin.basedir}/WebContent" />
  94. <property name="deps.dir" location="${result.dir}/deps" />
  95. <property name="src" location="${result.dir}/../src" />
  96. <ivy:resolve log="download-only" resolveid="common"
  97. conf="build" />
  98. <ivy:cachepath pathid="classpath.runtime.dependencies"
  99. conf="build" />
  100. <delete dir="${deps.dir}" />
  101. <mkdir dir="${deps.dir}" />
  102. <copy todir="${deps.dir}" flatten="true">
  103. <path refid="classpath.runtime.dependencies" />
  104. </copy>
  105. <delete>
  106. <!-- Avoid including some potentially conflicting jars in the
  107. war -->
  108. <fileset dir="${deps.dir}" includes="jetty-*.jar" />
  109. <fileset dir="${deps.dir}" includes="servlet-api-*.jar" />
  110. </delete>
  111. <war destfile="${result.war}" duplicate="fail" index="true">
  112. <fileset dir="${common.jarfiles.dir}" />
  113. <fileset dir="${result.dir}">
  114. <include name="VAADIN/widgetsets/**/*" />
  115. <include name="VAADIN/themes/tests-valo*/**" />
  116. </fileset>
  117. <fileset dir="${WebContent.dir}">
  118. <include name="statictestfiles/**" />
  119. <include name="VAADIN/themes/tests-*/**" />
  120. <!-- Scss themes compiled and included above -->
  121. <exclude name="VAADIN/themes/tests-valo*/**" />
  122. <include name="VAADIN/themes/reindeer-tests/**" />
  123. <include name="VAADIN/jquery.atmosphere.js" />
  124. <include name="WEB-INF/*.xml" />
  125. <include name="WEB-INF/web.xml.2.4" />
  126. </fileset>
  127. <classes dir="${classes}" />
  128. <classes dir="${src}" />
  129. <lib dir="${deps.dir}" />
  130. </war>
  131. </target>
  132. <target name="publish-local" depends="war">
  133. <antcall target="common.publish-local">
  134. <param name="conf" value="build" />
  135. </antcall>
  136. </target>
  137. <target name="clean">
  138. <antcall target="common.clean" />
  139. </target>
  140. <target name="checkstyle">
  141. <echo>Checkstyle is disabled for uitest for now</echo>
  142. </target>
  143. <target name="test" depends="checkstyle">
  144. </target>
  145. <target name="test-testbench" depends="clean-testbench-errors"
  146. description="Run all TestBench based tests, including server tests">
  147. <parallel>
  148. <daemons>
  149. <!-- Start server -->
  150. <ant antfile="${uitest.dir}/vaadin-server.xml"
  151. inheritall="true" inheritrefs="true" target="deploy-and-start" />
  152. </daemons>
  153. <sequential>
  154. <!-- Server tests -->
  155. <!-- Sleep before running integration tests so testbench
  156. 2 tests have time to compile and start -->
  157. <sleep minutes="4" />
  158. <ant antfile="${uitest.dir}/integration_tests.xml"
  159. target="integration-test-all" inheritall="false"
  160. inheritrefs="false">
  161. <property name="demo.war" value="${war.file}" />
  162. </ant>
  163. </sequential>
  164. <sequential>
  165. <!-- Wait for server to start -->
  166. <ant antfile="${uitest.dir}/vaadin-server.xml"
  167. target="wait-for-startup" />
  168. <!-- Run all different kinds of TestBench tests in parallel -->
  169. <parallel>
  170. <!-- Legacy TestBench 2 tests -->
  171. <sequential>
  172. <ant antfile="${uitest.dir}/test.xml"
  173. target="tb2-tests" />
  174. <echo message="TestBench 2 tests complete" />
  175. </sequential>
  176. <!-- TestBench 3 tests -->
  177. <sequential>
  178. <ant antfile="${uitest.dir}/tb3test.xml"
  179. target="run-all-tb3-tests" inheritall="true" />
  180. <echo message="TestBench 3 tests complete" />
  181. </sequential>
  182. </parallel>
  183. </sequential>
  184. </parallel>
  185. </target>
  186. <target name="test-server" depends="clean-testbench-errors">
  187. <property name="war.file"
  188. location="${vaadin.basedir}/result/artifacts/${vaadin.version}/vaadin-uitest/vaadin-uitest-${vaadin.version}.war" />
  189. <parallel>
  190. <daemons>
  191. <ant antfile="${uitest.dir}/vaadin-server.xml"
  192. inheritall="true" inheritrefs="true" target="deploy-and-start" />
  193. </daemons>
  194. <sequential>
  195. <ant antfile="${uitest.dir}/integration_tests.xml"
  196. target="integration-test-all" inheritall="false"
  197. inheritrefs="false">
  198. <property name="demo.war" value="${war.file}" />
  199. </ant>
  200. </sequential>
  201. </parallel>
  202. </target>
  203. <target name="test-tb2" depends="clean-testbench-errors">
  204. <property name="war.file"
  205. location="${vaadin.basedir}/result/artifacts/${vaadin.version}/vaadin-uitest/vaadin-uitest-${vaadin.version}.war" />
  206. <parallel>
  207. <daemons>
  208. <ant antfile="${uitest.dir}/vaadin-server.xml"
  209. inheritall="true" inheritrefs="true" target="deploy-and-start" />
  210. </daemons>
  211. <sequential>
  212. <ant antfile="${uitest.dir}/vaadin-server.xml"
  213. target="wait-for-startup" />
  214. <ant antfile="${uitest.dir}/test.xml" target="tb2-tests" />
  215. </sequential>
  216. </parallel>
  217. </target>
  218. <target name="test-tb3" depends="clean-testbench-errors">
  219. <property name="war.file"
  220. location="${vaadin.basedir}/result/artifacts/${vaadin.version}/vaadin-uitest/vaadin-uitest-${vaadin.version}.war" />
  221. <parallel>
  222. <daemons>
  223. <ant antfile="${uitest.dir}/vaadin-server.xml"
  224. inheritall="true" inheritrefs="true" target="deploy-and-start" />
  225. </daemons>
  226. <sequential>
  227. <ant antfile="${uitest.dir}/vaadin-server.xml"
  228. target="wait-for-startup" />
  229. <ant antfile="${uitest.dir}/tb3test.xml" target="run-all-tb3-tests"
  230. inheritall="true" />
  231. </sequential>
  232. </parallel>
  233. </target>
  234. <target name="clean-testbench-errors">
  235. <fail unless="com.vaadin.testbench.screenshot.directory"
  236. message="Define screenshot directory using -Dcom.vaadin.testbench.screenshot.directory" />
  237. <mkdir dir="${com.vaadin.testbench.screenshot.directory}/errors" />
  238. <delete>
  239. <fileset
  240. dir="${com.vaadin.testbench.screenshot.directory}/errors">
  241. <include name="*" />
  242. </fileset>
  243. </delete>
  244. </target>
  245. <target name="compile-test-themes">
  246. <antcall target="compile-theme">
  247. <param name="theme" value="tests-valo" />
  248. </antcall>
  249. <antcall target="compile-theme">
  250. <param name="theme" value="tests-valo-dark" />
  251. </antcall>
  252. <antcall target="compile-theme">
  253. <param name="theme" value="tests-valo-metro" />
  254. </antcall>
  255. <antcall target="compile-theme">
  256. <param name="theme" value="tests-valo-flat" />
  257. </antcall>
  258. <antcall target="compile-theme">
  259. <param name="theme" value="tests-valo-flatdark" />
  260. </antcall>
  261. <antcall target="compile-theme">
  262. <param name="theme" value="tests-valo-facebook" />
  263. </antcall>
  264. <antcall target="compile-theme">
  265. <param name="theme" value="tests-valo-blueprint" />
  266. </antcall>
  267. <antcall target="compile-theme">
  268. <param name="theme" value="tests-valo-light" />
  269. </antcall>
  270. <antcall target="compile-theme">
  271. <param name="theme" value="tests-valo-disabled-animations" />
  272. </antcall>
  273. </target>
  274. <target name="compile-theme" depends="copy-theme">
  275. <fail unless="theme"
  276. message="You must give the theme name to compile in the 'theme' parameter" />
  277. <ivy:resolve log="download-only" resolveid="common"
  278. conf="compile-theme" />
  279. <ivy:cachepath pathid="classpath.compile.theme"
  280. conf="compile-theme" />
  281. <ivy:cachepath pathid="classpath.runtime.theme"
  282. conf="build" />
  283. <echo>Compiling ${theme}</echo>
  284. <mkdir dir="${theme.result.dir}" />
  285. <!-- compile the theme -->
  286. <java classname="com.vaadin.buildhelpers.CompileTheme"
  287. classpathref="classpath.compile.theme" failonerror="yes"
  288. fork="yes" maxmemory="512m">
  289. <arg value="--theme" />
  290. <arg value="${theme}" />
  291. <arg value="--theme-folder" />
  292. <arg value="${theme.result.dir}" />
  293. <arg value="--version" />
  294. <arg value="${vaadin.version}" />
  295. <jvmarg value="-Xss8M" />
  296. <jvmarg value="-XX:MaxPermSize=256M" />
  297. <jvmarg value="-Djava.awt.headless=true" />
  298. </java>
  299. </target>
  300. <target name="copy-theme">
  301. <fail unless="theme"
  302. message="You must give the theme name to copy n the 'theme' parameter" />
  303. <property name="theme.source.dir" location="../WebContent/VAADIN/themes" />
  304. <copy todir="${theme.result.dir}">
  305. <fileset dir="${theme.source.dir}">
  306. <include name="${theme}/**/*.scss" />
  307. </fileset>
  308. <filterset refid="filter-vaadin.version" />
  309. </copy>
  310. <copy todir="${theme.result.dir}">
  311. <fileset dir="${theme.source.dir}">
  312. <exclude name="${theme}/**/*.scss" />
  313. </fileset>
  314. </copy>
  315. </target>
  316. </project>