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.

old-build.xml 16KB

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