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

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