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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279
  1. <?xml version="1.0"?>
  2. <project
  3. xmlns:antcontrib="antlib:net.sf.antcontrib"
  4. xmlns:artifact="antlib:org.apache.maven.artifact.ant"
  5. name="Vaadin"
  6. basedir="../" default="package-all">
  7. <!-- Package creation - - - - - - - - - - - - - - - - - - - - - - - - -
  8. When creating release use only "package-*" targets:
  9. package-all
  10. * creates four release packages for three three platforms (below)
  11. package-windows
  12. * vaadin-windows-<version>.zip
  13. package-linux
  14. * vaadin-linux-<version>.tar.bz2
  15. package-mac
  16. * vaadin-mac-<version>.tar.gz
  17. * vaadin-mac-<version>.dmg
  18. In addition, the OOPHM package has the following target for building:
  19. package-oophm
  20. * vaadin-oophm-<version>.zip
  21. NOTE: This build script requires directories named ${gwt-dir}/(linux|windows|mac) .
  22. See build.properties to define path where your gwt installation is located.
  23. You must unpack platform specific binaries under linux, windows and mac directories.
  24. ${gwt-dir}/${platform} (linux|windows|mac) are used for
  25. a) compile WebContent/VAADIN/widgetsets
  26. b) creating platform specific release ZIP/TGZ packages.
  27. NOTE FOR USING OOPHM:
  28. * To build with oophm define the property platform=oophm
  29. * In Eclipse this is done in External Tools Configurations -> properties
  30. * If you are using windows you must use JDK 1.6 and not 1.5
  31. * To enable building with JDK 1.6, define ignoreversion=1
  32. -->
  33. <!--
  34. Call one of package-* targets unless you understand what you are doing
  35. -->
  36. <target name="package-all" depends="clean-all, package-init, init, build, docs, internal-package-mac, internal-package-windows, internal-package-linux, internal-package-war" description="Build public packages for Windows, Linux and Mac platforms.">
  37. </target>
  38. <target name="package-mac" depends="clean-result, package-init, init, build, docs, internal-package-mac" description="Create public tar.gz package for Mac.">
  39. </target>
  40. <target name="package-windows" depends="clean-result, package-init, init, build, docs, internal-package-windows" description="Create public ZIP package for Windows.">
  41. </target>
  42. <target name="package-linux" depends="clean-result, package-init, init, build, docs, internal-package-linux" description="Create public tar.bz2 package for Linux.">
  43. </target>
  44. <target name="package-oophm" depends="clean-result, package-init, init-oophm, build, docs, internal-package-oophm" description="Create public tar.gz package for OOPHM.">
  45. </target>
  46. <target name="package-jar" depends="clean-result, package-init, init, libs" description="Create vaadin-x.y.z.jar file.">
  47. </target>
  48. <target name="package-war" depends="clean-result, package-init, init, build, docs, internal-package-linux, internal-package-war">
  49. </target>
  50. <target name="package-test" depends="clean-result, nightly-init, package-init, init, build, docs, internal-package-linux, nightly-publish">
  51. </target>
  52. <!-- ant contrib required for flow control (for loop, if, property override) -->
  53. <!-- Note that we have to use a namespace to avoid clash when running sub-ant. -->
  54. <taskdef uri="antlib:net.sf.antcontrib" resource="net/sf/antcontrib/antlib.xml">
  55. <classpath>
  56. <pathelement location="build/lib/ant-contrib-1.0b3.jar" />
  57. </classpath>
  58. </taskdef>
  59. <!-- ant contrib for Maven integration -->
  60. <path id="maven-ant-tasks.classpath" path="build/lib/maven-ant-tasks-2.0.10.jar" />
  61. <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
  62. uri="antlib:org.apache.maven.artifact.ant"
  63. classpathref="maven-ant-tasks.classpath" />
  64. <!-- internal tests for packaging -->
  65. <target name="test-build" depends="clean-result, init, build" description="used for testing build.xml">
  66. </target>
  67. <target name="test-package" depends="init" description="used for testing build.xml">
  68. <echo>Creating package for Mac platform.</echo>
  69. <antcontrib:var name="package-platform" value="mac" />
  70. <antcontrib:var name="eclipse-launch-vmargs" value="-XstartOnFirstThread -Xms128M -Xmx512M" />
  71. <antcall target="add-platform-specific-files" inheritAll="true" inheritRefs="true" />
  72. <delete file="${result-path}/eclipse-test" followsymlinks="false" />
  73. <exec executable="ln" failonerror="false">
  74. <arg line="-s" />
  75. <arg line="${output-dir}" />
  76. <arg line="${result-path}/eclipse-test" />
  77. </exec>
  78. <!--
  79. <exec executable="ln" failonerror="false">
  80. <arg line="-s" />
  81. <arg line="${gwt-dir}/${package-platform}" />
  82. <arg line="${output-dir}/gwt" />
  83. </exec>
  84. -->
  85. <!--
  86. <antcall target="create-mac-diskimage" inheritAll="true" inheritRefs="true" />
  87. -->
  88. </target>
  89. <!-- Clean results - - - - - - - - - - - - - - - - - - - - - - - - - -->
  90. <target name="clean-result" depends="">
  91. <property file="build/build.properties" />
  92. <!-- Clean build result directory. -->
  93. <delete dir="${result-path}" includes="**/*" followsymlinks="false" defaultexcludes="false" includeemptydirs="true" failonerror="false"/>
  94. </target>
  95. <!-- Clean checkout directory. -->
  96. <target name="clean-checkout" depends="">
  97. <property file="build/build.properties" />
  98. <delete dir="${checkout-path}" includes="**/*" followsymlinks="false" defaultexcludes="false" includeemptydirs="true" failonerror="false"/>
  99. </target>
  100. <target name="clean-all" depends="clean-result, clean-checkout">
  101. </target>
  102. <!-- Find out which platform we are in -->
  103. <target name="init-platform">
  104. <antcontrib:if>
  105. <contains string="${os.name}" substring="Windows" />
  106. <then>
  107. <property name="platform" value="windows" />
  108. </then>
  109. </antcontrib:if>
  110. <antcontrib:if>
  111. <equals arg1="${os.name}" arg2="Linux" />
  112. <then>
  113. <property name="platform" value="linux" />
  114. </then>
  115. </antcontrib:if>
  116. <antcontrib:if>
  117. <equals arg1="${os.name}" arg2="Mac OS X" />
  118. <then>
  119. <property name="platform" value="mac" />
  120. </then>
  121. </antcontrib:if>
  122. </target>
  123. <target name="init-oophm-platform"><property name="platform" value="oophm" /></target>
  124. <target name="init-oophm" depends="init-oophm-platform,init"></target>
  125. <!-- ================================================================== -->
  126. <!-- Check versions. -->
  127. <!-- ================================================================== -->
  128. <!-- Java compiler version. -->
  129. <target name="check-java-version">
  130. <condition property="java.version.matches">
  131. <or>
  132. <equals arg1="${ant.java.version}" arg2="1.5"/>
  133. <isset property="ignoreversion"/>
  134. </or>
  135. </condition>
  136. <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."/>
  137. <echo>Java version is ${ant.java.version} as required.</echo>
  138. </target>
  139. <!-- Check Servlet API version. -->
  140. <!-- We must use Servlet API 2.3 to catch incompatibilities.. -->
  141. <target name="check-servlet-version">
  142. <available classpathref="compile.classpath" classname="javax.servlet.Servlet" property="servlet.available"/>
  143. <fail unless="servlet.available" message="Java Servlet API library is not available."/>
  144. <echo>Java Servlet API is available.</echo>
  145. <available classpathref="compile.classpath" classname="javax.servlet.ServletRequestListener" property="servlet.version.is-2.4"/>
  146. <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."/>
  147. <echo>Java Servlet API specification 2.3 used.</echo>
  148. </target>
  149. <!-- ================================================================== -->
  150. <!-- Initialization - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  151. <!-- ================================================================== -->
  152. <!-- Called only when building installation packages. -->
  153. <target name="package-init">
  154. <!-- <property name="build.sampler.disabled" value="false"/> -->
  155. </target>
  156. <target name="init" depends="check-java-version, init-platform">
  157. <property file="build/build.properties" />
  158. <property file="build/VERSION.properties" />
  159. <property file="build/GWT-VERSION.properties" />
  160. <property file="build/html-style.properties" />
  161. <tstamp>
  162. <format property="build.date" pattern="yyyy-MM-dd"/>
  163. </tstamp>
  164. <echo>Toolkit package is: ${toolkit-package}</echo>
  165. <!-- Create result dir unless already exists -->
  166. <mkdir dir="${result-path}" />
  167. <!-- required when compiling WebContent/VAADIN/widgetsets (and also Java server-side classes) -->
  168. <property name="lib-gwt-dev" value="gwt-dev-${platform}.jar" />
  169. <echo>We are on ${platform} platform (${os.name} ${os.version}), using ${gwt-dir}/${platform}/${lib-gwt-dev} (${gwt-version}).</echo>
  170. <!-- Destination files -->
  171. <property name="lib-jar-name" value="${product-file}-${version}.jar" />
  172. <echo message="Prepared to build ${product-file} version ${version} packages" />
  173. <!-- Output directory -->
  174. <property name="output-dir" value="${result-path}/${product-file}-${version}" />
  175. <mkdir dir="${output-dir}" />
  176. <!-- Create Output Directory Hierarchy -->
  177. <mkdir dir="${output-dir}/WebContent" />
  178. <mkdir dir="${output-dir}/WebContent/demo" />
  179. <mkdir dir="${output-dir}/WebContent/docs" />
  180. <mkdir dir="${output-dir}/WebContent/docs/api" />
  181. <mkdir dir="${output-dir}/WebContent/docs/example-source" />
  182. <mkdir dir="${output-dir}/WebContent/WEB-INF" />
  183. <mkdir dir="${output-dir}/WebContent/WEB-INF/lib" />
  184. <mkdir dir="${output-dir}/WebContent/WEB-INF/classes" />
  185. <!-- Construct classpath used by java and javadoc compilation -->
  186. <path id="compile.classpath">
  187. <pathelement path="build/lib/servlet.jar" />
  188. <pathelement path="build/external/fileupload/classes" />
  189. <pathelement path="lib/reservr/gwt-maps.jar" />
  190. <pathelement path="lib/jetty/jetty-6.1.7.jar" />
  191. <pathelement path="lib/jetty/jetty-util-6.1.7.jar" />
  192. <pathelement path="lib/portlet/portal-kernel.jar" />
  193. <pathelement path="lib/portlet/portal-service.jar" />
  194. <pathelement path="lib/portlet/portlet.jar" />
  195. <pathelement path="lib/appengine/appengine-api.jar" />
  196. <pathelement path="lib/test/junit-4.5.jar" />
  197. <pathelement path="lib/test/easymock-2.5/easymock-2.5.jar" />
  198. </path>
  199. <path id="compile.classpath.server-side">
  200. <path refid="compile.classpath"/>
  201. <pathelement path="${result-path}/gwt" />
  202. </path>
  203. <path id="compile.classpath.client-side">
  204. <path refid="compile.classpath"/>
  205. <pathelement path="${gwt-dir}/${platform}/gwt-user.jar" />
  206. <pathelement path="${gwt-dir}/${platform}/${lib-gwt-dev}" />
  207. </path>
  208. </target>
  209. <target name="internal-package-windows">
  210. <antcontrib:var name="package-platform" value="windows" />
  211. <echo>Creating package for ${package-platform} platform.</echo>
  212. <antcontrib:var name="eclipse-launch-vmargs" value="-Xms256M -Xmx512M" />
  213. <antcall target="add-platform-specific-files" inheritAll="true" inheritRefs="true" />
  214. <zip zipfile="${result-path}/${product-file}-${package-platform}-${version}.zip">
  215. <zipfileset prefix="${product-file}-${package-platform}-${version}" dir="${result-path}/${product-file}-${version}">
  216. <patternset>
  217. <include name="**/*" />
  218. </patternset>
  219. </zipfileset>
  220. <zipfileset prefix="${product-file}-${package-platform}-${version}/gwt" dir="${gwt-dir}/${package-platform}">
  221. <patternset>
  222. <include name="**/*" />
  223. <exclude name="gwt/doc"/>
  224. <exclude name="gwt/samples"/>
  225. </patternset>
  226. </zipfileset>
  227. </zip>
  228. </target>
  229. <target name="internal-package-linux">
  230. <antcontrib:var name="package-platform" value="linux" />
  231. <echo>Creating package for ${package-platform} platform.</echo>
  232. <antcontrib:var name="eclipse-launch-vmargs" value="-Xms256M -Xmx512M" />
  233. <antcall target="add-platform-specific-files" inheritAll="true" inheritRefs="true" />
  234. <tar destfile="${result-path}/${product-file}-${package-platform}-${version}.tar.gz" compression="gzip" longfile="gnu">
  235. <!-- TODO use very slow but effective bzip2
  236. <tar destfile="${result-path}/${product-file}-${package-platform}-${version}.tar.bz2" compression="bzip2" longfile="gnu">
  237. -->
  238. <tarfileset prefix="${product-file}-${package-platform}-${version}" dir="${result-path}/${product-file}-${version}">
  239. <patternset>
  240. <include name="**/*" />
  241. </patternset>
  242. </tarfileset>
  243. <tarfileset prefix="${product-file}-${package-platform}-${version}/gwt" dir="${gwt-dir}/${package-platform}">
  244. <patternset>
  245. <include name="**/*" />
  246. </patternset>
  247. </tarfileset>
  248. </tar>
  249. </target>
  250. <target name="internal-package-oophm">
  251. <antcontrib:var name="package-platform" value="oophm" />
  252. <echo>Creating package for ${package-platform} platform.</echo>
  253. <antcontrib:var name="eclipse-launch-vmargs" value="-Xms256M -Xmx512M" />
  254. <antcall target="add-platform-specific-files" inheritAll="true" inheritRefs="true" />
  255. <zip zipfile="${result-path}/${product-file}-${package-platform}-${version}.zip">
  256. <zipfileset prefix="${product-file}-${package-platform}-${version}" dir="${result-path}/${product-file}-${version}">
  257. <patternset>
  258. <include name="**/*" />
  259. </patternset>
  260. </zipfileset>
  261. <zipfileset prefix="${product-file}-${package-platform}-${version}/gwt" dir="${gwt-dir}/${package-platform}">
  262. <patternset>
  263. <include name="**/*" />
  264. </patternset>
  265. </zipfileset>
  266. </zip>
  267. </target>
  268. <target name="internal-package-mac">
  269. <antcontrib:var name="package-platform" value="mac" />
  270. <echo>Creating package for ${package-platform} platform.</echo>
  271. <antcontrib:var name="eclipse-launch-vmargs" value="-XstartOnFirstThread -Xms256M -Xmx512M" />
  272. <antcall target="add-platform-specific-files" inheritAll="true" inheritRefs="true" />
  273. <tar destfile="${result-path}/${product-file}-${package-platform}-${version}.tar.gz" compression="gzip" longfile="gnu">
  274. <tarfileset prefix="${product-file}-${package-platform}-${version}" dir="${result-path}/${product-file}-${version}">
  275. <patternset>
  276. <include name="**/*" />
  277. </patternset>
  278. </tarfileset>
  279. <tarfileset prefix="${product-file}-${package-platform}-${version}/gwt" dir="${gwt-dir}/${package-platform}">
  280. <patternset>
  281. <include name="**/*" />
  282. </patternset>
  283. </tarfileset>
  284. </tar>
  285. <!-- TODO: remove me: DISABLE for speed -->
  286. <!-- <antcall target="create-mac-diskimage" inheritAll="true" inheritRefs="true" /> -->
  287. </target>
  288. <target name="internal-package-war">
  289. <echo>Building WAR</echo>
  290. <!-- Add the files. -->
  291. <!-- Warning: This should not really be "platform spefic". -->
  292. <antcontrib:var name="package-platform" value="linux" />
  293. <antcontrib:var name="eclipse-launch-vmargs" value="-Xms256M -Xmx512M" />
  294. <antcall target="add-platform-specific-files" inheritAll="true" inheritRefs="true" />
  295. <!-- Copy source tree to class tree. -->
  296. <!-- A workaround for not setting classpath properly in WAR. -->
  297. <copy todir="${output-dir}/WebContent/WEB-INF/classes">
  298. <fileset dir="${output-dir}/WebContent/WEB-INF/src">
  299. <include name="**/*" />
  300. </fileset>
  301. </copy>
  302. <war warfile="${result-path}/${product-file}-demo-${version}.war">
  303. <fileset dir="${output-dir}/WebContent">
  304. <include name="**/*" />
  305. </fileset>
  306. </war>
  307. </target>
  308. <target name="create-mac-diskimage">
  309. <!-- create Mac disk image (dmg) also -->
  310. <property name="mount.dir" value="${result-path}/mac-mounted-image" />
  311. <mkdir dir="${mount.dir}" />
  312. <delete file="${result-path}/*.dmg" />
  313. <antcontrib:if>
  314. <equals arg1="${platform}" arg2="mac" />
  315. <then>
  316. <untar src="${result-path}/${product-file}-${package-platform}-${version}.tar.gz" dest="${result-path}/" compression="gzip" />
  317. <echo>Creating Mac disk image (dmg)</echo>
  318. <!-- create image -->
  319. <echo>hdiutil create -format UDRW -volname ${product-file}-${version} -srcfolder ${result-path}/${product-file}-${package-platform}-${version} ${result-path}/disk-image.dmg</echo>
  320. <exec executable="hdiutil" failonerror="true">
  321. <arg line="create -format UDRW -volname ${product-file}-${version} -srcfolder ${result-path}/${product-file}-${package-platform}-${version} ${result-path}/disk-image.dmg" />
  322. </exec>
  323. <!-- open image -->
  324. <exec executable="hdiutil" failonerror="true">
  325. <arg line='attach' />
  326. <arg line='-readwrite' />
  327. <arg line='-noverify' />
  328. <arg line='-noautoopen' />
  329. <arg line='-mountpoint ${mount.dir}' />
  330. <arg line='${result-path}/disk-image.dmg' />
  331. </exec>
  332. <!-- make sure root folder is opened when image is -->
  333. <exec executable="bless" failonerror="true">
  334. <arg line='--folder ${mount.dir}' />
  335. <arg line='--openfolder ${mount.dir}' />
  336. </exec>
  337. <!-- hack: wait for completion -->
  338. <exec executable="sleep" failonerror="true">
  339. <arg line='2' />
  340. </exec>
  341. <!-- here we could position items -->
  342. <!--
  343. <exec executable="osascript" failonerror="true">
  344. <arg line='package/positionItems.scpt ${mount.dir}' />
  345. </exec>
  346. -->
  347. <!-- turn on volume icon -->
  348. <exec executable="/Developer/Tools/SetFile" failonerror="true">
  349. <arg line='-a C' />
  350. <arg line='${mount.dir}' />
  351. </exec>
  352. <!-- set executable bit -->
  353. <chmod file="${mount.dir}/start.sh" perm="ugo+x" />
  354. <!-- close image -->
  355. <exec executable="hdiutil" failonerror="true">
  356. <arg line='detach ${mount.dir}/' />
  357. </exec>
  358. <!-- make read-only -->
  359. <exec executable="hdiutil" failonerror="true">
  360. <arg line='convert ${result-path}/disk-image.dmg' />
  361. <arg line='-format UDZO' />
  362. <arg line='-imagekey zlib-level=9' />
  363. <arg line='-o ${result-path}/${product-file}-${package-platform}-${version}.dmg' />
  364. </exec>
  365. <delete file="${result-path}/disk-image.dmg" />
  366. <!-- internet-enable -->
  367. <exec executable="hdiutil" failonerror="true">
  368. <arg line='internet-enable ${result-path}/${product-file}-${package-platform}-${version}.dmg' />
  369. </exec>
  370. </then>
  371. </antcontrib:if>
  372. </target>
  373. <target name="add-platform-specific-files">
  374. <echo>Adding platform specific files for ${package-platform}</echo>
  375. <delete includeemptydirs="true" defaultexcludes="false">
  376. <fileset dir="${output-dir}">
  377. <include name=".*" />
  378. <include name="*.launch" />
  379. <include name="*.txt" />
  380. <include name="*.bat" />
  381. <include name="*.sh" />
  382. <include name="*.app" />
  383. <include name="build-widgetset.xml" />
  384. </fileset>
  385. </delete>
  386. <copy todir="${output-dir}">
  387. <filterchain>
  388. <expandproperties />
  389. <replacetokens begintoken="@" endtoken="@">
  390. <token key="version" value="${version}" />
  391. </replacetokens>
  392. <replacetokens begintoken="@" endtoken="@">
  393. <token key="platform" value="${package-platform}" />
  394. </replacetokens>
  395. </filterchain>
  396. <fileset dir="WebContent/license">
  397. <include name="COPYING" />
  398. </fileset>
  399. </copy>
  400. <copy todir="${output-dir}/WebContent">
  401. <filterchain>
  402. <expandproperties />
  403. <replacetokens begintoken="@" endtoken="@">
  404. <token key="version" value="${version}" />
  405. <token key="/version" value="" />
  406. </replacetokens>
  407. <replacetokens begintoken="@" endtoken="@">
  408. <token key="platform" value="${package-platform}" />
  409. <token key="/platform" value="" />
  410. </replacetokens>
  411. <replacetokens begintoken="@" endtoken="@">
  412. <token key="builddate" value="${build.date}" />
  413. </replacetokens>
  414. </filterchain>
  415. <fileset dir="WebContent">
  416. <exclude name="**/.svn" />
  417. <exclude name="windoweddemos.html" />
  418. <include name="release-notes.html" />
  419. <include name="*.html" />
  420. <include name="license/*.html" />
  421. <include name="license/*.txt" />
  422. </fileset>
  423. </copy>
  424. <copy file="build/package/${package-platform}-readme.txt" tofile="${output-dir}/readme.txt">
  425. <filterchain>
  426. <expandproperties />
  427. <replacetokens begintoken="&lt;" endtoken=">">
  428. <token key="version" value="${version}" />
  429. <token key="/version" value="" />
  430. </replacetokens>
  431. </filterchain>
  432. </copy>
  433. <copy todir="${output-dir}">
  434. <filterchain>
  435. <expandproperties />
  436. <!-- .classpath, *.launch, build-widgetset.xml -->
  437. <replacetokens begintoken="&lt;" endtoken=">">
  438. <token key="version" value="${version}" />
  439. <token key="/version" value="" />
  440. </replacetokens>
  441. <!-- .classpath -->
  442. <replacetokens begintoken="&lt;" endtoken=">">
  443. <token key="platform-specific-entries" value="&lt;classpathentry kind=&quot;lib&quot; path=&quot;gwt/gwt-dev-${package-platform}.jar&quot; /&gt;" />
  444. <token key="/platform-specific-entries" value="" />
  445. </replacetokens>
  446. <!-- .classpath, HostedMode.launch, build-widgetset.xml -->
  447. <!-- We can't use XML notation for this, because it can be inside an attribute definition. -->
  448. <replacetokens begintoken="@" endtoken="@">
  449. <token key="platform" value="${package-platform}" />
  450. </replacetokens>
  451. <!-- .project, *.launch -->
  452. <replacetokens begintoken="&lt;" endtoken=">">
  453. <token key="eclipse-workspace-name" value="${eclipse-workspace-name}" />
  454. <token key="/eclipse-workspace-name" value="" />
  455. </replacetokens>
  456. <!-- HostedMode.launch -->
  457. <replacetokens begintoken="&lt;" endtoken=">">
  458. <token key="eclipse-launch-vmargs" value="${eclipse-launch-vmargs}" />
  459. <token key="/eclipse-launch-vmargs" value="" />
  460. </replacetokens>
  461. </filterchain>
  462. <fileset dir="build/package">
  463. <include name="eclipse-classpath" />
  464. <include name="eclipse-project" />
  465. <include name="eclipse*launch" />
  466. <include name="build-widgetset.xml" />
  467. <include name="eclipse-org.eclipse.core.resources.prefs" />
  468. <include name="eclipse-org.eclipse.jdt.core.prefs" />
  469. </fileset>
  470. </copy>
  471. <move file="${output-dir}/build-widgetset.xml" tofile="${output-dir}/WebContent/docs/example-source/build-widgetset.xml" />
  472. <move file="${output-dir}/eclipse-classpath" tofile="${output-dir}/.classpath" />
  473. <move file="${output-dir}/eclipse-project" tofile="${output-dir}/.project" />
  474. <move file="${output-dir}/eclipse-Vaadin Hosted Mode Browser-launch" tofile="${output-dir}/Vaadin Hosted Mode Browser.launch" />
  475. <move file="${output-dir}/eclipse-Vaadin Development Server-launch" tofile="${output-dir}/Vaadin Development Server.launch" />
  476. <mkdir dir="${output-dir}/.settings" />
  477. <move file="${output-dir}/eclipse-org.eclipse.core.resources.prefs" tofile="${output-dir}/.settings/org.eclipse.core.resources.prefs" />
  478. <move file="${output-dir}/eclipse-org.eclipse.jdt.core.prefs" tofile="${output-dir}/.settings/org.eclipse.jdt.core.prefs" />
  479. <antcontrib:if>
  480. <equals arg1="${package-platform}" arg2="windows" />
  481. <then>
  482. <copy todir="${output-dir}">
  483. <fileset dir="build/package">
  484. <include name="start.bat" />
  485. </fileset>
  486. </copy>
  487. </then>
  488. </antcontrib:if>
  489. <antcontrib:if>
  490. <equals arg1="${package-platform}" arg2="linux" />
  491. <then>
  492. <copy todir="${output-dir}">
  493. <fileset dir="build/package">
  494. <include name="start.sh" />
  495. </fileset>
  496. </copy>
  497. <chmod file="${output-dir}/start.sh" perm="ugo+x" />
  498. <exec executable="chmod" failonerror="false">
  499. <arg line="ugo+x" />
  500. <arg line="${output-dir}/start.sh" />
  501. </exec>
  502. </then>
  503. </antcontrib:if>
  504. <antcontrib:if>
  505. <equals arg1="${package-platform}" arg2="oophm" />
  506. <then>
  507. <copy todir="${output-dir}">
  508. <fileset dir="build/package">
  509. <include name="start.sh" />
  510. </fileset>
  511. </copy>
  512. <chmod file="${output-dir}/start.sh" perm="ugo+x" />
  513. <exec executable="chmod" failonerror="false">
  514. <arg line="ugo+x" />
  515. <arg line="${output-dir}/start.sh" />
  516. </exec>
  517. </then>
  518. </antcontrib:if>
  519. <antcontrib:if>
  520. <equals arg1="${package-platform}" arg2="mac" />
  521. <then>
  522. <copy todir="${output-dir}">
  523. <fileset dir="build/package">
  524. <include name="start.sh" />
  525. </fileset>
  526. </copy>
  527. <!-- must be done manually -->
  528. <!-- <exec executable="cp" failonerror="true">
  529. <arg line="-r" />
  530. <arg line="build/package/Start.app" />
  531. <arg line="${output-dir}" />
  532. </exec> -->
  533. <!-- but again, ant just fails with any * or other special characters -->
  534. <!-- package icon or folder background image / icon placements not in use -->
  535. <!--
  536. <exec executable="cp" failonerror="true">
  537. <arg line="build/package/Icon*" />
  538. <arg line="${output-dir}" />
  539. </exec>
  540. <exec executable="cp" failonerror="true">
  541. <arg line="build/package/mac-DS_Store" />
  542. <arg line="${output-dir}/.DS_Store" />
  543. </exec>
  544. <copy file="build/package/mac-VolumeIcon.icns" tofile="${output-dir}/.VolumeIcon.icns" />
  545. -->
  546. <chmod file="${output-dir}/start.sh" perm="ugo+x" />
  547. <exec executable="chmod" failonerror="false">
  548. <arg line="ugo+x" />
  549. <arg line="${output-dir}/start.sh" />
  550. </exec>
  551. </then>
  552. </antcontrib:if>
  553. </target>
  554. <target name="build" depends="libs, compile-client-side, demo" description="Build package required files, without packing them.">
  555. </target>
  556. <!-- Copy and preprocess sources for packaging
  557. NOTE: Replaces <version></version> tags with build version tag for some "textual" files
  558. -->
  559. <target name="preprocess-src">
  560. <loadfile property="ITMillApache2LicenseForJavaFiles" srcFile="build/ITMillApache2LicenseForJavaFiles.txt" />
  561. <mkdir dir="${result-path}/src" />
  562. <echo>Copying src directory and processing copied files.</echo>
  563. <echo>Replacing &lt;version&gt; tag with build version for java/html/css/xml files.</echo>
  564. <copy todir="${result-path}/src">
  565. <filterset>
  566. <filter token="ITMillApache2LicenseForJavaFiles" value="${ITMillApache2LicenseForJavaFiles}" />
  567. <filter token="VERSION" value="${version}" />
  568. </filterset>
  569. <fileset dir="src">
  570. <patternset>
  571. <include name="**/*.java" />
  572. <include name="**/*.html" />
  573. <include name="**/*.css" />
  574. <include name="**/*.xml" />
  575. <exclude name="**/tests/**" unless="build.include.tests"/>
  576. <exclude name="**/demo/sampler/**" if="build.sampler.disabled" />
  577. </patternset>
  578. </fileset>
  579. </copy>
  580. <!-- Unify mix usage of mac/Linux/Win characters -->
  581. <echo>Unifying mix usage of Mac/Linux/Win linefeeds for java/html/css/xml files.</echo>
  582. <fixcrlf srcdir="${result-path}/src" eol="crlf" tablength="4" tab="asis" includes="**/*.java **/*.html **/*.css **/*.xml" />
  583. <!-- Add other files such as images, these are not filtered or processed by fixcrlf task -->
  584. <echo>Copying non java/html/css/xml files such as images.</echo>
  585. <copy todir="${result-path}/src">
  586. <fileset dir="src">
  587. <patternset>
  588. <exclude name="**/.svn" />
  589. <exclude name="**/*.java" />
  590. <exclude name="**/*.html" />
  591. <exclude name="**/*.css" />
  592. <exclude name="**/*.xml" />
  593. <exclude name="**/tests/**" unless="build.include.tests"/>
  594. <exclude name="**/demo/sampler/**" if="build.sampler.disabled" />
  595. </patternset>
  596. </fileset>
  597. </copy>
  598. </target>
  599. <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  600. WebContent
  601. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  602. <target name="webcontent" depends="preprocess-src,defaulttheme">
  603. <!-- copy 3rd part libraries used by demo -->
  604. <copy todir="${output-dir}/WebContent/demo/lib">
  605. <fileset dir="lib">
  606. <include name="reservr/**/*" />
  607. </fileset>
  608. </copy>
  609. <copy todir="${output-dir}/WebContent/demo/lib">
  610. <fileset dir="lib">
  611. <include name="jetty/**/*" />
  612. </fileset>
  613. </copy>
  614. <copy todir="${output-dir}/WebContent/demo/lib">
  615. <fileset dir="lib">
  616. <include name="portlet/**/*" />
  617. </fileset>
  618. </copy>
  619. <!-- Add demo sources -->
  620. <echo>Adding demo sources to WebContent/WEB-INF/src</echo>
  621. <copy todir="${output-dir}/WebContent/WEB-INF/src">
  622. <fileset dir="${result-path}/src">
  623. <include name="${toolkit-package}/demo/**/*" />
  624. <exclude name="${toolkit-package}/demo/sampler/**" if="build.sampler.disabled" />
  625. </fileset>
  626. </copy>
  627. <echo>Creating demo source html files</echo>
  628. <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" />
  629. <!-- Add WebContent -->
  630. <echo>Adding VAADIN/themes, demo and hsqldb.jar files.</echo>
  631. <copy todir="${output-dir}/WebContent">
  632. <fileset dir="WebContent">
  633. <exclude name="**/.svn" />
  634. <!-- TODO check what is neccessary -->
  635. <!-- These are needed for running tests, but are copied during testing. -->
  636. <exclude name="VAADIN/themes/tests*"/>
  637. <exclude name="VAADIN/themes/tests-magi/**/*" />
  638. <exclude name="VAADIN/themes/tests-featurebrowser/**/*" />
  639. <exclude name="VAADIN/themes/tests*/**/*"/>
  640. <exclude name="VAADIN/themes/sampler/**" if="build.sampler.disabled" />
  641. <include name="demo/**/*" />
  642. <include name="WEB-INF/lib/hsqldb.jar" />
  643. <include name="VAADIN/themes/**/*" />
  644. <include name="META-INF/**/*" />
  645. </fileset>
  646. </copy>
  647. <!-- Add package specific WebContent files from build/package/WebContent -->
  648. <copy todir="${output-dir}/WebContent">
  649. <fileset dir="build/package/WebContent">
  650. <exclude name="**/.*" />
  651. <include name="**/*" />
  652. </fileset>
  653. </copy>
  654. <java classname="com.vaadin.buildhelpers.PortletConfigurationGenerator" failonerror="yes" fork="yes" maxmemory="512m">
  655. <arg value="${output-dir}/WebContent/WEB-INF" />
  656. <arg value="com.vaadin.demo.sampler.gwt.SamplerWidgetSet" />
  657. <classpath>
  658. <pathelement location="build/buildhelpers/" />
  659. </classpath>
  660. </java>
  661. </target>
  662. <target name="compile-fileupload">
  663. <echo>Compiling custom fileupload classes.</echo>
  664. <ant dir="build/external/fileupload" antfile="build.xml" target="compile" />
  665. </target>
  666. <target name="unpack-gwt" depends="init">
  667. <!-- Unpack GWT from JARs. This is needed for excluding Servlet API 2.4. -->
  668. <delete dir="${result-path}/gwt"/>
  669. <unjar src="${gwt-dir}/${platform}/gwt-user.jar" dest="${result-path}/gwt/"/>
  670. <unjar src="${gwt-dir}/${platform}/${lib-gwt-dev}" dest="${result-path}/gwt/"/>
  671. <delete dir="${result-path}/gwt/javax/servlet"/>
  672. </target>
  673. <target name="compile-java" depends="init, unpack-gwt, check-servlet-version, compile-fileupload, webcontent">
  674. <echo>Compiling src (server-side)</echo>
  675. <!-- Compile -->
  676. <mkdir dir="${result-path}/classes" />
  677. <javac source="1.5" target="1.5" classpathref="compile.classpath.server-side" destdir="${result-path}/classes" debug="true" encoding="UTF-8">
  678. <src path="${result-path}/src"/>
  679. <!-- This seems to be included by default: include name="${toolkit-package}/**"/ -->
  680. <exclude name="${toolkit-package}/demo/sampler/**" if="build.sampler.disabled" />
  681. <exclude name="${toolkit-package}/tests/**" unless="build.include.tests"/>
  682. </javac>
  683. </target>
  684. <target name="defaulttheme">
  685. <echo>Combining default themes css files</echo>
  686. <!-- ensure buildhelpers are compiled -->
  687. <javac source="1.5" target="1.5" srcdir="build/buildhelpers" classpath="build/smartsprites/lib/smartsprites-0.2.3-itmill.jar"/>
  688. <java classname="com.vaadin.buildhelpers.CompileDefaultTheme" failonerror="yes" fork="yes">
  689. <classpath>
  690. <pathelement location="build/buildhelpers" />
  691. <fileset dir="build/smartsprites/lib">
  692. <include name="*.jar"/>
  693. </fileset>
  694. </classpath>
  695. <jvmarg value="-Djava.awt.headless=true"/>
  696. </java>
  697. </target>
  698. <target name="testtarget">
  699. <echo>TEST TARGET CALLED</echo>
  700. </target>
  701. <target name="remove-widgetset-gwt-tmp">
  702. <echo>Removing widgetset temp files</echo>
  703. <delete dir="${output-dir}/WebContent/VAADIN/widgetsets/.gwt-tmp" includeemptydirs="true"/>
  704. </target>
  705. <target name="compile-widgetset-default">
  706. <echo>Compiling src (client-side)</echo>
  707. <echo>com.vaadin.terminal.gwt.DefaultWidgetSet</echo>
  708. <java classname="com.google.gwt.dev.Compiler" failonerror="yes" fork="yes" maxmemory="512m">
  709. <arg value="-war" />
  710. <arg value="${output-dir}/WebContent/VAADIN/widgetsets" />
  711. <arg value="com.vaadin.terminal.gwt.DefaultWidgetSet" />
  712. <arg value="-style" />
  713. <arg value="OBF" />
  714. <jvmarg value="-Xss8M"/>
  715. <jvmarg value="-Djava.awt.headless=true"/>
  716. <classpath>
  717. <pathelement location="${gwt-dir}/${platform}/gwt-user.jar" />
  718. <pathelement location="${gwt-dir}/${platform}/${lib-gwt-dev}" />
  719. <pathelement location="build/classes" />
  720. <pathelement location="${result-path}/src" />
  721. </classpath>
  722. </java>
  723. <antcall target="remove-widgetset-gwt-tmp"/>
  724. <echo>Compiled DefaultWidgetSet</echo>
  725. </target>
  726. <target name="compile-widgetset-portal-default">
  727. <echo>Compiling src (client-side)</echo>
  728. <echo>com.vaadin.portal.gwt.PortalDefaultWidgetSet</echo>
  729. <java classname="com.google.gwt.dev.Compiler" failonerror="yes" fork="yes" maxmemory="512m">
  730. <arg value="-war" />
  731. <arg value="${output-dir}/WebContent/VAADIN/widgetsets" />
  732. <arg value="com.vaadin.portal.gwt.PortalDefaultWidgetSet" />
  733. <arg value="-style" />
  734. <arg value="OBF" />
  735. <jvmarg value="-Xss8M"/>
  736. <jvmarg value="-Djava.awt.headless=true"/>
  737. <classpath>
  738. <pathelement location="${gwt-dir}/${platform}/gwt-user.jar" />
  739. <pathelement location="${gwt-dir}/${platform}/${lib-gwt-dev}" />
  740. <pathelement location="${result-path}/src" />
  741. <pathelement location="build/classes" />
  742. </classpath>
  743. </java>
  744. <antcall target="remove-widgetset-gwt-tmp"/>
  745. <echo>Compiled PortalDefaultWidgetSet</echo>
  746. </target>
  747. <target name="compile-widgetset-reserver">
  748. <condition property="googlemaps-jar" value="${output-dir}/WebContent/demo/lib/reservr/gwt-maps.jar">
  749. <available file="${output-dir}/WebContent/demo/lib/reservr/gwt-maps.jar" />
  750. </condition>
  751. <condition property="googlemaps-jar" value="lib/reservr/gwt-maps.jar">
  752. <available file="lib/reservr/gwt-maps.jar" />
  753. </condition>
  754. <echo>com.vaadin.demo.reservation.gwt.ReservationWidgetSet</echo>
  755. <java classname="com.google.gwt.dev.Compiler" failonerror="yes" fork="yes" maxmemory="512m">
  756. <arg value="-war" />
  757. <arg value="${output-dir}/WebContent/VAADIN/widgetsets" />
  758. <arg value="com.vaadin.demo.reservation.gwt.ReservationWidgetSet" />
  759. <arg value="-style" />
  760. <arg value="OBF" />
  761. <jvmarg value="-Xss8M"/>
  762. <jvmarg value="-Djava.awt.headless=true"/>
  763. <classpath>
  764. <pathelement location="${gwt-dir}/${platform}/gwt-user.jar" />
  765. <pathelement location="${gwt-dir}/${platform}/${lib-gwt-dev}" />
  766. <pathelement location="${result-path}/src" />
  767. <!-- demo jars -->
  768. <pathelement location="${googlemaps-jar}" />
  769. <!-- demo widgetset sources -->
  770. <pathelement path="${output-dir}/WebContent/WEB-INF/src" />
  771. <pathelement location="build/classes" />
  772. </classpath>
  773. </java>
  774. <antcall target="remove-widgetset-gwt-tmp"/>
  775. <echo>Compiled ReservationWidgetSet</echo>
  776. </target>
  777. <!-- Building Sampler for installation package is disabled. -->
  778. <target name="compile-widgetset-sampler" unless="build.sampler.disabled">
  779. <echo>com.vaadin.demo.sampler.gwt.SamplerWidgetSet</echo>
  780. <java classname="com.google.gwt.dev.Compiler" failonerror="yes" fork="yes" maxmemory="512m">
  781. <arg value="-war" />
  782. <arg value="${output-dir}/WebContent/VAADIN/widgetsets" />
  783. <arg value="com.vaadin.demo.sampler.gwt.SamplerWidgetSet" />
  784. <arg value="-style" />
  785. <arg value="OBF" />
  786. <jvmarg value="-Xss8M"/>
  787. <jvmarg value="-Djava.awt.headless=true"/>
  788. <classpath>
  789. <pathelement location="${gwt-dir}/${platform}/gwt-user.jar" />
  790. <pathelement location="${gwt-dir}/${platform}/${lib-gwt-dev}" />
  791. <pathelement location="${result-path}/src" />
  792. <!-- demo widgetset sources -->
  793. <pathelement path="${output-dir}/WebContent/WEB-INF/src" />
  794. <pathelement location="build/classes" />
  795. </classpath>
  796. </java>
  797. <antcall target="remove-widgetset-gwt-tmp"/>
  798. <echo>Compiled SamplerWidgetSet</echo>
  799. </target>
  800. <target name="compile-widgetset-coverflow">
  801. <echo>com.vaadin.demo.coverflow.gwt.CoverflowWidgetSet</echo>
  802. <java classname="com.google.gwt.dev.Compiler" failonerror="yes" fork="yes" maxmemory="512m">
  803. <arg value="-war" />
  804. <arg value="${output-dir}/WebContent/VAADIN/widgetsets" />
  805. <arg value="com.vaadin.demo.coverflow.gwt.CoverflowWidgetSet" />
  806. <arg value="-style" />
  807. <arg value="OBF" />
  808. <jvmarg value="-Xss8M"/>
  809. <jvmarg value="-Djava.awt.headless=true"/>
  810. <classpath>
  811. <pathelement location="${gwt-dir}/${platform}/gwt-user.jar" />
  812. <pathelement location="${gwt-dir}/${platform}/${lib-gwt-dev}" />
  813. <pathelement location="${result-path}/src" />
  814. <!-- demo widgetset sources -->
  815. <pathelement path="${output-dir}/WebContent/WEB-INF/src" />
  816. <pathelement location="build/classes" />
  817. </classpath>
  818. </java>
  819. <antcall target="remove-widgetset-gwt-tmp"/>
  820. <echo>Compiled CoverflowWidgetSet</echo>
  821. </target>
  822. <target name="compile-widgetset-colorpicker">
  823. <echo>com.vaadin.demo.colorpicker.gwt.ColorPickerWidgetSet</echo>
  824. <java classname="com.google.gwt.dev.Compiler" failonerror="yes" fork="yes" maxmemory="512m">
  825. <arg value="-war" />
  826. <arg value="${output-dir}/WebContent/VAADIN/widgetsets" />
  827. <arg value="com.vaadin.demo.colorpicker.gwt.ColorPickerWidgetSet" />
  828. <arg value="-style" />
  829. <arg value="OBF" />
  830. <jvmarg value="-Xss8M"/>
  831. <jvmarg value="-Djava.awt.headless=true"/>
  832. <classpath>
  833. <pathelement location="${gwt-dir}/${platform}/gwt-user.jar" />
  834. <pathelement location="${gwt-dir}/${platform}/${lib-gwt-dev}" />
  835. <pathelement location="${result-path}/src" />
  836. <!-- demo widgetset sources -->
  837. <pathelement path="${output-dir}/WebContent/WEB-INF/src" />
  838. <pathelement location="build/classes" />
  839. </classpath>
  840. </java>
  841. <antcall target="remove-widgetset-gwt-tmp"/>
  842. <echo>Compiled ColorPickerWidgetSet</echo>
  843. </target>
  844. <!-- Builds the client-side engine, i.e., the widgetsets. -->
  845. <target name="compile-client-side" depends="compile-widgetset-default, compile-widgetset-portal-default, compile-widgetset-reserver, compile-widgetset-sampler, compile-widgetset-colorpicker, compile-widgetset-coverflow">
  846. <!-- Building the widgetsets is currently done sequentially, because
  847. parallel compilation takes too much memory for most machines. -->
  848. </target>
  849. <!-- Definitions for building local components, i.e., not for an installation package. -->
  850. <target name="init-nonpackage" depends="init-platform">
  851. <property file="build/VERSION.properties" />
  852. <property file="build/GWT-VERSION.properties" />
  853. <!-- Definitions for building the client-side. -->
  854. <property name="output-dir" value="." />
  855. <!-- The "result-path" simply contains the sources. -->
  856. <property name="result-path" value="." />
  857. <!-- Path to GWT directory. TODO: This should be read from build.properties file. -->
  858. <property name="gwt-dir" value="build/gwt" />
  859. <!-- required when compiling WebContent/VAADIN/widgetsets (and also Java server-side classes) -->
  860. <property name="lib-gwt-dev" value="gwt-dev-${platform}.jar" />
  861. <echo>We are on ${platform} platform, using ${gwt-dir}/${platform}/${lib-gwt-dev}.</echo>
  862. <echo>GWT dir: ${gwt-dir}</echo>
  863. <echo>Output dir: ${output-dir}</echo>
  864. </target>
  865. <!-- Builds all widgetsets locally, i.e., not for an installation package. -->
  866. <target name="widgetsets" depends="init-nonpackage, compile-client-side">
  867. </target>
  868. <!-- Builds the default widgetset locally, i.e., not for an installation package. -->
  869. <target name="widgetset-default" depends="init-nonpackage, compile-widgetset-default">
  870. </target>
  871. <!-- Builds the default portal widgetset locally, i.e., not for an installation package. -->
  872. <target name="widgetset-portal-default" depends="init-nonpackage, compile-widgetset-portal-default">
  873. </target>
  874. <!-- Builds the sampler widgetset locally, i.e., not for an installation package. -->
  875. <target name="widgetset-sampler" depends="init-nonpackage, compile-widgetset-sampler">
  876. </target>
  877. <!-- Builds the coverflow widgetset locally, i.e., not for an installation package. -->
  878. <target name="widgetset-coverflow" depends="init-nonpackage, compile-widgetset-coverflow">
  879. </target>
  880. <!-- Builds the reservation widgetset locally, i.e., not for an installation package. -->
  881. <target name="widgetset-reserver" depends="init-nonpackage, compile-widgetset-reserver">
  882. </target>
  883. <!-- Builds the colorpicker widgetset locally, i.e., not for an installation package. -->
  884. <target name="widgetset-colorpicker" depends="init-nonpackage, compile-widgetset-colorpicker">
  885. </target>
  886. <!-- Compile the Toolkit library JAR. -->
  887. <!-- Only need the default widgetset for this. -->
  888. <target name="libs" depends="compile-java, webcontent, compile-widgetset-default">
  889. <echo>Creating libs (server-side) ${lib-jar-name}</echo>
  890. <!-- Create Toolkit JAR -->
  891. <mkdir dir="${output-dir}/META-INF"/>
  892. <echo file="${output-dir}/META-INF/VERSION">${version}</echo>
  893. <echo file="${output-dir}/META-INF/GWT-VERSION">${gwt-version}</echo>
  894. <jar jarfile="${output-dir}/WebContent/WEB-INF/lib/${lib-jar-name}" compress="true">
  895. <metainf dir="${output-dir}/META-INF"/>
  896. <fileset dir="${result-path}/classes">
  897. <patternset>
  898. <exclude name="${toolkit-package}/demo/**" />
  899. <exclude name="${toolkit-package}/tests/**"/>
  900. <exclude name="${toolkit-package}/launcher/**" />
  901. </patternset>
  902. </fileset>
  903. <!-- fileupload, see build/external/fileupload/build.xml -->
  904. <fileset dir="build/external/fileupload/classes">
  905. <include name="**/*" />
  906. </fileset>
  907. <!-- add sources -->
  908. <fileset dir="${result-path}/src">
  909. <patternset>
  910. <exclude name="${toolkit-package}/demo/**" />
  911. <exclude name="${toolkit-package}/tests/**"/>
  912. <exclude name="${toolkit-package}/launcher/**" />
  913. </patternset>
  914. </fileset>
  915. <fileset dir="${output-dir}/WebContent">
  916. <patternset>
  917. <include name="VAADIN/widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet/**/*" />
  918. <include name="VAADIN/themes/base/**/*" />
  919. <include name="VAADIN/themes/default/**/*" />
  920. <include name="VAADIN/themes/runo/**/*" />
  921. <include name="VAADIN/themes/reindeer/**/*" />
  922. </patternset>
  923. </fileset>
  924. </jar>
  925. <copy file="${output-dir}/WebContent/WEB-INF/lib/${lib-jar-name}" tofile="${output-dir}/WebContent/${lib-jar-name}" />
  926. </target>
  927. <!-- Demo - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  928. <target name="demo" depends="libs, docs">
  929. <echo>Building demo</echo>
  930. <echo>Adding demo class files.</echo>
  931. <copy todir="${output-dir}/WebContent/WEB-INF/classes">
  932. <fileset dir="${result-path}/classes">
  933. <include name="${toolkit-package}/demo/**/*" />
  934. <!-- user might want to tweak launcher classes -->
  935. <include name="${toolkit-package}/launcher/**" />
  936. </fileset>
  937. </copy>
  938. <echo>Adding source for demo</echo>
  939. <copy todir="${output-dir}/WebContent/WEB-INF/src">
  940. <fileset dir="${result-path}/src">
  941. <include name="${toolkit-package}/demo/**/*" />
  942. <!-- user might want to tweak launcher classes -->
  943. <include name="${toolkit-package}/launcher/**" />
  944. </fileset>
  945. </copy>
  946. </target>
  947. <!-- ================================================================== -->
  948. <!-- Documentation -->
  949. <!-- ================================================================== -->
  950. <target name="docs" depends="init, javadoc, manual">
  951. </target>
  952. <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  953. <!-- Manual: Build from external repository. -->
  954. <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  955. <target name="manual-init">
  956. <!-- Can run XEP only if license is available. -->
  957. <available file="build/lib/XEP/license.xml" property="xep.license.available" />
  958. <!-- Path to installed XEP license. -->
  959. <property name="xep.license.path.installed" value="/opt/RenderX/XEP/license.xml"/>
  960. <echo>XEP license expected to be installed as ${xep.license.path.installed}</echo>
  961. <!-- Can copy XEP license only if it is available. -->
  962. <available file="${xep.license.path.installed}" property="xep.license.installed"/>
  963. </target>
  964. <!-- Checkout doc repository. -->
  965. <target name="manual-checkout" unless="docdir">
  966. <mkdir dir="${checkout-path}"/>
  967. <exec executable="svn" dir="${checkout-path}">
  968. <arg value="checkout"/>
  969. <arg value="http://dev.vaadin.com/svn/doc/trunk"/>
  970. <arg value="docs"/>
  971. </exec>
  972. <property name="docdir" value="${checkout-path}/docs"/>
  973. </target>
  974. <!-- If the XEP is installed, copy it to proper place. -->
  975. <target name="xep-license-copy" if="xep.license.installed">
  976. <copy file="${xep.license.path.installed}" todir="${docdir}/build/lib/XEP"/>
  977. </target>
  978. <!-- Build manual. -->
  979. <target name="manual-build" depends="xep-license-copy">
  980. <ant dir="${docdir}" antfile="build/build.xml" inheritAll="false">
  981. <property name="version" value="${version}"/>
  982. </ant>
  983. </target>
  984. <!-- Copy the manual from sub Ant results to our output directory. -->
  985. <target name="manual-copy" depends="init, manual-checkout">
  986. <copy todir="${output-dir}/WebContent/docs">
  987. <fileset dir="${docdir}/build/result/package/WebContent/docs">
  988. <exclude name="**/.svn" />
  989. <include name="book-of-vaadin.pdf" />
  990. </fileset>
  991. </copy>
  992. </target>
  993. <target name="manual" depends="init, manual-init, manual-checkout, manual-build, manual-copy">
  994. </target>
  995. <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  996. <!-- Documentation: Add Javadoc to doc -->
  997. <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  998. <target name="javadoc" depends="preprocess-src">
  999. <javadoc destdir="${output-dir}/WebContent/docs/api" author="true" version="true" use="true" windowtitle="${product-name}" classpathref="compile.classpath.client-side">
  1000. <packageset dir="${result-path}/src">
  1001. <include name="${toolkit-package}/**" />
  1002. <exclude name="${toolkit-package}/demo/**" />
  1003. <exclude name="${toolkit-package}/tests/**" />
  1004. <exclude name="${toolkit-package}/automatedtests/**" />
  1005. </packageset>
  1006. <doctitle>${javadoc.doctitle}</doctitle>
  1007. <!-- <header><![CDATA[<script type="text/javascript" src=".html-style/style.js"></script>]]></header> -->
  1008. <bottom>${javadoc.bottom}</bottom>
  1009. <link offline="true" href="http://java.sun.com/j2se/1.5.0/docs/api/" packagelistLoc="build/javadoc/j2se-1.5.0" />
  1010. <link offline="true" href="http://java.sun.com/j2ee/1.4/docs/api/" packagelistLoc="build/javadoc/j2ee-1.4" />
  1011. </javadoc>
  1012. </target>
  1013. <!-- java2html converter -->
  1014. <taskdef name="java2html" classname="de.java2html.anttasks.Java2HtmlTask" classpath="build/lib/java2html.jar" />
  1015. <!-- ================================================================== -->
  1016. <!-- Nightly build. -->
  1017. <!-- ================================================================== -->
  1018. <!-- Main target for the nightly build. -->
  1019. <target name="nightly" depends="clean-result, nightly-init, package-init, init, build, internal-package-linux">
  1020. </target>
  1021. <!-- Create symlink to GWT installation directory. -->
  1022. <target name="gwt-symlink">
  1023. <!-- Optional property. -->
  1024. <property name="gwt.link.target" value="../../gwt-1.7"/>
  1025. <!-- Remove the old link, as the link target may have changed. -->
  1026. <exec executable="rm" dir="build" searchpath="true" failonerror="false">
  1027. <arg value="gwt"/>
  1028. </exec>
  1029. <echo>Creating symlink to GWT installation directory.</echo>
  1030. <exec executable="ln" dir="build" searchpath="true" failonerror="true">
  1031. <arg value="-s"/> <!-- Symlink. -->
  1032. <arg value="-f"/> <!-- Overwrite. -->
  1033. <arg value="${gwt.link.target}"/>
  1034. <arg value="gwt"/>
  1035. </exec>
  1036. </target>
  1037. <!-- Initialize a nightly build. -->
  1038. <target name="nightly-init" depends="gwt-symlink">
  1039. <!-- Mandatory parameters. -->
  1040. <fail unless="version.minor" message="The version.minor property must be defined."/>
  1041. <fail unless="build.number" message="The build.number property must be defined."/>
  1042. <fail unless="nightly.publish" message="The nightly.publish property must be defined."/>
  1043. <!-- Optional parameters. -->
  1044. <property name="build.tag" value="dev"/>
  1045. <echo>Minor version: ${version.minor}</echo>
  1046. <echo>Build number: ${build.number}</echo>
  1047. <echo>Build tag: ${build.tag}</echo>
  1048. <echo>Publish target: ${nightly.publish}</echo>
  1049. <!-- Set build number. -->
  1050. <tstamp>
  1051. <format property="nightly.date" pattern="yyyyMMdd"/>
  1052. </tstamp>
  1053. <property name="version" value="${version.minor}.${build.tag}-${nightly.date}-c${build.number}"/>
  1054. <echo>Version will be: ${version}</echo>
  1055. <!-- Tell TeamCity the build name. Have to do it this way, because -->
  1056. <!-- this script needs to get the plain build number as a parameter. -->
  1057. <echo>##teamcity[buildNumber '${version.minor}-c${build.number}']</echo>
  1058. </target>
  1059. <target name="nightly-teamcity-publish">
  1060. <!-- Publish as a TeamCity artifact. -->
  1061. <echo>##teamcity[publishArtifacts '${output-dir}/WebContent/WEB-INF/lib/${lib-jar-name}']</echo>
  1062. </target>
  1063. <!-- Copies the nightly build artifacts to the download server. -->
  1064. <target name="nightly-download-publish" if="nightly.publish">
  1065. <!-- Publish to the download server. -->
  1066. <echo>Installing ${output-dir}/WebContent/${lib-jar-name} to ${nightly.publish}</echo>
  1067. <echo>Hopefully you have permissions for the copy operation with SSH.</echo>
  1068. <!-- Only Linux tests allowed. TODO: Generalize this. -->
  1069. <property name="package.linux.filename" value="${result-path}/${product-file}-${package-platform}-${version}.tar.gz"/>
  1070. <!-- Copy the linux installation package and the JAR. -->
  1071. <exec executable="scp" searchpath="true" resultproperty="nightly.install.scp.result">
  1072. <arg value="-B"/>
  1073. <arg value="${output-dir}/WebContent/${lib-jar-name}"/>
  1074. <arg value="${package.linux.filename}"/>
  1075. <arg value="${nightly.publish}"/>
  1076. </exec>
  1077. <echo>Result: ${nightly.install.scp.result}</echo>
  1078. </target>
  1079. <target name="nightly-publish" depends="nightly-teamcity-publish, nightly-download-publish">
  1080. </target>
  1081. <target name="nightly-maven-publish" depends="">
  1082. <property file="${gpg.passphrase.file}" />
  1083. <echo>Publishing ${output-dir}/WebContent/${lib-jar-name} to Maven repository</echo>
  1084. <artifact:mvn>
  1085. <arg value="gpg:sign-and-deploy-file"/>
  1086. <!-- .. is a workaround as maven runs in the build directory -->
  1087. <sysproperty key="file" value="../${output-dir}/WebContent/${lib-jar-name}" />
  1088. <sysproperty key="pomFile" value="maven/pom.xml" />
  1089. <sysproperty key="repositoryId" value="vaadin-snapshots" />
  1090. <sysproperty key="url" value="http://oss.sonatype.org/content/repositories/vaadin-snapshots" />
  1091. <sysproperty key="gpg.passphrase" value="${maven.gpg.passphrase}" />
  1092. </artifact:mvn>
  1093. </target>
  1094. <!-- ================================================================== -->
  1095. <!-- Automated tests. -->
  1096. <!-- ================================================================== -->
  1097. <target name="tests" depends="ant-tests, testbench-tests">
  1098. </target>
  1099. <target name="testbench-tests" depends="init">
  1100. <fail unless="product-file" message="The 'product-file' property must be defined."/>
  1101. <fail unless="package-platform" message="The 'package-platform' property must be defined."/>
  1102. <fail unless="version" message="The 'version' property must be defined."/>
  1103. <echo>Version: ${version}</echo>
  1104. <!-- Parameters for the test.xml script. -->
  1105. <fail unless="com.vaadin.testbench.tester.host" message="The 'com.vaadin.testbench.tester.host' property must be defined."/>
  1106. <fail unless="com.vaadin.testbench.deployment.url" message="The 'com.vaadin.testbench.deployment.url' property must be defined."/>
  1107. <property name="package.platform.name" value="${product-file}-${package-platform}-${version}"/>
  1108. <!-- Only Linux tests allowed. TODO: Generalize this. -->
  1109. <property name="package.linux.filename" value="${result-path}/${package.platform.name}.tar.gz"/>
  1110. <property name="package.linux.dir" value="${result-path}/${package.platform.name}.tar.gz"/>
  1111. <!-- Run the separate test script. -->
  1112. <ant antfile="tests/test.xml" target="test-package" inheritall="false" inheritrefs="true">
  1113. <!-- This is provided so that the test script can copy the -->
  1114. <!-- "tests" classes after unpacking the package. -->
  1115. <property name="output-dir" value="${output-dir}"/>
  1116. <property name="package.filename" value="${package.linux.filename}"/>
  1117. <property name="testing.testarea" value="/tmp/testarea"/>
  1118. <property name="package.name" value="${package.platform.name}"/>
  1119. <property name="com.vaadin.testbench.tester.host" value="${com.vaadin.testbench.tester.host}"/>
  1120. <property name="com.vaadin.testbench.deployment.url" value="${com.vaadin.testbench.deployment.url}"/>
  1121. </ant>
  1122. </target>
  1123. <target name="ant-tests">
  1124. <echo>##teamcity[testSuiteStarted name='com.vaadin.tests.test-framework']</echo>
  1125. <!-- A smoke test for testing the testing framework. -->
  1126. <echo>##teamcity[testStarted name='testingSmoketest']</echo>
  1127. <echo>##teamcity[testStdOut name='testingSmoketest' out='Here be some text related to the test.]</echo>
  1128. <echo>##teamcity[testFinished name='testingSmoketest']</echo>
  1129. <echo>##teamcity[testSuiteFinished name='com.vaadin.tests.test-framework']</echo>
  1130. </target>
  1131. </project>