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

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