Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

build.xml 11KB

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