Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

build.xml 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  1. <?xml version="1.0"?>
  2. <project name="IT Mill Toolkit" basedir="../" default="package">
  3. <!-- Package creation - - - - - - - - - - - - - - - - - - - - - - - - - -->
  4. <target name="package" depends="clean-all,libs,themes,demo,docs,license"
  5. description="Build public release">
  6. <zip zipfile="build/result/${package-file-name}">
  7. <fileset dir="build/result">
  8. <patternset>
  9. <include name="${product-file}-${version}/**" />
  10. </patternset>
  11. </fileset>
  12. </zip>
  13. </target>
  14. <!-- As release, but no javadoc or docbook tasks -->
  15. <target name="package-without-documentation"
  16. depends="clean-all,libs,themes,demo,package-docs,license"
  17. description="Build testing package without javadocs or manual">
  18. <zip zipfile="build/result/TESTING-${package-file-name}">
  19. <fileset dir="build/result">
  20. <patternset>
  21. <include name="${product-file}-${version}/**" />
  22. </patternset>
  23. </fileset>
  24. </zip>
  25. </target>
  26. <!-- Initialization - - - - - - - - - - - - - - - - - - - - - - - - -->
  27. <target name="init">
  28. <!-- Create result dir unless already exists -->
  29. <mkdir dir="build/result" />
  30. <property file="build/VERSION" />
  31. <property name="product-file" value="itmill-toolkit" />
  32. <property name="product-name" value="IT Mill Toolkit" />
  33. <property name="toolkit-package" value="com/itmill/toolkit" />
  34. <property file="build/html-style.properties" />
  35. <!-- Destination files -->
  36. <property name="package-file-name" value="${product-file}-${version}.zip" />
  37. <property name="lib-bin-jar-name" value="${product-file}-${version}.jar" />
  38. <property name="demo-lib-jar-name" value="${product-file}-demo-${version}.jar" />
  39. <property name="lib-src-jar-name" value="${product-file}-src-${version}.jar" />
  40. <property name="themes-jar-name" value="${product-file}-themes-${version}.jar" />
  41. <property name="demo-war-name" value="${product-file}-demo-${version}.war" />
  42. <echo message="Prepared to build ${product-file} version ${version} packages" />
  43. <!-- Output directory -->
  44. <property name="output-dir" value="build/result/${product-file}-${version}" />
  45. <mkdir dir="${output-dir}" />
  46. <!-- Create Output Directory Hierarchy -->
  47. <mkdir dir="${output-dir}/doc/manual" />
  48. <mkdir dir="${output-dir}/doc/api" />
  49. <mkdir dir="${output-dir}/lib" />
  50. <mkdir dir="${output-dir}/demo" />
  51. </target>
  52. <!-- License - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  53. <target name="license" depends="init">
  54. <copy todir="${output-dir}/lib">
  55. <fileset dir="WebContent/WEB-INF">
  56. <exclude name="**/.svn" />
  57. <include name="itmill-toolkit-license.xml" />
  58. </fileset>
  59. </copy>
  60. </target>
  61. <!-- Themes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  62. <target name="themes" depends="init">
  63. <copy todir="${output-dir}/lib/themes">
  64. <fileset dir="WebContent/WEB-INF/lib/themes">
  65. <exclude name="**/.svn" />
  66. <include name="corporate/**/*" />
  67. <include name="demo/**/*" />
  68. <include name="base/**/*" />
  69. </fileset>
  70. </copy>
  71. <echo>CSS syntax check and optimizing.</echo>
  72. <for param="file">
  73. <path>
  74. <fileset dir="${output-dir}/lib/themes">
  75. <include name="**/*.css" />
  76. </fileset>
  77. </path>
  78. <sequential>
  79. <echo>@{file}</echo>
  80. <exec dir="build" executable="cmd.exe" os="Windows 2000, Windows XP" failonerror="true">
  81. <arg line="/c bin\csstidy-win.exe @{file} @{file}" />
  82. </exec>
  83. <exec dir="build" executable="bin/csstidy-osx.sh" os="Mac OS X" failonerror="true">
  84. <arg line="@{file}" />
  85. </exec>
  86. <exec dir="build" executable="bin/csstidy-linux.sh" os="Linux" failonerror="true">
  87. <arg line="@{file}" />
  88. </exec>
  89. </sequential>
  90. </for>
  91. <echo>JavaScript syntax check, optimizing and obfuscation.</echo>
  92. <for param="file">
  93. <path>
  94. <fileset dir="${output-dir}/lib/themes">
  95. <include name="**/*.js" />
  96. </fileset>
  97. </path>
  98. <sequential>
  99. <echo>@{file}</echo>
  100. <!-- TODO: ERROR: for some reason this does not work on Windows platform, please fix! -->
  101. <java dir="${output-dir}/lib/themes" jar="build/lib/custom_rhino.jar" fork="true" failonerror="true" maxmemory="64m" output="@{file}">
  102. <arg value="-c" />
  103. <arg value="@{file}" />
  104. </java>
  105. </sequential>
  106. </for>
  107. <fixcrlf srcdir="${output-dir}/lib/themes" includes="**/*.js **/*.css" eol="lf" eof="remove" />
  108. <jar jarfile="${output-dir}/lib/${themes-jar-name}" compress="false">
  109. <fileset dir="${output-dir}/lib/themes">
  110. <patternset>
  111. <include name="corporate/**/*" />
  112. <include name="base/**/*" />
  113. </patternset>
  114. </fileset>
  115. </jar>
  116. </target>
  117. <!-- Libs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  118. <!-- Copy and preprocess sources for packaging -->
  119. <target name="preprocess-src" depends="init">
  120. <mkdir dir="build/result/src" />
  121. <copy todir="build/result/src">
  122. <filterset>
  123. <filter token="VERSION" value="${version}" />
  124. </filterset>
  125. <fileset dir="src">
  126. <patternset>
  127. <include name="**/*.java" />
  128. <include name="**/*.html" />
  129. </patternset>
  130. </fileset>
  131. </copy>
  132. <!-- Convert to CRLF's and tabs -->
  133. <fixcrlf srcdir="build/result/src" eol="crlf" tablength="4" tab="remove" includes="**/*.java" />
  134. <!-- Un-Filtered files -->
  135. <copy todir="build/result/src">
  136. <fileset dir="src">
  137. <patternset>
  138. <include name="**/*.gif" />
  139. <include name="**/*.jpg" />
  140. <include name="**/*.png" />
  141. </patternset>
  142. </fileset>
  143. </copy>
  144. </target>
  145. <target name="compile-java" depends="preprocess-src">
  146. <!-- Compile -->
  147. <mkdir dir="build/result/classes" />
  148. <javac srcdir="build/result/src" destdir="build/result/classes" classpath="build/lib/servlet-api.jar" includes="${toolkit-package}/**" />
  149. </target>
  150. <target name="libs" depends="compile-java">
  151. <!-- Create binary JAR -->
  152. <jar jarfile="${output-dir}/lib/${lib-bin-jar-name}" compress="true" includes="${toolkit-package}/**" basedir="build/result/classes" excludes="${toolkit-package}/demo/**" />
  153. <!-- Create source JAR -->
  154. <jar jarfile="${output-dir}/lib/${lib-src-jar-name}" compress="true">
  155. <fileset dir="build/result/src">
  156. <patternset>
  157. <include name="${toolkit-package}/**/*.java" />
  158. <exclude name="${toolkit-package}/demo/**/*.java" />
  159. </patternset>
  160. </fileset>
  161. </jar>
  162. </target>
  163. <!-- Demo - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  164. <target name="demo" depends="libs,compile-java,themes">
  165. <echo>Building demo</echo>
  166. <java2html srcdir="build/result/src/${toolkit-package}/demo" destdir="build/result/src/${toolkit-package}/demo" includes="**/*.java" style="eclipse" showLineNumbers="true" showFileName="true" showTableBorder="false" />
  167. <!-- have to use "temp" dir for some reason here. Overwrite does not work, at least on Linux -->
  168. <copy todir="build/result/srcTemp" overwrite="true">
  169. <filterchain>
  170. <expandproperties />
  171. <replacetokens begintoken="&lt;" endtoken=">">
  172. <token key="body" value="${html.body.tag}${html.body.start1}${product-name}${html.body.start2}" />
  173. <token key="/body" value="${html.body.end}${html.body.endtag}" />
  174. <token key="head" value="${html.head.tag}${html.head.style}" />
  175. </replacetokens>
  176. </filterchain>
  177. <fileset dir="build/result/src">
  178. <exclude name="**/.svn" />
  179. <include name="**/*.html" />
  180. </fileset>
  181. </copy>
  182. <!-- Create demo binary JAR, including pictures -->
  183. <mkdir dir="build/result/lib"/>
  184. <jar jarfile="build/result/lib/${demo-lib-jar-name}" includes="${toolkit-package}/demo/**" basedir="build/result/classes" compress="true">
  185. <fileset dir="build/result/src">
  186. <patternset>
  187. <include name="${toolkit-package}/demo/**/*.jpg" />
  188. <include name="${toolkit-package}/demo/**/*.png" />
  189. <include name="${toolkit-package}/demo/**/*.gif" />
  190. </patternset>
  191. </fileset>
  192. </jar>
  193. <war warfile="${output-dir}/demo/${product-file}.war" webxml="WebContent/WEB-INF/web.xml">
  194. <!-- WebContent: htmls, styles, license-->
  195. <fileset dir="WebContent">
  196. <exclude name="**/.svn" />
  197. <exclude name="WEB-INF/web.xml" />
  198. <exclude name="WEB-INF/lib/themes/**/*" />
  199. <exclude name="WEB-INF/classes" />
  200. <exclude name="WEB-INF/classes/**/*" />
  201. <include name="**/*" />
  202. </fileset>
  203. <!-- Toolkit package and themes -->
  204. <lib dir="${output-dir}/lib">
  205. <include name="${lib-bin-jar-name}" />
  206. <include name="${themes-jar-name}" />
  207. </lib>
  208. <!-- Demo package and themes -->
  209. <lib dir="build/result/lib">
  210. <include name="${demo-lib-jar-name}" />
  211. </lib>
  212. <lib dir="${output-dir}/lib">
  213. <include name="themes/demo/**/*" />
  214. </lib>
  215. <!-- Calc and HelloWorld source and html source -->
  216. <fileset dir="build/result">
  217. <include name="src/${toolkit-package}/demo/Calc.*" />
  218. <include name="src/${toolkit-package}/demo/HelloWorld.*" />
  219. </fileset>
  220. </war>
  221. <!-- Jetty -->
  222. <copy todir="${output-dir}/demo">
  223. <fileset dir="build/demo">
  224. <exclude name="**/.svn" />
  225. </fileset>
  226. </copy>
  227. <!-- Sources -->
  228. <copy todir="${output-dir}/demo/src">
  229. <fileset dir="build/result/src">
  230. <include name="src/${toolkit-package}/demo/Calc.*" />
  231. <include name="src/${toolkit-package}/demo/HelloWorld.*" />
  232. </fileset>
  233. </copy>
  234. </target>
  235. <!-- Documentation- - - - - - - - - - - - - - - - - - - - - - - - - -->
  236. <target name="docs" depends="javadoc,manual-pdf,manual-html,package-docs">
  237. </target>
  238. <target name="package-docs" depends="init">
  239. <copy todir="${output-dir}">
  240. <filterchain>
  241. <expandproperties />
  242. <replacetokens begintoken="&lt;" endtoken=">">
  243. <token key="body" value="${html.body.tag}${html.body.start1}${product-name}${html.body.start2}" />
  244. <token key="/body" value="${html.body.end}${html.body.endtag}" />
  245. </replacetokens>
  246. </filterchain>
  247. <fileset dir="">
  248. <exclude name="**/.svn" />
  249. <include name="*.html" />
  250. <include name="*.txt" />
  251. </fileset>
  252. </copy>
  253. <copy todir="${output-dir}">
  254. <fileset dir="">
  255. <filename name="*.pdf" />
  256. </fileset>
  257. </copy>
  258. <copy todir="${output-dir}/doc/manual/html-style">
  259. <fileset dir="doc/manual/html-style">
  260. <exclude name="**/.svn" />
  261. <exclude name="**/test.html" />
  262. </fileset>
  263. </copy>
  264. <copy todir="${output-dir}/doc">
  265. <fileset dir="doc">
  266. <exclude name="**/.svn" />
  267. <include name="dtd/**/*.dtd" />
  268. </fileset>
  269. </copy>
  270. </target>
  271. <target name="javadoc" depends="preprocess-src">
  272. <javadoc destdir="${output-dir}/doc/api" author="true" version="true" use="true" windowtitle="${product-name}" classpath="build/lib/servlet-api.jar">
  273. <packageset dir="build/result/src">
  274. <include name="${toolkit-package}/**" />
  275. <exclude name="${toolkit-package}/demo/**" />
  276. </packageset>
  277. <doctitle>${javadoc.doctitle}</doctitle>
  278. <!-- <header><![CDATA[<script type="text/javascript" src=".html-style/style.js"></script>]]></header> -->
  279. <bottom>${javadoc.bottom}</bottom>
  280. <link offline="true" href="http://java.sun.com/j2se/1.5.0/docs/api/" packagelistLoc="build/javadoc/j2se-1.5.0" />
  281. <link offline="true" href="http://java.sun.com/j2ee/1.4/docs/api/" packagelistLoc="build/javadoc/j2ee-1.4" />
  282. </javadoc>
  283. </target>
  284. <target name="book-part2" depends="dbdoclet">
  285. <!-- TODO Add XSLT to transform dbdoclet results to book part 2 -->
  286. </target>
  287. <target name="dbdoclet" depends="preprocess-src">
  288. <javadoc access="public" charset="UTF-8" docencoding="UTF-8" encoding="ISO-8859-15" failonerror="yes" classpath="build/lib/servlet-api.jar" maxmemory="512m" source="1.5">
  289. <packageset dir="build/result/src">
  290. <include name="${toolkit-package}/**" />
  291. <exclude name="${toolkit-package}/demo/**" />
  292. </packageset>
  293. <doclet name="org.dbdoclet.doclet.docbook.DocBookDoclet" path="build/lib/jdk${java.specification.version}/dbdoclet.jar">
  294. <param name="-d" value="result/docbook" />
  295. </doclet>
  296. </javadoc>
  297. </target>
  298. <target name="manual-pdf" depends="init">
  299. <!-- TODO Include XEP-based FO building in future -->
  300. </target>
  301. <target name="manual-html" depends="init">
  302. <delete file="build/docbook/conf/temp.xsl" />
  303. <copy file="build/docbook/conf/custom-html-docbook.xsl" tofile="build/docbook/conf/temp.xsl">
  304. <filterchain>
  305. <replacetokens>
  306. <token key="BODYHEADER" value="${html.body.start1}${docbook.head.title}${html.body.start2}" />
  307. <token key="BODYFOOTER" value="${html.body.end}" />
  308. </replacetokens>
  309. </filterchain>
  310. </copy>
  311. <path id="docbook-xsl.classpath">
  312. <pathelement path="build/lib/fserializer.jar" />
  313. <pathelement path="build/lib/xalan.jar" />
  314. <pathelement path="build/lib/xercesImpl.jar" />
  315. <pathelement path="build/lib/xml-apis.jar" />
  316. </path>
  317. <java classname="org.apache.xalan.xslt.Process" failonerror="yes" fork="yes" maxmemory="1300m">
  318. <arg value="-in" />
  319. <arg value="doc/manual/book.xml" />
  320. <arg value="-xsl" />
  321. <arg value="build/docbook/conf/temp.xsl" />
  322. <arg value="-out" />
  323. <arg value="${output-dir}/doc/manual/index.html" />
  324. <arg value="-param" />
  325. <arg value="use.extensions" />
  326. <arg value="1" />
  327. <classpath refid="docbook-xsl.classpath" />
  328. </java>
  329. <delete file="build/docbook/conf/temp.xsl" />
  330. <copy todir="${output-dir}/doc/manual/img">
  331. <fileset dir="doc/manual/img">
  332. <exclude name="**/.svn" />
  333. </fileset>
  334. </copy>
  335. </target>
  336. <!-- Clean results - - - - - - - - - - - - - - - - - - - - - - - - - -->
  337. <target name="clean-all" depends="">
  338. <delete includeemptydirs="true" defaultexcludes="false">
  339. <fileset dir="build/result" includes="**/*" />
  340. </delete>
  341. <delete file="build/docbook/conf/temp.xsl" />
  342. </target>
  343. <!-- ant contrib required for flow control (for loop) -->
  344. <taskdef resource="net/sf/antcontrib/antlib.xml">
  345. <classpath>
  346. <pathelement location="build/lib/ant-contrib-1.0b3.jar" />
  347. </classpath>
  348. </taskdef>
  349. <!-- java2html converter -->
  350. <taskdef name="java2html" classname="de.java2html.anttasks.Java2HtmlTask" classpath="build/lib/java2html.jar" />
  351. </project>