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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. <?xml version="1.0"?>
  2. <project name="IT Mill Toolkit" basedir="../" default="all">
  3. <!-- Default build target -->
  4. <target name="all" depends="package" description="Build all">
  5. </target>
  6. <!-- Initialization - - - - - - - - - - - - - - - - - - - - - - - - -->
  7. <target name="init">
  8. <property file="build/VERSION" />
  9. <property name="product-file" value="itmill-toolkit" />
  10. <property name="product-name" value="IT Mill Toolkit" />
  11. <property name="toolkit-package" value="com/itmill/toolkit" />
  12. <property file="build/html-style.properties" />
  13. <property name="html.body.tag" value="&lt;body>" />
  14. <property name="html.body.endtag" value="&lt;/body>" />
  15. <!-- Destination files -->
  16. <property name="package-file-name" value="${product-file}-${version}.zip" />
  17. <property name="lib-bin-jar-name" value="${product-file}-${version}.jar" />
  18. <property name="lib-src-jar-name" value="${product-file}-src-${version}.jar" />
  19. <property name="themes-jar-name" value="${product-file}-themes-${version}.jar" />
  20. <property name="demo-war-name" value="${product-file}-demo-${version}.war" />
  21. <echo message="Prepared to build ${product-file} version ${version} packages" />
  22. <!-- Output directory -->
  23. <property name="output-dir" value="build/result/${product-file}-${version}" />
  24. <mkdir dir="${output-dir}" />
  25. <!-- TODO: Copy/filter core documentation to correct places -->
  26. <!-- Disabled
  27. <copy todir="${output-dir}">
  28. <filterset>
  29. <filter token="VERSION" value="${version}"/>
  30. </filterset>
  31. <fileset dir="${release-docs}">
  32. <include name="readme.txt"/>
  33. <include name="install.txt"/>
  34. <include name="license.txt"/>
  35. <include name="release-notes.txt"/>
  36. <include name="changes.txt"/>
  37. </fileset>
  38. </copy>
  39. -->
  40. <!-- Create Output Directory Hierarchy -->
  41. <mkdir dir="${output-dir}/doc/manual" />
  42. <mkdir dir="${output-dir}/doc/api" />
  43. <mkdir dir="${output-dir}/lib" />
  44. <mkdir dir="${output-dir}/demo" />
  45. </target>
  46. <!-- Themes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  47. <target name="themes" depends="copy-themes-to-lib, theme-jar" />
  48. <target name="copy-themes-to-lib" depends="init">
  49. <copy todir="${output-dir}/lib/web-themes">
  50. <fileset dir="WebContent/WEB-INF/lib/themes">
  51. <exclude name="**/.svn" />
  52. </fileset>
  53. </copy>
  54. <copy todir="${output-dir}/lib/ajax-themes">
  55. <fileset dir="WebContent">
  56. <exclude name="**/.svn" />
  57. <include name="themes/**" />
  58. </fileset>
  59. <fileset dir="WebContent">
  60. <exclude name="**/.svn" />
  61. <include name="client/**" />
  62. </fileset>
  63. </copy>
  64. </target>
  65. <target name="theme-jar" depends="init">
  66. <jar jarfile="${output-dir}/lib/${themes-jar-name}" compress="false">
  67. <fileset dir="WebContent/WEB-INF/lib/themes">
  68. <patternset>
  69. <exclude name="**/.svn" />
  70. <include name="default/**/*" />
  71. <include name="corporate/**/*" />
  72. <include name="base/**/*" />
  73. </patternset>
  74. </fileset>
  75. </jar>
  76. </target>
  77. <!-- Libs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  78. <!-- Copy and preprocess sources for packaging -->
  79. <target name="preprocess-src" depends="init">
  80. <mkdir dir="build/result/src" />
  81. <copy todir="build/result/src">
  82. <filterset>
  83. <filter token="VERSION" value="${version}" />
  84. </filterset>
  85. <fileset dir="src">
  86. <patternset>
  87. <include name="**/*.java" />
  88. <include name="**/*.html" />
  89. </patternset>
  90. </fileset>
  91. </copy>
  92. <!-- Convert to CRLF's and tabs -->
  93. <fixcrlf srcdir="build/result/src" eol="crlf" tablength="4" tab="remove" includes="**/*.java" />
  94. <!-- Un-Filtered files -->
  95. <copy todir="build/result/src">
  96. <fileset dir="src">
  97. <patternset>
  98. <include name="**/*.gif" />
  99. <include name="**/*.jpg" />
  100. <include name="**/*.png" />
  101. </patternset>
  102. </fileset>
  103. </copy>
  104. </target>
  105. <target name="compile-java" depends="preprocess-src">
  106. <!-- Compile -->
  107. <mkdir dir="build/result/classes" />
  108. <javac srcdir="build/result/src" destdir="build/result/classes" classpath="build/lib/servlet-api.jar" includes="${toolkit-package}/**" />
  109. </target>
  110. <target name="libs" depends="compile-java">
  111. <!-- Create binary JAR -->
  112. <jar jarfile="${output-dir}/lib/${lib-bin-jar-name}" compress="true" includes="${toolkit-package}/**" basedir="build/result/classes" excludes="${toolkit-package}/demo/**" />
  113. <!-- Create source JAR -->
  114. <jar jarfile="${output-dir}/lib/${lib-src-jar-name}" compress="true">
  115. <fileset dir="build/result/src">
  116. <patternset>
  117. <include name="${toolkit-package}/**/*.java" />
  118. <exclude name="${toolkit-package}/demo/**/*.java" />
  119. </patternset>
  120. </fileset>
  121. </jar>
  122. </target>
  123. <!-- Demo - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  124. <target name="demo" depends="libs,compile-java,theme-jar">
  125. <war warfile="${output-dir}/demo/${product-file}.war" webxml="WebContent/WEB-INF/web.xml">
  126. <classes dir="build/result/classes">
  127. <include name="${toolkit-package}/demo/**/*.class" />
  128. </classes>
  129. <classes dir="src">
  130. <include name="${toolkit-package}/demo/**/*.jpg" />
  131. <include name="${toolkit-package}/demo/**/*.png" />
  132. <include name="${toolkit-package}/demo/**/*.gif" />
  133. </classes>
  134. <lib dir="${output-dir}/lib">
  135. <include name="${lib-bin-jar-name}" />
  136. <include name="${themes-jar-name}" />
  137. </lib>
  138. <fileset dir="">
  139. <include name="src/${toolkit-package}/demo/**/*.java" />
  140. </fileset>
  141. <fileset dir="WebContent">
  142. <exclude name="**/.svn" />
  143. <exclude name="WEB-INF/web.xml" />
  144. <include name="WEB-INF/lib/themes/example/**/*" />
  145. <exclude name="WEB-INF/lib/themes/**/*" />
  146. <include name="**/*" />
  147. </fileset>
  148. </war>
  149. <copy todir="${output-dir}/demo">
  150. <fileset dir="build/demo">
  151. <exclude name="**/.svn" />
  152. </fileset>
  153. </copy>
  154. <copy todir="${output-dir}/demo/src">
  155. <fileset dir="build/result/src">
  156. <include name="${toolkit-package}/demo/**/*.java" />
  157. </fileset>
  158. </copy>
  159. </target>
  160. <!-- Documentation- - - - - - - - - - - - - - - - - - - - - - - - - -->
  161. <target name="docs" depends="javadoc,manual-pdf,manual-html,package-docs">
  162. </target>
  163. <target name="package-docs" depends="init">
  164. <copy todir="${output-dir}">
  165. <filterchain>
  166. <expandproperties />
  167. <replacetokens begintoken="&lt;" endtoken=">">
  168. <token key="body" value="${html.body.tag}${html.body.start}" />
  169. <token key="/body" value="${html.body.end}${html.body.endtag}" />
  170. </replacetokens>
  171. </filterchain>
  172. <fileset dir="">
  173. <include name="*.html" />
  174. <include name="*.txt" />
  175. </fileset>
  176. </copy>
  177. <copy todir="${output-dir}/doc/manual/html-style">
  178. <fileset dir="doc/manual/html-style">
  179. <exclude name="**/.svn" />
  180. <exclude name="**/test.html" />
  181. </fileset>
  182. </copy>
  183. <copy todir="${output-dir}/doc">
  184. <fileset dir="doc">
  185. <include name="dtd/**/*.dtd" />
  186. </fileset>
  187. </copy>
  188. </target>
  189. <target name="javadoc" depends="preprocess-src">
  190. <javadoc destdir="${output-dir}/doc/api" author="true" version="true" use="true" windowtitle="${product-name}" classpath="build/lib/servlet-api.jar">
  191. <packageset dir="build/result/src">
  192. <include name="${toolkit-package}/**" />
  193. <exclude name="${toolkit-package}/demo/**" />
  194. </packageset>
  195. <doctitle>
  196. <![CDATA[<h1>IT Mill Toolkit</h1>]]></doctitle>
  197. <!-- <header><![CDATA[<script type="text/javascript" src=".html-style/style.js"></script>]]></header> -->
  198. <bottom>
  199. <![CDATA[<i>Copyright &#169; 2000-2006 IT Mill Ltd. All Rights Reserved.</i>]]></bottom>
  200. <link offline="true" href="http://java.sun.com/j2se/1.5.0/docs/api/" packagelistLoc="build/javadoc/j2se-1.5.0" />
  201. <link offline="true" href="http://java.sun.com/j2ee/1.4/docs/api/" packagelistLoc="build/javadoc/j2ee-1.4" />
  202. </javadoc>
  203. </target>
  204. <target name="book-part2" depends="dbdoclet">
  205. <!-- TODO Add XSLT to transform dbdoclet results to book part 2 -->
  206. </target>
  207. <target name="dbdoclet" depends="preprocess-src">
  208. <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">
  209. <packageset dir="build/result/src">
  210. <include name="${toolkit-package}/**" />
  211. <exclude name="${toolkit-package}/demo/**" />
  212. </packageset>
  213. <doclet name="org.dbdoclet.doclet.docbook.DocBookDoclet" path="build/lib/jdk${java.specification.version}/dbdoclet.jar">
  214. <param name="-d" value="result/docbook" />
  215. </doclet>
  216. </javadoc>
  217. </target>
  218. <target name="manual-pdf" depends="init">
  219. <!-- TODO Include XEP-based FO building in future -->
  220. </target>
  221. <target name="manual-html" depends="init">
  222. <copy file="build/docbook/conf/custom-html-docbook.xsl" tofile="build/docbook/conf/temp.xsl">
  223. <filterchain>
  224. <replacetokens>
  225. <token key="BODYHEADER" value="${html.body.start}" />
  226. <token key="BODYFOOTER" value="${html.body.end}" />
  227. </replacetokens>
  228. </filterchain>
  229. </copy>
  230. <path id="docbook-xsl.classpath">
  231. <pathelement path="build/lib/fop-0.92/serializer-2.7.0.jar" />
  232. <pathelement path="build/lib/fop-0.92/xalan-2.7.0.jar" />
  233. <pathelement path="build/lib/fop-0.92/xercesImpl-2.7.1.jar" />
  234. <pathelement path="build/lib/fop-0.92/xml-apis-1.3.02.jar" />
  235. </path>
  236. <java classname="org.apache.xalan.xslt.Process" failonerror="yes" fork="yes" maxmemory="764m">
  237. <arg value="-in" />
  238. <arg value="doc/manual/book.xml" />
  239. <arg value="-xsl" />
  240. <arg value="build/docbook/conf/temp.xsl" />
  241. <arg value="-out" />
  242. <arg value="${output-dir}/doc/manual/index.html" />
  243. <arg value="-param" />
  244. <arg value="use.extensions" />
  245. <arg value="1" />
  246. <classpath refid="docbook-xsl.classpath" />
  247. </java>
  248. <delete file="build/docbook/conf/temp.xsl" />
  249. </target>
  250. <!-- ZIP Package creation - - - - - - - - - - - - - - - - - - - - - - - - - -->
  251. <target name="package" depends="clean-all,libs,demo,docs,themes">
  252. <zip zipfile="build/result/${package-file-name}">
  253. <fileset dir="build/result">
  254. <patternset>
  255. <include name="${product-file}-${version}/**" />
  256. </patternset>
  257. </fileset>
  258. </zip>
  259. </target>
  260. <!-- Clean results - - - - - - - - - - - - - - - - - - - - - - - - - -->
  261. <target name="clean-all" depends="">
  262. <delete dir="build/result" />
  263. </target>
  264. </project>