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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197
  1. <?xml version="1.0"?>
  2. <project xmlns:antcontrib="antlib:net.sf.antcontrib"
  3. xmlns:artifact="antlib:org.apache.maven.artifact.ant"
  4. name="Vaadin"
  5. basedir="../" default="package-all">
  6. <!-- Package creation - - - - - - - - - - - - - - - - - - - - - - - - -
  7. When creating release use only "package-*" targets:
  8. package-all
  9. * creates the release package, a war, and a Liferay war
  10. package-windows
  11. * vaadin-windows-<version>.zip
  12. package-linux
  13. * vaadin-linux-<version>.tar.bz2
  14. package-mac
  15. * vaadin-mac-<version>.tar.gz
  16. * vaadin-mac-<version>.dmg
  17. In addition, the OOPHM package has the following target for building:
  18. package-oophm
  19. * vaadin-oophm-<version>.zip
  20. -->
  21. <!--
  22. Call one of package-* targets unless you understand what you are doing
  23. -->
  24. <target name="package-all" depends="clean-all, package-init, init, build, docs, internal-package-zip, internal-package-war, internal-package-liferay" description="Build public packages.">
  25. </target>
  26. <target name="package-zip" depends="clean-all, package-init, init, build, docs, internal-package-zip">
  27. </target>
  28. <target name="package-jar" depends="clean-result, package-init, init, libs" description="Create vaadin-x.y.z.jar file.">
  29. </target>
  30. <target name="package-war" depends="clean-result, package-init, init, build, docs, internal-package-zip, internal-package-war">
  31. </target>
  32. <target name="package-liferay-zip" depends="clean-result, package-init, init, build, docs, internal-package-zip, internal-package-liferay">
  33. </target>
  34. <target name="package-test" depends="clean-result, nightly-init, package-init, init, build, docs, internal-package-zip, nightly-publish">
  35. </target>
  36. <!-- ant contrib required for flow control (for loop, if, property override) -->
  37. <!-- Note that we have to use a namespace to avoid clash when running sub-ant. -->
  38. <taskdef uri="antlib:net.sf.antcontrib" resource="net/sf/antcontrib/antlib.xml">
  39. <classpath>
  40. <pathelement location="build/lib/ant-contrib-1.0b3.jar" />
  41. </classpath>
  42. </taskdef>
  43. <!-- ant contrib for Maven integration -->
  44. <path id="maven-ant-tasks.classpath" path="build/lib/maven-ant-tasks-2.0.10.jar" />
  45. <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
  46. uri="antlib:org.apache.maven.artifact.ant"
  47. classpathref="maven-ant-tasks.classpath" />
  48. <!-- internal tests for packaging -->
  49. <target name="test-build" depends="clean-result, init, build" description="used for testing build.xml">
  50. </target>
  51. <target name="test-package" depends="init" description="used for testing build.xml">
  52. <antcontrib:var name="eclipse-launch-vmargs" value="-XstartOnFirstThread -Xms128M -Xmx512M" />
  53. <antcall target="add-misc-files" inheritAll="true" inheritRefs="true" />
  54. <delete file="${result-path}/eclipse-test" followsymlinks="false" />
  55. <exec executable="ln" failonerror="false">
  56. <arg line="-s" />
  57. <arg line="${output-dir}" />
  58. <arg line="${result-path}/eclipse-test" />
  59. </exec>
  60. </target>
  61. <!-- Clean results - - - - - - - - - - - - - - - - - - - - - - - - - -->
  62. <target name="clean-result" depends="">
  63. <property file="build/build.properties" />
  64. <!-- Clean build result directory. -->
  65. <delete dir="${result-path}" includes="**/*" followsymlinks="false" defaultexcludes="false" includeemptydirs="true" failonerror="false"/>
  66. </target>
  67. <!-- Clean checkout directory. -->
  68. <target name="clean-checkout" depends="">
  69. <property file="build/build.properties" />
  70. <delete dir="${checkout-path}" includes="**/*" followsymlinks="false" defaultexcludes="false" includeemptydirs="true" failonerror="false"/>
  71. </target>
  72. <target name="clean-all" depends="clean-result, clean-checkout">
  73. </target>
  74. <!-- ================================================================== -->
  75. <!-- Check versions. -->
  76. <!-- ================================================================== -->
  77. <!-- Java compiler version. -->
  78. <target name="check-java-version">
  79. <condition property="java.version.matches">
  80. <or>
  81. <equals arg1="${ant.java.version}" arg2="1.5"/>
  82. <isset property="ignoreversion"/>
  83. </or>
  84. </condition>
  85. <fail unless="java.version.matches" message="Java version is ${ant.java.version}, but Vaadin must be compiled with genuine Java 1.5 compiler. Use -Dignoreversion=1 for ant to ignore the version check."/>
  86. <echo>Java version is ${ant.java.version} as required.</echo>
  87. </target>
  88. <!-- Check Servlet API version. -->
  89. <!-- We must use Servlet API 2.3 to catch incompatibilities.. -->
  90. <target name="check-servlet-version">
  91. <available classpathref="compile.classpath" classname="javax.servlet.Servlet" property="servlet.available"/>
  92. <fail unless="servlet.available" message="Java Servlet API library is not available."/>
  93. <echo>Java Servlet API is available.</echo>
  94. <available classpathref="compile.classpath" classname="javax.servlet.ServletRequestListener" property="servlet.version.is-2.4"/>
  95. <fail if="servlet.version.is-2.4" message="Java Servlet API 2.4 or later detected. Vaadin must be compiled exactly with Servlet API 2.3."/>
  96. <echo>Java Servlet API specification 2.3 used.</echo>
  97. </target>
  98. <!-- ================================================================== -->
  99. <!-- Initialization - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  100. <!-- ================================================================== -->
  101. <!-- Called only when building installation packages. -->
  102. <target name="package-init">
  103. </target>
  104. <target name="init" depends="check-java-version">
  105. <property file="build/build.properties" />
  106. <property file="build/VERSION.properties" />
  107. <property file="build/GWT-VERSION.properties" />
  108. <property file="build/html-style.properties" />
  109. <!-- Current timestamp in different formats. -->
  110. <tstamp>
  111. <format property="build.date" pattern="yyyy-MM-dd"/>
  112. </tstamp>
  113. <tstamp>
  114. <format property="build.date.compact" pattern="yyyyMMdd"/>
  115. </tstamp>
  116. <!-- Default full version name. -->
  117. <!-- Nightly and other TeamCity builds will define their own. -->
  118. <property name="version.full" value="${version}.dev-${build.date.compact}"/>
  119. <echo>Base Version: ${version}</echo>
  120. <echo>Full Version: ${version.full}</echo>
  121. <echo>Vaadin package is: ${toolkit-package}</echo>
  122. <!-- Create result dir unless already exists -->
  123. <mkdir dir="${result-path}" />
  124. <!-- required when compiling WebContent/VAADIN/widgetsets (and also Java server-side classes) -->
  125. <property name="lib-gwt-dev" location="${gwt-dir}/gwt-dev.jar" />
  126. <property name="lib-gwt-user" location="${gwt-dir}/gwt-user.jar" />
  127. <echo>We are using gwt version ${gwt-version}.</echo>
  128. <!-- Destination files -->
  129. <property name="lib-jar-name" value="${product-file}-${version.full}.jar" />
  130. <echo message="Prepared to build ${product-file} version ${version.full} packages" />
  131. <!-- Output directory -->
  132. <property name="output-dir" value="${result-path}/${product-file}-${version.full}" />
  133. <mkdir dir="${output-dir}" />
  134. <!-- Where widgetsets are written to. -->
  135. <!-- When not building a package, widgetsets should be written to -->
  136. <!-- WebContent/VAADIN/widgetsets, which needs to be set in -->
  137. <!-- init-nonpackage target before calling this main init target. -->
  138. <property name="widgetsets-output-dir" value="${output-dir}/WebContent/VAADIN/widgetsets" />
  139. <!-- Create Output Directory Hierarchy -->
  140. <mkdir dir="${output-dir}/WebContent" />
  141. <mkdir dir="${output-dir}/WebContent/demo" />
  142. <mkdir dir="${output-dir}/WebContent/docs" />
  143. <mkdir dir="${output-dir}/WebContent/docs/api" />
  144. <mkdir dir="${output-dir}/WebContent/docs/example-source" />
  145. <mkdir dir="${output-dir}/WebContent/WEB-INF" />
  146. <mkdir dir="${output-dir}/WebContent/WEB-INF/lib" />
  147. <mkdir dir="${output-dir}/WebContent/WEB-INF/classes" />
  148. <!-- Construct classpath used by java and javadoc compilation -->
  149. <path id="compile.classpath">
  150. <pathelement path="build/lib/servlet.jar" />
  151. <pathelement path="build/external/fileupload/classes" />
  152. <fileset dir="lib/core">
  153. <include name="**/*.jar"/>
  154. <exclude name="**/servlet-api*.jar"/>
  155. <!-- This has to be excluded because it contains Servlet API > 2.3. -->
  156. <exclude name="gwt/**/*"/>
  157. </fileset>
  158. <fileset dir="lib/demo">
  159. <include name="**/*.jar"/>
  160. </fileset>
  161. <fileset dir="lib/tests">
  162. <include name="**/*.jar"/>
  163. </fileset>
  164. </path>
  165. <path id="compile.classpath.server-side">
  166. <path refid="compile.classpath"/>
  167. <pathelement path="${result-path}/gwt" />
  168. </path>
  169. <path id="compile.classpath.client-side">
  170. <path refid="compile.classpath"/>
  171. <pathelement path="${lib-gwt-user}" />
  172. <pathelement path="${lib-gwt-dev}" />
  173. </path>
  174. </target>
  175. <target name="internal-package-zip">
  176. <antcontrib:var name="eclipse-launch-vmargs" value="-Xms256M -Xmx512M" />
  177. <antcall target="add-misc-files" inheritAll="true" inheritRefs="true" />
  178. <zip zipfile="${result-path}/${product-file}-${version.full}.zip">
  179. <zipfileset prefix="${product-file}-${version.full}" dir="${result-path}/${product-file}-${version.full}">
  180. <patternset>
  181. <include name="**/*" />
  182. </patternset>
  183. </zipfileset>
  184. <zipfileset prefix="${product-file}-${version.full}/gwt" dir="${gwt-dir}">
  185. <patternset>
  186. <include name="**/*" />
  187. <exclude name="doc**"/>
  188. <exclude name="samples**"/>
  189. </patternset>
  190. </zipfileset>
  191. </zip>
  192. <!-- Notice that the differences comparison is conditional. -->
  193. <antcall target="differences"/>
  194. </target>
  195. <target name="internal-package-war">
  196. <echo>Building WAR</echo>
  197. <!-- Add the files. -->
  198. <antcontrib:var name="eclipse-launch-vmargs" value="-Xms256M -Xmx512M" />
  199. <antcall target="add-misc-files" inheritAll="true" inheritRefs="true" />
  200. <!-- Copy source tree to class tree. -->
  201. <!-- A workaround for not setting classpath properly in WAR. -->
  202. <copy todir="${output-dir}/WebContent/WEB-INF/classes">
  203. <fileset dir="${output-dir}/WebContent/WEB-INF/src">
  204. <include name="**/*" />
  205. </fileset>
  206. </copy>
  207. <war warfile="${result-path}/${product-file}-demo-${version.full}.war">
  208. <fileset dir="${output-dir}/WebContent">
  209. <include name="**/*" />
  210. </fileset>
  211. </war>
  212. </target>
  213. <target name="internal-package-liferay" depends="internal-package-war">
  214. <!-- We assume the needed files are put in place by internal-package-war -->
  215. <echo>Building Liferay zip</echo>
  216. <zip zipfile="${result-path}/${product-file}-${version.full}-liferay.zip">
  217. <zipfileset prefix="VAADIN/widgetsets/com.vaadin.portal.gwt.PortalDefaultWidgetSet" dir="${output-dir}/WebContent/VAADIN/widgetsets/com.vaadin.portal.gwt.PortalDefaultWidgetSet">
  218. <patternset>
  219. <include name="**/*" />
  220. </patternset>
  221. </zipfileset>
  222. <zipfileset prefix="VAADIN/themes" dir="${output-dir}/WebContent/VAADIN/themes">
  223. <patternset>
  224. <include name="base/**/*" />
  225. <include name="liferay/**/*" />
  226. <include name="runo/**/*" />
  227. <include name="reindeer/**/*" />
  228. <include name="default/**/*" />
  229. </patternset>
  230. </zipfileset>
  231. </zip>
  232. <echo>##teamcity[publishArtifacts '${result-path}/${product-file}-${version.full}-liferay.zip']</echo>
  233. </target>
  234. <target name="add-misc-files">
  235. <delete includeemptydirs="true" defaultexcludes="false">
  236. <fileset dir="${output-dir}">
  237. <include name=".*" />
  238. <include name="*.launch" />
  239. <include name="*.txt" />
  240. <include name="*.bat" />
  241. <include name="*.sh" />
  242. <include name="*.app" />
  243. <include name="build-widgetset.xml" />
  244. </fileset>
  245. </delete>
  246. <copy todir="${output-dir}">
  247. <filterchain>
  248. <expandproperties />
  249. <replacetokens begintoken="@" endtoken="@">
  250. <token key="version" value="${version.full}" />
  251. </replacetokens>
  252. </filterchain>
  253. <fileset dir="WebContent/license">
  254. <include name="COPYING" />
  255. </fileset>
  256. </copy>
  257. <copy todir="${output-dir}/WebContent">
  258. <filterchain>
  259. <expandproperties />
  260. <replacetokens begintoken="@" endtoken="@">
  261. <token key="version" value="${version.full}" />
  262. </replacetokens>
  263. <replacetokens begintoken="@" endtoken="@">
  264. <token key="builddate" value="${build.date}" />
  265. </replacetokens>
  266. </filterchain>
  267. <fileset dir="WebContent">
  268. <exclude name="**/.svn" />
  269. <exclude name="windoweddemos.html" />
  270. <include name="release-notes.html" />
  271. <include name="*.html" />
  272. <include name="license/*.html" />
  273. <include name="license/*.txt" />
  274. </fileset>
  275. </copy>
  276. <copy file="build/package/readme.txt" tofile="${output-dir}/readme.txt">
  277. <filterchain>
  278. <expandproperties />
  279. <replacetokens begintoken="@" endtoken="@">
  280. <token key="version" value="${version.full}" />
  281. </replacetokens>
  282. </filterchain>
  283. </copy>
  284. <copy todir="${output-dir}">
  285. <filterchain>
  286. <expandproperties />
  287. <!-- .classpath, *.launch, build-widgetset.xml -->
  288. <replacetokens begintoken="@" endtoken="@">
  289. <token key="version" value="${version.full}" />
  290. </replacetokens>
  291. <!-- .classpath -->
  292. <replacetokens begintoken="&lt;" endtoken=">">
  293. <token key="platform-specific-entries" value="&lt;classpathentry kind=&quot;lib&quot; path=&quot;gwt/gwt-dev.jar&quot; /&gt;" />
  294. <token key="/platform-specific-entries" value="" />
  295. </replacetokens>
  296. <!-- .project, *.launch -->
  297. <replacetokens begintoken="&lt;" endtoken=">">
  298. <token key="eclipse-workspace-name" value="${eclipse-workspace-name}" />
  299. <token key="/eclipse-workspace-name" value="" />
  300. </replacetokens>
  301. <!-- HostedMode.launch -->
  302. <replacetokens begintoken="&lt;" endtoken=">">
  303. <token key="eclipse-launch-vmargs" value="${eclipse-launch-vmargs}" />
  304. <token key="/eclipse-launch-vmargs" value="" />
  305. </replacetokens>
  306. </filterchain>
  307. <fileset dir="build/package">
  308. <include name="eclipse-classpath" />
  309. <include name="eclipse-project" />
  310. <include name="eclipse*launch" />
  311. <include name="build-widgetset.xml" />
  312. <include name="eclipse-org.eclipse.core.resources.prefs" />
  313. <include name="eclipse-org.eclipse.jdt.core.prefs" />
  314. </fileset>
  315. </copy>
  316. <move file="${output-dir}/build-widgetset.xml" tofile="${output-dir}/WebContent/docs/example-source/build-widgetset.xml" />
  317. <move file="${output-dir}/eclipse-classpath" tofile="${output-dir}/.classpath" />
  318. <move file="${output-dir}/eclipse-project" tofile="${output-dir}/.project" />
  319. <move file="${output-dir}/eclipse-Vaadin Hosted Mode Browser-launch" tofile="${output-dir}/Vaadin Hosted Mode Browser.launch" />
  320. <move file="${output-dir}/eclipse-Vaadin Development Server-launch" tofile="${output-dir}/Vaadin Development Server.launch" />
  321. <mkdir dir="${output-dir}/.settings" />
  322. <move file="${output-dir}/eclipse-org.eclipse.core.resources.prefs" tofile="${output-dir}/.settings/org.eclipse.core.resources.prefs" />
  323. <move file="${output-dir}/eclipse-org.eclipse.jdt.core.prefs" tofile="${output-dir}/.settings/org.eclipse.jdt.core.prefs" />
  324. <copy todir="${output-dir}">
  325. <fileset dir="build/package">
  326. <include name="start.bat" />
  327. <include name="start.sh" />
  328. </fileset>
  329. </copy>
  330. <!-- TODO: Why is this set both with <chmod> and <exec>? -->
  331. <chmod file="${output-dir}/start.sh" perm="ugo+x" />
  332. <exec executable="chmod" failonerror="false">
  333. <arg line="ugo+x" />
  334. <arg line="${output-dir}/start.sh" />
  335. </exec>
  336. </target>
  337. <!-- Build server-side, client-side, libraries, and demos. -->
  338. <!-- The client-side needs to be built before libs, because the libs -->
  339. <!-- require the default widgetset and doing otherwise would build it twice. -->
  340. <!-- However, since compiling the server-side is required by the client-side -->
  341. <!-- compilation, the server-side will actually be built before it. -->
  342. <target name="build"
  343. depends="compile-server-side, compile-client-side, libs, demo"
  344. description="Build package required files, without packing them.">
  345. </target>
  346. <target name="compile-server-side" depends="compile-java, webcontent"/>
  347. <!-- Copy and preprocess sources for packaging
  348. NOTE: Replaces <version></version> tags with build version tag for some "textual" files
  349. -->
  350. <target name="preprocess-src">
  351. <!--
  352. Source directories in the project are
  353. * src (Vaadin core)
  354. * demo/src (Demos and examples)
  355. * tests/src (Test cases)
  356. These are copied to
  357. * {$result-path}/src/core
  358. * {$result-path}/src/demo
  359. * {$result-path}/src/tests
  360. Java/HTML/CSS/XML files are filtered so the license is added and the version is set.
  361. Other files are just copied.
  362. If build.include.tests is not set, then "{$result-path}/src/tests" is created but no files are copied to it.
  363. -->
  364. <loadfile property="ITMillApache2LicenseForJavaFiles" srcFile="build/ITMillApache2LicenseForJavaFiles.txt" />
  365. <mkdir dir="${result-path}/src" />
  366. <mkdir dir="${result-path}/src/core" />
  367. <mkdir dir="${result-path}/src/demo" />
  368. <mkdir dir="${result-path}/src/tests" />
  369. <patternset id="preprocessable-files">
  370. <include name="**/*.java" />
  371. <include name="**/*.html" />
  372. <include name="**/*.css" />
  373. <include name="**/*.xml" />
  374. </patternset>
  375. <patternset id="non-preprocessable-files">
  376. <exclude name="**/.svn" />
  377. <exclude name="**/*.java" />
  378. <exclude name="**/*.html" />
  379. <exclude name="**/*.css" />
  380. <exclude name="**/*.xml" />
  381. </patternset>
  382. <filterset id="version-and-license">
  383. <filter token="ITMillApache2LicenseForJavaFiles" value="${ITMillApache2LicenseForJavaFiles}" />
  384. <filter token="VERSION" value="${version.full}" />
  385. </filterset>
  386. <echo>Copying src directory and processing copied files.</echo>
  387. <echo>Replacing &lt;version&gt; tag with build version for java/html/css/xml files.</echo>
  388. <copy todir="${result-path}/src/core">
  389. <filterset refid="version-and-license"/>
  390. <fileset dir="src">
  391. <patternset refid="preprocessable-files" />
  392. </fileset>
  393. </copy>
  394. <copy todir="${result-path}/src/demo">
  395. <filterset refid="version-and-license"/>
  396. <fileset dir="demo/src">
  397. <patternset refid="preprocessable-files" />
  398. </fileset>
  399. </copy>
  400. <antcontrib:if>
  401. <isset property="build.include.tests"/>
  402. <then>
  403. <copy todir="${result-path}/src/tests">
  404. <filterset refid="version-and-license"/>
  405. <fileset dir="tests/src">
  406. <patternset refid="preprocessable-files" />
  407. </fileset>
  408. </copy>
  409. </then>
  410. </antcontrib:if>
  411. <!-- Unify mix usage of mac/Linux/Win characters -->
  412. <echo>Unifying mix usage of Mac/Linux/Win linefeeds for java/html/css/xml files.</echo>
  413. <fixcrlf srcdir="${result-path}/src" eol="crlf" tablength="4" tab="asis" includes="**/*.java **/*.html **/*.css **/*.xml" />
  414. <!-- Add other files such as images, these are not filtered or processed by fixcrlf task -->
  415. <echo>Copying non java/html/css/xml files such as images.</echo>
  416. <copy todir="${result-path}/src/core">
  417. <fileset dir="src">
  418. <patternset refid="non-preprocessable-files" />
  419. </fileset>
  420. </copy>
  421. <copy todir="${result-path}/src/demo">
  422. <fileset dir="demo/src">
  423. <patternset refid="non-preprocessable-files" />
  424. </fileset>
  425. </copy>
  426. <antcontrib:if>
  427. <isset property="build.include.tests"/>
  428. <then>
  429. <copy todir="${result-path}/src/tests">
  430. <fileset dir="tests/src">
  431. <patternset refid="non-preprocessable-files" />
  432. </fileset>
  433. </copy>
  434. </then>
  435. </antcontrib:if>
  436. </target>
  437. <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  438. WebContent
  439. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  440. <target name="webcontent" depends="preprocess-src,defaulttheme">
  441. <!-- copy 3rd part libraries used by demo -->
  442. <copy todir="${output-dir}/WebContent/demo/lib">
  443. <fileset dir="lib/demo">
  444. <include name="gwt-maps/**/*" />
  445. </fileset>
  446. </copy>
  447. <copy todir="${output-dir}/WebContent/demo/lib">
  448. <fileset dir="lib/core">
  449. <include name="jetty/**/*" />
  450. </fileset>
  451. </copy>
  452. <copy todir="${output-dir}/WebContent/demo/lib">
  453. <fileset dir="lib/core">
  454. <include name="portlet/**/*" />
  455. </fileset>
  456. </copy>
  457. <!-- Add demo sources -->
  458. <echo>Adding demo sources to WebContent/WEB-INF/src</echo>
  459. <copy todir="${output-dir}/WebContent/WEB-INF/src">
  460. <fileset dir="${result-path}/src/demo">
  461. <include name="**/*" />
  462. </fileset>
  463. </copy>
  464. <echo>Creating demo source html files</echo>
  465. <java2html srcdir="${output-dir}/WebContent/WEB-INF/src/${toolkit-package}/demo" destdir="${output-dir}/WebContent/docs/example-source/${toolkit-package}/demo" includes="**/*.java" style="eclipse" showLineNumbers="false" showFileName="true" showTableBorder="false" />
  466. <!-- Add WebContent -->
  467. <echo>Adding VAADIN/themes, demo and hsqldb.jar files.</echo>
  468. <copy todir="${output-dir}/WebContent">
  469. <fileset dir="WebContent">
  470. <exclude name="**/.svn" />
  471. <!-- TODO check what is neccessary -->
  472. <!-- These are needed for running tests, but are copied during testing. -->
  473. <exclude name="VAADIN/themes/tests*"/>
  474. <exclude name="VAADIN/themes/tests-magi/**/*" />
  475. <exclude name="VAADIN/themes/tests-featurebrowser/**/*" />
  476. <exclude name="VAADIN/themes/tests*/**/*"/>
  477. <include name="demo/**/*" />
  478. <include name="WEB-INF/lib/hsqldb.jar" />
  479. <include name="VAADIN/themes/**/*" />
  480. <include name="META-INF/**/*" />
  481. </fileset>
  482. </copy>
  483. <!-- Add package specific WebContent files from build/package/WebContent -->
  484. <copy todir="${output-dir}/WebContent">
  485. <fileset dir="build/package/WebContent">
  486. <exclude name="**/.*" />
  487. <include name="**/*" />
  488. </fileset>
  489. </copy>
  490. <java classname="com.vaadin.buildhelpers.PortletConfigurationGenerator" failonerror="yes" fork="yes" maxmemory="512m">
  491. <arg value="${output-dir}/WebContent/WEB-INF" />
  492. <arg value="com.vaadin.portal.gwt.PortalDefaultWidgetSet" />
  493. <classpath>
  494. <pathelement location="build/buildhelpers/" />
  495. </classpath>
  496. </java>
  497. </target>
  498. <target name="compile-fileupload">
  499. <echo>Compiling custom fileupload classes.</echo>
  500. <ant dir="build/external/fileupload" antfile="build.xml" target="compile" />
  501. </target>
  502. <target name="unpack-gwt" depends="init">
  503. <!-- Unpack GWT from JARs. This is needed for excluding Servlet API 2.4. -->
  504. <delete dir="${result-path}/gwt"/>
  505. <unjar src="${lib-gwt-user}" dest="${result-path}/gwt/"/>
  506. <unjar src="${lib-gwt-dev}" dest="${result-path}/gwt/"/>
  507. <delete dir="${result-path}/gwt/javax/servlet"/>
  508. </target>
  509. <target name="compile-java" depends="init, unpack-gwt, check-servlet-version, compile-fileupload, webcontent">
  510. <echo>Compiling src (server-side)</echo>
  511. <!-- Compile all sources at the same time as they depend on each other -->
  512. <mkdir dir="${result-path}/classes" />
  513. <javac source="1.5" target="1.5" classpathref="compile.classpath.server-side" destdir="${result-path}/classes" debug="true" encoding="UTF-8">
  514. <src path="${result-path}/src/core"/>
  515. <src path="${result-path}/src/demo"/>
  516. <src path="${result-path}/src/tests"/>
  517. <exclude name="${toolkit-package}/tests/**" unless="build.include.tests"/>
  518. </javac>
  519. </target>
  520. <target name="defaulttheme" depends="init">
  521. <echo>Combining default themes css files</echo>
  522. <!-- ensure buildhelpers are compiled -->
  523. <javac source="1.5" target="1.5" srcdir="build/buildhelpers" classpath="build/smartsprites/lib/smartsprites-0.2.3-itmill.jar"/>
  524. <java classname="com.vaadin.buildhelpers.CompileDefaultTheme" failonerror="yes" fork="yes">
  525. <arg value="-version" />
  526. <arg value="${version.full}"/>
  527. <classpath>
  528. <pathelement location="build/buildhelpers" />
  529. <fileset dir="build/smartsprites/lib">
  530. <include name="*.jar"/>
  531. </fileset>
  532. </classpath>
  533. <jvmarg value="-Djava.awt.headless=true"/>
  534. </java>
  535. </target>
  536. <target name="testtarget">
  537. <echo>TEST TARGET CALLED</echo>
  538. </target>
  539. <!-- ================================================================== -->
  540. <!-- Widget Set Compilation -->
  541. <!-- ================================================================== -->
  542. <!-- Widget set compilation process: -->
  543. <!-- 1. Preprocess sources -->
  544. <!-- 2. Compile server-side java -->
  545. <!-- 3. Generate widget set definitions and classes -->
  546. <!-- 4. Compile widget sets -->
  547. <!-- -->
  548. <!-- Widget sets can be built for two purposes: -->
  549. <!-- * for building installation packages -->
  550. <!-- * for building single widget sets during development -->
  551. <!-- Targets: widgetset-<name> -->
  552. <target name="remove-widgetset-gwt-tmp">
  553. <echo>Removing widgetset temp files</echo>
  554. <delete dir="${output-dir}/WebContent/VAADIN/widgetsets/.gwt-tmp" includeemptydirs="true"/>
  555. </target>
  556. <!-- Note: Probably not needed any longer as all sources need to be compiled. -->
  557. <target name="compile-widgetset-generator-only" depends="init, preprocess-src, compile-java">
  558. <mkdir dir="${result-path}/classes"/>
  559. <javac source="1.5" target="1.5" destdir="${result-path}/classes" debug="true" encoding="UTF-8">
  560. <src path="${result-path}/src/core"/>
  561. <include name="com/vaadin/terminal/gwt/widgetsetutils/WidgetMapGenerator.java" />
  562. <!-- <exclude name="**"/> -->
  563. <classpath>
  564. <pathelement location="${lib-gwt-user}" />
  565. <pathelement location="${lib-gwt-dev}" />
  566. <pathelement location="${result-path}/classes" />
  567. <pathelement location="${result-path}/src/core" />
  568. </classpath>
  569. </javac>
  570. </target>
  571. <!-- The widgetset generator is currently compiled along with rest of server-side Java. -->
  572. <target name="compile-widgetset-generator" depends="init, preprocess-src, compile-java"/>
  573. <path id="widgetset-compile-classpath">
  574. <pathelement location="${lib-gwt-user}" />
  575. <pathelement location="${lib-gwt-dev}" />
  576. <pathelement location="${result-path}/classes" />
  577. <pathelement location="${result-path}/src/core" />
  578. <pathelement location="${result-path}/src/demo" />
  579. </path>
  580. <target name="compile-widgetset" description="Compiles the widgetset given as the first parameter">
  581. <fail unless="widgetset" message="No widgetset parameter set"/>
  582. <echo>Compiling widgetset ${widgetset}. Output directory: ${widgetsets-output-dir}</echo>
  583. <java classname="com.google.gwt.dev.Compiler" failonerror="yes" fork="yes" maxmemory="512m">
  584. <classpath refid="widgetset-compile-classpath"/>
  585. <arg value="-war" />
  586. <arg value="${widgetsets-output-dir}" />
  587. <arg value="-style" />
  588. <arg value="OBF" />
  589. <arg value="${widgetset}" />
  590. <jvmarg value="-Xss8M"/>
  591. <jvmarg value="-Djava.awt.headless=true"/>
  592. </java>
  593. <antcall target="remove-widgetset-gwt-tmp"/>
  594. <echo>Compiled ${widgetset}</echo>
  595. </target>
  596. <target name="compile-widgetset-default">
  597. <antcall target="compile-widgetset">
  598. <param name="widgetset" value="com.vaadin.terminal.gwt.DefaultWidgetSet"/>
  599. </antcall>
  600. </target>
  601. <target name="compile-widgetset-portal-default">
  602. <antcall target="compile-widgetset">
  603. <param name="widgetset" value="com.vaadin.portal.gwt.PortalDefaultWidgetSet"/>
  604. </antcall>
  605. </target>
  606. <target name="compile-widgetset-reserver">
  607. <condition property="googlemaps-jar" value="${output-dir}/WebContent/demo/lib/gwt-maps/gwt-maps.jar">
  608. <available file="${output-dir}/WebContent/demo/lib/gwt-maps/gwt-maps.jar" />
  609. </condition>
  610. <condition property="googlemaps-jar" value="lib/gwt-maps/gwt-maps.jar">
  611. <available file="lib/reservr/gwt-maps.jar" />
  612. </condition>
  613. <java classname="com.google.gwt.dev.Compiler" failonerror="yes" fork="yes" maxmemory="512m">
  614. <arg value="-war" />
  615. <arg value="${widgetsets-output-dir}" />
  616. <arg value="com.vaadin.demo.reservation.gwt.ReservationWidgetSet" />
  617. <arg value="-style" />
  618. <arg value="OBF" />
  619. <jvmarg value="-Xss8M"/>
  620. <jvmarg value="-Djava.awt.headless=true"/>
  621. <classpath>
  622. <pathelement location="${lib-gwt-user}" />
  623. <pathelement location="${lib-gwt-dev}" />
  624. <pathelement location="${result-path}/src/core" />
  625. <pathelement location="${result-path}/src/demo" />
  626. <!-- demo jars -->
  627. <pathelement location="${googlemaps-jar}" />
  628. <!-- demo widgetset sources -->
  629. <pathelement path="${output-dir}/WebContent/WEB-INF/src" />
  630. <pathelement location="${result-path}/classes" />
  631. </classpath>
  632. </java>
  633. <antcall target="remove-widgetset-gwt-tmp"/>
  634. <echo>Compiled ReservationWidgetSet</echo>
  635. </target>
  636. <target name="compile-widgetset-sampler">
  637. <antcall target="compile-widgetset">
  638. <param name="widgetset" value="com.vaadin.demo.sampler.gwt.SamplerWidgetSet"/>
  639. </antcall>
  640. </target>
  641. <target name="compile-widgetset-coverflow">
  642. <antcall target="compile-widgetset">
  643. <param name="widgetset" value="com.vaadin.demo.coverflow.gwt.CoverflowWidgetSet"/>
  644. </antcall>
  645. </target>
  646. <target name="compile-widgetset-colorpicker">
  647. <antcall target="compile-widgetset">
  648. <param name="widgetset" value="com.vaadin.demo.colorpicker.gwt.ColorPickerWidgetSet"/>
  649. </antcall>
  650. </target>
  651. <!-- Builds the client-side engine, i.e., the widgetsets sequentially. -->
  652. <!-- Notice that antcall does not fulfill dependencies. -->
  653. <target name="compile-client-side-sequential" unless="build.parallel">
  654. <echo>Compiling widget sets sequentially.</echo>
  655. <!-- We can't call these with 'depends' because of the 'unless' specifier. -->
  656. <antcall target="compile-widgetset-default"/>
  657. <antcall target="compile-widgetset-portal-default"/>
  658. <antcall target="compile-widgetset-reserver"/>
  659. <antcall target="compile-widgetset-sampler"/>
  660. <antcall target="compile-widgetset-colorpicker"/>
  661. <antcall target="compile-widgetset-coverflow"/>
  662. </target>
  663. <!-- Builds the client-side engine, i.e., the widgetsets in parallel. -->
  664. <!-- Notice that antcall does not fulfill dependencies. -->
  665. <target name="compile-client-side-parallel" if="build.parallel">
  666. <echo>Compiling widget sets in parallel.</echo>
  667. <parallel threadsperprocessor="1">
  668. <antcall target="compile-widgetset-default"/>
  669. <antcall target="compile-widgetset-portal-default"/>
  670. <antcall target="compile-widgetset-reserver"/>
  671. <antcall target="compile-widgetset-sampler"/>
  672. <antcall target="compile-widgetset-colorpicker"/>
  673. <antcall target="compile-widgetset-coverflow"/>
  674. </parallel>
  675. </target>
  676. <!-- Compiles all widgetsets. -->
  677. <!-- This is called when building packages and when compiling all -->
  678. <!-- widgetsets, but not when compiling individual widgetsets. -->
  679. <!-- Builds widgetsets either sequentially or in parallel, depending -->
  680. <!-- on the 'build.parallel' property. -->
  681. <target name="compile-client-side" depends="compile-server-side, compile-client-side-sequential, compile-client-side-parallel"/>
  682. <!-- Definitions for building local components, i.e., not for an installation package. -->
  683. <target name="init-nonpackage">
  684. <property file="build/build.properties" />
  685. <property file="build/VERSION.properties" />
  686. <property file="build/GWT-VERSION.properties" />
  687. <!-- Definitions for building the client-side. -->
  688. <property name="widgetsets-output-dir" value="WebContent/VAADIN/widgetsets" />
  689. <!-- required when compiling WebContent/VAADIN/widgetsets (and also Java server-side classes) -->
  690. <property name="lib-gwt-dev" location="${gwt-dir}/gwt-dev.jar" />
  691. <property name="lib-gwt-user" location="${gwt-dir}/gwt-user.jar" />
  692. <echo>We are using ${lib-gwt-dev}.</echo>
  693. <echo>Widget sets output dir: ${widgetsets-output-dir}</echo>
  694. </target>
  695. <!-- Builds all widgetsets locally, i.e., not for an installation package. -->
  696. <target name="widgetsets" depends="init-nonpackage, init, compile-widgetset-generator, compile-client-side"/>
  697. <!-- Build each widgetset locally, i.e., not for an installation package. -->
  698. <target name="widgetset-default" depends="init-nonpackage, init, compile-widgetset-generator, compile-widgetset-default"/>
  699. <target name="widgetset-portal-default" depends="init-nonpackage, init, compile-widgetset-generator, compile-widgetset-portal-default"/>
  700. <target name="widgetset-sampler" depends="init-nonpackage, init, compile-widgetset-generator, compile-widgetset-sampler"/>
  701. <target name="widgetset-coverflow" depends="init-nonpackage, init, compile-widgetset-generator, compile-widgetset-coverflow"/>
  702. <target name="widgetset-reserver" depends="init-nonpackage, init, compile-widgetset-generator, compile-widgetset-reserver"/>
  703. <target name="widgetset-colorpicker" depends="init-nonpackage, init, compile-widgetset-generator, compile-widgetset-colorpicker"/>
  704. <!-- ================================================================== -->
  705. <!-- Libraries and Demos -->
  706. <!-- ================================================================== -->
  707. <!-- Compile the Vaadin library JAR. -->
  708. <!-- Need only the default widgetset for this, but can't depend -->
  709. <!-- specifically on it, because dependence does not see compiled -->
  710. <!-- individual widgetsets, because antcall does not fulfill -->
  711. <!-- dependencies. -->
  712. <target name="libs" depends="compile-server-side, compile-client-side">
  713. <echo>Creating libs (server-side) ${lib-jar-name}</echo>
  714. <!-- Create Toolkit JAR -->
  715. <mkdir dir="${output-dir}/META-INF"/>
  716. <echo file="${output-dir}/META-INF/VERSION">${version.full}</echo>
  717. <echo file="${output-dir}/META-INF/GWT-VERSION">${gwt-version}</echo>
  718. <jar jarfile="${output-dir}/WebContent/WEB-INF/lib/${lib-jar-name}"
  719. compress="true" manifest="build/package/META-INF/MANIFEST.MF">
  720. <metainf dir="${output-dir}/META-INF"/>
  721. <manifest>
  722. <attribute name="Vaadin-Widgetsets" value="com.vaadin.terminal.gwt.DefaultWidgetSet" />
  723. <attribute name="Bundle-Version" value="${version.full}" />
  724. </manifest>
  725. <fileset dir="${result-path}/classes">
  726. <patternset>
  727. <exclude name="${toolkit-package}/demo/**" />
  728. <exclude name="${toolkit-package}/tests/**"/>
  729. <exclude name="${toolkit-package}/launcher/**" />
  730. <exclude name="${toolkit-package}/automatedtests/**" />
  731. </patternset>
  732. </fileset>
  733. <!-- fileupload, see build/external/fileupload/build.xml -->
  734. <fileset dir="build/external/fileupload/classes">
  735. <include name="**/*" />
  736. </fileset>
  737. <!-- add sources -->
  738. <fileset dir="${result-path}/src/core">
  739. <patternset>
  740. <exclude name="${toolkit-package}/launcher/**" />
  741. </patternset>
  742. </fileset>
  743. <fileset dir="${output-dir}/WebContent">
  744. <patternset>
  745. <include name="VAADIN/widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet/**/*" />
  746. <include name="VAADIN/themes/base/**/*" />
  747. <include name="VAADIN/themes/default/**/*" />
  748. <include name="VAADIN/themes/runo/**/*" />
  749. <include name="VAADIN/themes/reindeer/**/*" />
  750. </patternset>
  751. </fileset>
  752. </jar>
  753. <copy file="${output-dir}/WebContent/WEB-INF/lib/${lib-jar-name}" tofile="${output-dir}/WebContent/${lib-jar-name}" />
  754. </target>
  755. <!-- Demos - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  756. <target name="demo" depends="libs">
  757. <echo>Building demos</echo>
  758. <echo>Adding demo class files.</echo>
  759. <copy todir="${output-dir}/WebContent/WEB-INF/classes">
  760. <fileset dir="${result-path}/classes">
  761. <include name="${toolkit-package}/demo/**/*" />
  762. <!-- user might want to tweak launcher classes -->
  763. <include name="${toolkit-package}/launcher/**" />
  764. </fileset>
  765. </copy>
  766. <echo>Adding source for demos</echo>
  767. <copy todir="${output-dir}/WebContent/WEB-INF/src">
  768. <fileset dir="${result-path}/src/demo">
  769. <include name="${toolkit-package}/demo/**/*" />
  770. </fileset>
  771. <fileset dir="${result-path}/src/core">
  772. <!-- user might want to tweak launcher classes -->
  773. <include name="${toolkit-package}/launcher/**" />
  774. </fileset>
  775. </copy>
  776. </target>
  777. <!-- ================================================================== -->
  778. <!-- Documentation -->
  779. <!-- ================================================================== -->
  780. <target name="docs" depends="init, javadoc, manual">
  781. </target>
  782. <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  783. <!-- Manual: Build from external repository. -->
  784. <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  785. <target name="manual-init" depends="init">
  786. <!-- Can run XEP only if license is available. -->
  787. <available file="build/lib/XEP/license.xml" property="xep.license.available" />
  788. <!-- Path to installed XEP license. -->
  789. <property name="xep.license.path.installed" value="/opt/RenderX/XEP/license.xml"/>
  790. <echo>XEP license expected to be installed as ${xep.license.path.installed}</echo>
  791. <!-- Can copy XEP license only if it is available. -->
  792. <available file="${xep.license.path.installed}" property="xep.license.installed"/>
  793. </target>
  794. <!-- Checkout doc repository. -->
  795. <target name="manual-checkout" depends="manual-init" unless="docdir">
  796. <property name="manual.repository" value="http://dev.vaadin.com/svn/doc/trunk"/>
  797. <echo>Checking out manual from repository ${manual.repository}</echo>
  798. <mkdir dir="${checkout-path}"/>
  799. <exec executable="svn" dir="${checkout-path}">
  800. <arg value="checkout"/>
  801. <arg value="-q"/>
  802. <arg value="${manual.repository}"/>
  803. <arg value="docs"/>
  804. </exec>
  805. <!-- Documentation source directory. -->
  806. <property name="docdir" value="${checkout-path}/docs"/>
  807. <echo>Manual checked out from repository successfully</echo>
  808. </target>
  809. <!-- If the XEP is installed, copy it to proper place. -->
  810. <target name="xep-license-copy" if="xep.license.installed">
  811. <copy file="${xep.license.path.installed}" todir="${docdir}/build/lib/XEP"/>
  812. </target>
  813. <!-- Build manual. -->
  814. <target name="manual-build" depends="manual-init, xep-license-copy">
  815. <ant dir="${docdir}" antfile="build/build.xml" inheritAll="false">
  816. <property name="version" value="${version.full}"/>
  817. </ant>
  818. </target>
  819. <!-- Copy the manual from sub Ant results to our output directory. -->
  820. <target name="manual-copy" depends="manual-init">
  821. <copy todir="${output-dir}/WebContent/docs">
  822. <fileset dir="${docdir}/build/result/package/WebContent/docs">
  823. <exclude name="**/.svn" />
  824. <include name="book-of-vaadin.pdf" />
  825. </fileset>
  826. </copy>
  827. </target>
  828. <target name="manual-package" depends="manual-init, manual-copy">
  829. <tar destfile="${result-path}/${product-file}-docs-${version.full}.tar.gz" compression="gzip" longfile="gnu">
  830. <tarfileset prefix="docs" dir="${result-path}/${product-file}-${version.full}/WebContent/docs">
  831. <patternset>
  832. <include name="api/**" />
  833. <include name="book-of-vaadin.pdf" />
  834. <include name="example-source" />
  835. </patternset>
  836. </tarfileset>
  837. <tarfileset prefix="docs" dir="${docdir}/build/result/package/WebContent/docs">
  838. <patternset>
  839. <include name="book/**" />
  840. <include name="tutorial/**" />
  841. <include name="vaadin-tutorial.pdf" />
  842. </patternset>
  843. </tarfileset>
  844. </tar>
  845. </target>
  846. <target name="manual" depends="init, manual-init, manual-checkout, manual-build, manual-copy, manual-package">
  847. </target>
  848. <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  849. <!-- Documentation: Add Javadoc to doc -->
  850. <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  851. <target name="javadoc" depends="init, preprocess-src">
  852. <javadoc destdir="${output-dir}/WebContent/docs/api" author="true" version="true" use="true" windowtitle="${product-name}" classpathref="compile.classpath.client-side">
  853. <packageset dir="${result-path}/src/core">
  854. <include name="${toolkit-package}/**" />
  855. </packageset>
  856. <doctitle>${javadoc.doctitle}</doctitle>
  857. <!-- <header><![CDATA[<script type="text/javascript" src=".html-style/style.js"></script>]]></header> -->
  858. <bottom>${javadoc.bottom}</bottom>
  859. <link offline="true" href="http://java.sun.com/j2se/1.5.0/docs/api/" packagelistLoc="build/javadoc/j2se-1.5.0" />
  860. <link offline="true" href="http://java.sun.com/j2ee/1.4/docs/api/" packagelistLoc="build/javadoc/j2ee-1.4" />
  861. </javadoc>
  862. </target>
  863. <!-- java2html converter -->
  864. <taskdef name="java2html" classname="de.java2html.anttasks.Java2HtmlTask" classpath="build/lib/java2html.jar" />
  865. <!-- ================================================================== -->
  866. <!-- Difference to previous release package. -->
  867. <!-- ================================================================== -->
  868. <!-- This should be called after the Linux package is ready. -->
  869. <target name="differences" if="build.differences">
  870. <exec executable="python" searchpath="true" failonerror="true" output="${result-path}/differences.txt">
  871. <arg value="build/bin/package-diff.py"/>
  872. <arg value="${version.full}"/>
  873. </exec>
  874. <echo>##teamcity[publishArtifacts '${result-path}/differences.txt']</echo>
  875. </target>
  876. <!-- ================================================================== -->
  877. <!-- Nightly build. -->
  878. <!-- ================================================================== -->
  879. <!-- Main target for the nightly build. -->
  880. <target name="nightly" depends="clean-result, nightly-init, package-init, init, build, internal-package-zip">
  881. </target>
  882. <!-- Initialize a nightly build. -->
  883. <target name="nightly-init">
  884. <!-- Mandatory parameters. -->
  885. <fail unless="build.number" message="The build.number property must be defined."/>
  886. <fail unless="nightly.publish" message="The nightly.publish property must be defined."/>
  887. <!-- Optional parameters. -->
  888. <property name="build.tag" value="dev"/>
  889. <property file="build/VERSION.properties" />
  890. <echo>Base version: ${version}</echo>
  891. <echo>Build number: ${build.number}</echo>
  892. <echo>Build tag: ${build.tag}</echo>
  893. <echo>Publish target: ${nightly.publish}</echo>
  894. <!-- Set build number. -->
  895. <tstamp>
  896. <format property="nightly.date" pattern="yyyyMMdd"/>
  897. </tstamp>
  898. <property name="version.full" value="${version}.${build.tag}-${nightly.date}-c${build.number}"/>
  899. <echo>Version will be: ${version.full}</echo>
  900. <!-- Tell TeamCity the build name. Have to do it this way, because -->
  901. <!-- this script needs to get the plain build number as a parameter. -->
  902. <echo>##teamcity[buildNumber '${version}-c${build.number}']</echo>
  903. </target>
  904. <target name="nightly-teamcity-publish">
  905. <!-- Publish as a TeamCity artifact. -->
  906. <echo>##teamcity[publishArtifacts '${output-dir}/WebContent/WEB-INF/lib/${lib-jar-name}']</echo>
  907. </target>
  908. <!-- Copies the nightly build artifacts to the download server. -->
  909. <target name="nightly-download-publish" if="nightly.publish">
  910. <!-- Publish to the download server. -->
  911. <echo>Installing ${output-dir}/WebContent/${lib-jar-name} to ${nightly.publish}</echo>
  912. <echo>Hopefully you have permissions for the copy operation with SSH.</echo>
  913. <property name="package.filename" value="${result-path}/${product-file}-${version.full}.zip"/>
  914. <!-- Copy the linux installation package and the JAR. -->
  915. <exec executable="scp" searchpath="true" resultproperty="nightly.install.scp.result">
  916. <arg value="-B"/>
  917. <arg value="${output-dir}/WebContent/${lib-jar-name}"/>
  918. <arg value="${package.filename}"/>
  919. <arg value="${nightly.publish}"/>
  920. </exec>
  921. <echo>Result: ${nightly.install.scp.result}</echo>
  922. </target>
  923. <target name="nightly-publish" depends="nightly-teamcity-publish, nightly-download-publish">
  924. </target>
  925. <target name="nightly-maven-publish" depends="">
  926. <property file="${gpg.passphrase.file}" />
  927. <echo>Publishing ${output-dir}/WebContent/${lib-jar-name} to Maven repository</echo>
  928. <artifact:mvn>
  929. <arg value="gpg:sign-and-deploy-file"/>
  930. <!-- .. is a workaround as maven runs in the build directory -->
  931. <sysproperty key="file" value="../${output-dir}/WebContent/${lib-jar-name}" />
  932. <sysproperty key="pomFile" value="maven/pom.xml" />
  933. <sysproperty key="repositoryId" value="vaadin-snapshots" />
  934. <sysproperty key="url" value="http://oss.sonatype.org/content/repositories/vaadin-snapshots" />
  935. <sysproperty key="gpg.passphrase" value="${gpg.passphrase}" />
  936. </artifact:mvn>
  937. </target>
  938. <!-- ================================================================== -->
  939. <!-- Automated tests. -->
  940. <!-- ================================================================== -->
  941. <target name="tests" depends="ant-tests, server-side-tests, testbench-tests, integration-tests">
  942. </target>
  943. <target name="server-side-tests" depends="compile-java">
  944. <junit printsummary="yes">
  945. <classpath>
  946. <pathelement path="${result-path}/classes" />
  947. <path refid="compile.classpath"/>
  948. </classpath>
  949. <batchtest fork="yes">
  950. <fileset dir="tests/src" includes="com/vaadin/tests/server/**/*.java" />
  951. </batchtest>
  952. </junit>
  953. </target>
  954. <target name="testbench-tests" depends="init">
  955. <fail unless="product-file" message="The 'product-file' property must be defined."/>
  956. <fail unless="version" message="The 'version' property must be defined."/>
  957. <echo>Version: ${version.full}</echo>
  958. <!-- Parameters for the test.xml script. -->
  959. <fail unless="com.vaadin.testbench.tester.host" message="The 'com.vaadin.testbench.tester.host' property must be defined."/>
  960. <fail unless="com.vaadin.testbench.deployment.url" message="The 'com.vaadin.testbench.deployment.url' property must be defined."/>
  961. <fail unless="com.vaadin.testbench.lib.dir" message="The 'com.vaadin.testbench.lib.dir' property must be defined."/>
  962. <property name="package.name" value="${product-file}-${version.full}"/>
  963. <!-- Only Linux tests allowed. TODO: Generalize this. -->
  964. <property name="package.filename" value="${result-path}/${package.name}.zip"/>
  965. <property name="package.dir" value="${result-path}/${package.name}.zip"/>
  966. <!-- Run the separate test script. -->
  967. <ant antfile="tests/test.xml" target="test-package" inheritall="false" inheritrefs="true">
  968. <!-- This is provided so that the test script can copy the -->
  969. <!-- "tests" classes after unpacking the package. -->
  970. <property name="output-dir" value="${output-dir}"/>
  971. <property name="package.filename" value="${package.filename}"/>
  972. <property name="testing.testarea" value="/tmp/testarea"/>
  973. <property name="package.name" value="${package.name}"/>
  974. <property name="com.vaadin.testbench.tester.host" value="${com.vaadin.testbench.tester.host}"/>
  975. <property name="com.vaadin.testbench.deployment.url" value="${com.vaadin.testbench.deployment.url}"/>
  976. <property name="com.vaadin.testbench.lib.dir" value="${com.vaadin.testbench.lib.dir}"/>
  977. </ant>
  978. </target>
  979. <target name="ant-tests">
  980. <echo>##teamcity[testSuiteStarted name='com.vaadin.tests.test-framework']</echo>
  981. <!-- A smoke test for testing the testing framework. -->
  982. <echo>##teamcity[testStarted name='testingSmoketest']</echo>
  983. <echo>##teamcity[testStdOut name='testingSmoketest' out='Here be some text related to the test.]</echo>
  984. <echo>##teamcity[testFinished name='testingSmoketest']</echo>
  985. <echo>##teamcity[testSuiteFinished name='com.vaadin.tests.test-framework']</echo>
  986. </target>
  987. <target name="integration-tests" depends="internal-package-war">
  988. <!-- Parameters for the test.xml script. -->
  989. <fail unless="com.vaadin.testbench.tester.host" message="The 'com.vaadin.testbench.tester.host' property must be defined."/>
  990. <fail unless="com.vaadin.testbench.lib.dir" message="The 'com.vaadin.testbench.lib.dir' property must be defined."/>
  991. <fail unless="sshkey.file" message="The 'sshkey.file' property must be defined."/>
  992. <!-- Empty passphrase if no passphrase defined -->
  993. <property name="passphrase" value="" />
  994. <property name="demo.war" location="${result-path}/${product-file}-demo-${version.full}.war" />
  995. <!-- Run the separate test script. -->
  996. <ant antfile="tests/integration_tests.xml" target="all" inheritall="false" inheritrefs="true">
  997. <!-- This is provided so that the test script can copy the -->
  998. <!-- "tests" classes after unpacking the package. -->
  999. <property name="output-dir" value="${output-dir}"/>
  1000. <property name="com.vaadin.testbench.tester.host" value="${com.vaadin.testbench.tester.host}"/>
  1001. <property name="com.vaadin.testbench.lib.dir" value="${com.vaadin.testbench.lib.dir}"/>
  1002. <property name="sshkey.file" value="${sshkey.file}" />
  1003. <property name="passphrase" value="${passphrase}" />
  1004. <property name="demo.war" value="${demo.war}"/>
  1005. </ant>
  1006. </target>
  1007. </project>
  1008. <!-- These are for emacs. -->
  1009. <!-- Keep this comment at the end of the file
  1010. Local variables:
  1011. mode: xml
  1012. sgml-omittag:nil
  1013. sgml-shorttag:nil
  1014. sgml-namecase-general:nil
  1015. sgml-general-insert-case:lower
  1016. sgml-minimize-attributes:nil
  1017. sgml-always-quote-attributes:t
  1018. sgml-indent-step:4
  1019. sgml-indent-data:t
  1020. sgml-parent-document:nil
  1021. sgml-exposed-tags:nil
  1022. sgml-local-catalogs:("/etc/sgml/catalog" "/usr/share/xemacs21/xemacs-packages/etc/psgml-dtds/CATALOG")
  1023. sgml-local-ecat-files:("ECAT" "~/sgml/ECAT" "/usr/share/sgml/ECAT" "/usr/local/share/sgml/ECAT" "/usr/local/lib/sgml/ECAT")
  1024. End:
  1025. -->