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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115
  1. <?xml version="1.0"?>
  2. <!--
  3. Licensed to the Apache Software Foundation (ASF) under one
  4. or more contributor license agreements. See the NOTICE file
  5. distributed with this work for additional information
  6. regarding copyright ownership. The ASF licenses this file
  7. to you under the Apache License, Version 2.0 (the
  8. "License"); you may not use this file except in compliance
  9. with the License. You may obtain a copy of the License at
  10. http://www.apache.org/licenses/LICENSE-2.0
  11. Unless required by applicable law or agreed to in writing,
  12. software distributed under the License is distributed on an
  13. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  14. KIND, either express or implied. See the License for the
  15. specific language governing permissions and limitations
  16. under the License.
  17. -->
  18. <!DOCTYPE project PUBLIC "-//Ant//Project 1.5//EN" "ant.dtd">
  19. <!--
  20. POI Build System. Written by:
  21. Glen Stampoultzis glens at apache.org
  22. Modified by:
  23. Rainer Klute klute@rainer-klute.de
  24. This build was tested with ant 1.6.2 although it will probably work with
  25. other versions. The following jar files should be available on the
  26. classpath when running ant:
  27. LIBRARY LOCATION
  28. ======= ========
  29. junit(3.8+) http://www.ibiblio.org/maven/junit/jars/
  30. xerces http://www.ibiblio.org/maven/xerces/jars/
  31. jdepend http://www.ibiblio.org/maven/jdepend/jars/
  32. xalan http://www.ibiblio.org/maven/xalan/jars/
  33. The ant jar "optional.jar" should also be available otherwise the
  34. build will fail.
  35. To build the documentation you will need to install forrest and set
  36. the FORREST_HOME environment variable. Forrest 0.5.1 required.
  37. TO BE COMPLETED:
  38. Convert book.xml files to a sitemap.
  39. -->
  40. <project name="POI Build" default="help" basedir=".">
  41. <description>
  42. The POI project Ant build.
  43. </description>
  44. <property environment="env"/>
  45. <property name="repository" value="http://www.ibiblio.org/maven"/>
  46. <property name="forrest.home" value="${env.FORREST_HOME}"/>
  47. <!-- Main: -->
  48. <property name="main.resource1.dir" value="src/resources/fontmetrics"/>
  49. <property name="main.src" location="src/java"/>
  50. <property name="main.src.test" location="src/testcases"/>
  51. <property name="main.documentation" value="src/documentation"/>
  52. <property name="main.output.dir" location="build/classes"/>
  53. <property name="main.output.test.dir" location="build/test-classes"/>
  54. <property name="main.lib" location="lib"/>
  55. <property name="main.reports.test" location="build/test-results"/>
  56. <property name="main.jar1.dir" location="${main.lib}/commons-logging-1.1.jar"/>
  57. <property name="main.jar1.url" value="${repository}/commons-logging/jars/commons-logging-1.1.jar"/>
  58. <property name="main.jar2.dir" location="${main.lib}/log4j-1.2.13.jar"/>
  59. <property name="main.jar2.url" value="${repository}/log4j/jars/log4j-1.2.13.jar"/>
  60. <property name="main.testokfile" location="build/main-testokfile.txt"/>
  61. <!-- Scratchpad: -->
  62. <property name="scratchpad.src" location="src/scratchpad/src"/>
  63. <property name="scratchpad.src.test" location="src/scratchpad/testcases"/>
  64. <property name="scratchpad.lib" location="src/scratchpad/lib"/>
  65. <property name="scratchpad.reports.test" location="build/scratchpad-test-results"/>
  66. <property name="scratchpad.output.dir" location="build/scratchpad-classes"/>
  67. <property name="scratchpad.output.test.dir" location="build/scratchpad-test-classes"/>
  68. <property name="scratchpad.testokfile" location="build/scratchpad-testokfile.txt"/>
  69. <!-- Contributed software: -->
  70. <property name="contrib.src" location="src/contrib/src"/>
  71. <property name="contrib.src.test" location="src/contrib/testcases"/>
  72. <property name="contrib.lib" location="src/contrib/lib"/>
  73. <property name="contrib.reports.test" location="build/contrib-test-results"/>
  74. <property name="contrib.output.dir" location="build/contrib-classes"/>
  75. <property name="contrib.output.test.dir" location="build/contrib-test-classes"/>
  76. <property name="contrib.jar1.dir" location="${contrib.lib}/commons-beanutils-1.7.0.jar"/>
  77. <property name="contrib.jar1.url" value="${repository}/commons-beanutils/jars/commons-beanutils-1.7.0.jar"/>
  78. <property name="contrib.jar2.dir" location="${contrib.lib}/commons-collections-3.2.jar"/>
  79. <property name="contrib.jar2.url" value="${repository}/commons-collections/jars/commons-collections-3.2.jar"/>
  80. <property name="contrib.jar3.dir" location="${contrib.lib}/commons-lang-2.1.jar"/>
  81. <property name="contrib.jar3.url" value="${repository}/commons-lang/jars/commons-lang-2.1.jar"/>
  82. <property name="contrib.testokfile" location="build/contrib-testokfile.txt"/>
  83. <!-- Examples: -->
  84. <property name="examples.src" location="src/examples/src"/>
  85. <property name="examples.src.test" location="src/examples/testcases"/>
  86. <property name="examples.lib" location="src/examples/lib"/>
  87. <property name="examples.reports.test" location="build/examples-test-results"/>
  88. <property name="examples.output.dir" location="build/examples-classes"/>
  89. <property name="examples.output.test.dir" location="build/examples-test-classes"/>
  90. <property name="examples.jar1.dir" location="${examples.lib}/commons-beanutils-1.7.0.jar"/>
  91. <property name="examples.jar1.url" value="${repository}/commons-beanutils/jars/commons-beanutils-1.7.0.jar"/>
  92. <property name="examples.jar2.dir" location="${examples.lib}/commons-collections-3.2.jar"/>
  93. <property name="examples.jar2.url" value="${repository}/commons-collections/jars/commons-collections-3.2.jar"/>
  94. <property name="examples.jar3.dir" location="${examples.lib}/commons-lang-2.1.jar"/>
  95. <property name="examples.jar3.url" value="${repository}/commons-lang/jars/commons-lang-2.1.jar"/>
  96. <property name="examples.testokfile" location="build/examples-testokfile.txt"/>
  97. <property name="junit.jar1.dir" location="${main.lib}/junit-3.8.1.jar"/>
  98. <property name="junit.jar1.url" value="${repository}/junit/jars/junit-3.8.1.jar"/>
  99. <property name="build.site" location="build/tmp/site/build/site"/>
  100. <property name="build.site.src" location="build/tmp/site"/>
  101. <property name="junit.report.dir" location="${build.site}/junit"/>
  102. <property name="jdepend.report.dir" location="${build.site}/jdepend"/>
  103. <property name="jdepend.report.out.dir" location="${build.site.src}/src/documentation/content/jdepend"/>
  104. <property name="apidocs.report.dir" location="${build.site}/apidocs"/>
  105. <property name="changelog.file" location="${build.site}/changelog.html"/>
  106. <property name="dist.dir" location="build/dist"/>
  107. <property name="mavendist.dir" location="build/maven-dist"/>
  108. <property name="jar.name" value="poi"/>
  109. <property name="version.id" value="3.0-alpha3"/>
  110. <property name="halt.on.test.failure" value="true"/>
  111. <property name="jdk.version.source" value="1.3"
  112. description="JDK version of source code"/>
  113. <property name="jdk.version.class" value="1.3"
  114. description="JDK version of generated class files"/>
  115. <path id="main.classpath">
  116. <pathelement location="${main.jar1.dir}"/>
  117. <pathelement location="${main.jar2.dir}"/>
  118. <pathelement location="${main.resource1.dir}"/>
  119. </path>
  120. <path id="scratchpad.classpath">
  121. <path refid="main.classpath"/>
  122. <pathelement location="${main.output.dir}"/>
  123. </path>
  124. <path id="contrib.classpath">
  125. <path refid="main.classpath"/>
  126. <pathelement location="${contrib.jar1.dir}"/>
  127. <pathelement location="${contrib.jar2.dir}"/>
  128. <pathelement location="${contrib.jar3.dir}"/>
  129. <pathelement location="${main.output.dir}"/>
  130. <pathelement location="${main.output.test.dir}"/>
  131. <pathelement location="${scratchpad.output.dir}"/>
  132. <pathelement location="${scratchpad.output.test.dir}"/>
  133. <pathelement location="${contrib.output.dir}"/>
  134. <pathelement location="${contrib.output.test.dir}"/>
  135. </path>
  136. <path id="examples.classpath">
  137. <path refid="main.classpath"/>
  138. <pathelement location="${main.output.dir}"/>
  139. </path>
  140. <!-- Prints POI's Ant usage help -->
  141. <target name="help" description="Prints POI's Ant usage help">
  142. <echo>
  143. - Execute "ant -projecthelp" to view a listing of the main build
  144. targets.
  145. - Execute "ant help-properties" to view a listing of some properties
  146. controlling the build process.
  147. </echo>
  148. </target>
  149. <target name="help-properties"
  150. description="Prints a listing of build controlling properties">
  151. <echo>
  152. The following properties control the build process:
  153. -Ddisconnected="true": Do not execute any targets that require an online
  154. connection to the Internet.
  155. -Dtestcase=org.apache.poi.xxx.xxx : for the single-test target, specify
  156. the test to run
  157. WARNING: This list is not exhaustive.
  158. </echo>
  159. </target>
  160. <target name="with.clover" if="clover.present">
  161. <taskdef resource="clovertasks"/>
  162. <clover-setup initString="mycoverage.db"/>
  163. </target>
  164. <target name="clover.html" depends="with.clover" if="clover.present">
  165. <echo>Generating clover report</echo>
  166. <clover-report>
  167. <current outfile="build/tmp/site/build/site/clover_html">
  168. <format type="html"/>
  169. </current>
  170. </clover-report>
  171. </target>
  172. <target name="init" depends="check-jars,fetch-jars">
  173. <tstamp>
  174. <format property="tstamp.year" pattern="yyyy"/>
  175. </tstamp>
  176. <available resource="clovertasks" property="clover.present"/>
  177. <antcall target="with.clover"/>
  178. <mkdir dir="build"/>
  179. <mkdir dir="${main.output.dir}"/>
  180. <mkdir dir="${scratchpad.output.dir}"/>
  181. <mkdir dir="${contrib.output.dir}"/>
  182. <mkdir dir="${examples.output.dir}"/>
  183. <mkdir dir="${main.output.test.dir}"/>
  184. <mkdir dir="${contrib.output.test.dir}"/>
  185. <mkdir dir="${scratchpad.output.test.dir}"/>
  186. <mkdir dir="${main.reports.test}"/>
  187. <mkdir dir="${scratchpad.reports.test}"/>
  188. <mkdir dir="${contrib.reports.test}"/>
  189. <mkdir dir="${junit.report.dir}"/>
  190. <mkdir dir="${jdepend.report.dir}"/>
  191. <mkdir dir="${jdepend.report.out.dir}"/>
  192. <mkdir dir="${apidocs.report.dir}"/>
  193. <mkdir dir="${dist.dir}"/>
  194. <mkdir dir="${mavendist.dir}"/>
  195. <mkdir dir="${build.site.src}/${main.documentation}"/>
  196. <copy todir="${build.site.src}/${main.documentation}">
  197. <fileset dir="${main.documentation}"/>
  198. </copy>
  199. <copy file="forrest.properties" tofile="${build.site.src}/forrest.properties"/>
  200. </target>
  201. <target name="clean">
  202. <delete dir="build"/>
  203. </target>
  204. <target name="check-jars">
  205. <condition property="jars.present">
  206. <or>
  207. <and>
  208. <available file="${main.jar1.dir}"/>
  209. <available file="${main.jar2.dir}"/>
  210. <available file="${contrib.jar1.dir}"/>
  211. <available file="${contrib.jar2.dir}"/>
  212. <available file="${contrib.jar3.dir}"/>
  213. <available file="${junit.jar1.dir}"/>
  214. </and>
  215. <isset property="disconnected"/>
  216. </or>
  217. </condition>
  218. </target>
  219. <target name="fetch-jars" unless="jars.present"
  220. description="Fetches needed JAR files from the Internet">
  221. <get src="${main.jar1.url}" dest="${main.jar1.dir}"/>
  222. <get src="${main.jar2.url}" dest="${main.jar2.dir}"/>
  223. <get src="${contrib.jar1.url}" dest="${contrib.jar1.dir}"/>
  224. <get src="${contrib.jar2.url}" dest="${contrib.jar2.dir}"/>
  225. <get src="${contrib.jar3.url}" dest="${contrib.jar3.dir}"/>
  226. <get src="${junit.jar1.url}" dest="${junit.jar1.dir}"/>
  227. </target>
  228. <target name="compile" depends="init, compile-main, compile-scratchpad,
  229. compile-contrib, compile-examples"
  230. description="Compiles the POI main classes, scratchpad, contrib, and examples"/>
  231. <target name="compile-main" depends="fail-unless-xslt-is-available">
  232. <copy todir="${main.output.dir}">
  233. <fileset dir="${main.resource1.dir}"/>
  234. </copy>
  235. <javac target="${jdk.version.class}" source="${jdk.version.source}"
  236. failonerror="true" destdir="${main.output.dir}" debug="on" fork="yes"
  237. srcdir="${main.src}">
  238. <classpath refid="main.classpath"/>
  239. </javac>
  240. <javac target="${jdk.version.class}" source="${jdk.version.source}"
  241. failonerror="true" destdir="${main.output.test.dir}" debug="on"
  242. fork="yes" srcdir="${main.src.test}">
  243. <classpath>
  244. <path refid="main.classpath"/>
  245. <pathelement location="${main.output.dir}"/>
  246. <pathelement location="${junit.jar1.dir}"/>
  247. </classpath>
  248. </javac>
  249. </target>
  250. <target name="compile-scratchpad" depends="init">
  251. <javac target="${jdk.version.class}" source="${jdk.version.source}"
  252. failonerror="true" destdir="${scratchpad.output.dir}" debug="on"
  253. fork="yes" srcdir="${scratchpad.src}">
  254. <classpath refid="scratchpad.classpath"/>
  255. </javac>
  256. <javac target="${jdk.version.class}" source="${jdk.version.source}"
  257. failonerror="true" destdir="${scratchpad.output.test.dir}" debug="on"
  258. fork="yes" srcdir="${scratchpad.src.test}">
  259. <classpath>
  260. <path refid="scratchpad.classpath"/>
  261. <pathelement location="${scratchpad.output.dir}"/>
  262. <pathelement location="${junit.jar1.dir}"/>
  263. </classpath>
  264. </javac>
  265. <!-- Copy HSLF Resources over -->
  266. <property name="hslf.data" value="org/apache/poi/hslf/data" />
  267. <mkdir dir="${scratchpad.output.dir}/${hslf.data}" />
  268. <copy todir="${scratchpad.output.dir}/${hslf.data}">
  269. <fileset dir="${scratchpad.src}/${hslf.data}">
  270. <include name="*.ppt" />
  271. </fileset>
  272. </copy>
  273. </target>
  274. <target name="compile-contrib" depends="init">
  275. <javac target="${jdk.version.class}" source="${jdk.version.source}"
  276. failonerror="true" destdir="${contrib.output.dir}" debug="on" fork="yes"
  277. srcdir="${contrib.src}">
  278. <classpath refid="contrib.classpath"/>
  279. </javac>
  280. <javac target="${jdk.version.class}" source="${jdk.version.source}"
  281. failonerror="true" destdir="${contrib.output.test.dir}" debug="on"
  282. fork="yes" srcdir="${contrib.src.test}">
  283. <classpath>
  284. <path refid="contrib.classpath"/>
  285. <pathelement location="${contrib.output.dir}"/>
  286. <pathelement location="${junit.jar1.dir}"/>
  287. </classpath>
  288. </javac>
  289. </target>
  290. <target name="compile-examples" depends="init">
  291. <javac target="${jdk.version.class}" source="${jdk.version.source}"
  292. destdir="${examples.output.dir}" debug="on" srcdir="${examples.src}">
  293. <classpath refid="examples.classpath"/>
  294. </javac>
  295. </target>
  296. <target name="test" depends="test-main,test-scratchpad,test-contrib"
  297. description="Tests main, contrib and scratchpad"/>
  298. <target name="-test-main-check">
  299. <uptodate property="main.test.notRequired" targetfile="${main.testokfile}">
  300. <srcfiles dir="${main.src}"/>
  301. <srcfiles dir="${main.src.test}"/>
  302. </uptodate>
  303. </target>
  304. <path id="test.classpath">
  305. <path refid="main.classpath"/>
  306. <pathelement location="${main.output.dir}"/>
  307. <pathelement location="${main.output.test.dir}"/>
  308. <pathelement location="${junit.jar1.dir}"/>
  309. </path>
  310. <target name="test-main" unless="main.test.notRequired"
  311. depends="compile-main, -test-main-check, fail-unless-junit-is-available">
  312. <junit fork="no" printsummary="yes" haltonfailure="${halt.on.test.failure}"
  313. failureproperty="main.test.failed" showoutput="true">
  314. <classpath refid="test.classpath"/>
  315. <sysproperty key="HSSF.testdata.path"
  316. file="${main.src.test}/org/apache/poi/hssf/data"/>
  317. <sysproperty key="HPSF.testdata.path"
  318. file="${main.src.test}/org/apache/poi/hpsf/data"/>
  319. <sysproperty key="java.awt.headless" value="true"/>
  320. <formatter type="plain"/>
  321. <formatter type="xml"/>
  322. <batchtest todir="${main.reports.test}">
  323. <fileset dir="${main.src.test}">
  324. <include name="**/Test*.java"/>
  325. <exclude name="**/AllTests.java"/>
  326. <exclude name="**/TestEmptyDocument.java"/>
  327. <exclude name="**/TestUnfixedBugs.java"/>
  328. <exclude name="**/TestcaseRecordInputStream.java"/>
  329. </fileset>
  330. </batchtest>
  331. </junit>
  332. <delete file="${main.testokfile}"/>
  333. <antcall target="-test-main-write-testfile"/>
  334. </target>
  335. <target name="test-fail" depends="compile-main,
  336. fail-unless-junit-is-available"
  337. description="run tests that are known to fail">
  338. <junit printsummary="yes" showoutput="true" filtertrace="no"
  339. haltonfailure="false">
  340. <classpath refid="test.classpath"/>
  341. <classpath>
  342. <path refid="scratchpad.classpath"/>
  343. <pathelement location="${main.output.dir}"/>
  344. <pathelement location="${scratchpad.output.dir}"/>
  345. <pathelement location="${scratchpad.output.test.dir}"/>
  346. <pathelement location="${junit.jar1.dir}"/>
  347. </classpath>
  348. <sysproperty key="HSSF.testdata.path"
  349. file="${main.src.test}/org/apache/poi/hssf/data"/>
  350. <sysproperty key="HPSF.testdata.path"
  351. file="${main.src.test}/org/apache/poi/hpsf/data"/>
  352. <sysproperty key="HWPF.testdata.path"
  353. file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
  354. <sysproperty key="java.awt.headless" value="true"/>
  355. <formatter type="plain" usefile="no"/>
  356. <batchtest todir="${main.reports.test}">
  357. <fileset dir="${main.src.test}">
  358. <include name="**/TestEmptyDocument.java"/>
  359. <include name="**/TestUnfixedBugs.java"/>
  360. </fileset>
  361. </batchtest>
  362. </junit>
  363. </target>
  364. <target name="single-test" depends="-test-property-check,compile-main" description="Runs a single test case specified with -Dtestcase=classname">
  365. <junit printsummary="yes" showoutput="true" filtertrace="no" haltonfailure="false" >
  366. <classpath refid="test.classpath"/>
  367. <classpath>
  368. <path refid="test.classpath"/>
  369. <pathelement location="${main.output.dir}"/>
  370. <pathelement location="${scratchpad.output.dir}"/>
  371. <pathelement location="${scratchpad.output.test.dir}"/>
  372. <pathelement location="${junit.jar1.dir}"/>
  373. </classpath>
  374. <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
  375. <sysproperty key="HPSF.testdata.path" file="${main.src.test}/org/apache/poi/hpsf/data"/>
  376. <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
  377. <sysproperty key="java.awt.headless" value="true"/>
  378. <formatter type="plain" usefile="no"/>
  379. <formatter type="xml"/>
  380. <test name="${testcase}"/>
  381. </junit>
  382. </target>
  383. <target name="debug-test" depends="-test-property-check,compile-main" description="Runs a single test case specified with -Dtestcase=classname with remote debug options turned on." >
  384. <echo>Waiting for debugger on port 5001</echo>
  385. <junit printsummary="no" showoutput="true" filtertrace="no" fork="yes" haltonfailure="${halt.on.test.failure}" failureproperty="main.test.failed">
  386. <jvmarg value="-Xdebug"/>
  387. <jvmarg value="-Xrunjdwp:transport=dt_socket,address=5001,server=y,suspend=y"/>
  388. <sysproperty key="java.compiler" value="NONE"/>
  389. <classpath refid="test.classpath"/>
  390. <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
  391. <sysproperty key="HPSF.testdata.path" file="${main.src.test}/org/apache/poi/hpsf/data"/>
  392. <sysproperty key="java.awt.headless" value="true"/>
  393. <formatter type="plain" usefile="no"/>
  394. <test name="${testcase}"/>
  395. </junit>
  396. </target>
  397. <target name="-test-property-check" unless="testcase">
  398. <echo message="Please use -Dtestcase=org.your.testcase to run a single test"/>
  399. <fail/>
  400. </target>
  401. <target name="-test-main-write-testfile" unless="main.test.failed">
  402. <echo file="${main.testokfile}" append="false" message="testok"/>
  403. </target>
  404. <target name="-test-scratchpad-check">
  405. <uptodate property="scratchpad.test.notRequired" targetfile="${scratchpad.testokfile}">
  406. <srcfiles dir="${scratchpad.src}"/>
  407. <srcfiles dir="${scratchpad.src.test}"/>
  408. </uptodate>
  409. </target>
  410. <target name="test-scratchpad" depends="compile-main,compile-scratchpad,-test-scratchpad-check" unless="scratchpad.test.notRequired">
  411. <junit printsummary="yes" fork="no" haltonfailure="${halt.on.test.failure}" failureproperty="scratchpad.test.failed">
  412. <classpath>
  413. <path refid="scratchpad.classpath"/>
  414. <pathelement location="${main.output.dir}"/>
  415. <pathelement location="${scratchpad.output.dir}"/>
  416. <pathelement location="${scratchpad.output.test.dir}"/>
  417. <pathelement location="${junit.jar1.dir}"/>
  418. </classpath>
  419. <sysproperty key="HSSF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hssf/data"/>
  420. <sysproperty key="HPSF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hpsf/data"/>
  421. <sysproperty key="HDF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdf/data"/>
  422. <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
  423. <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
  424. <sysproperty key="java.awt.headless" value="true"/>
  425. <formatter type="plain"/>
  426. <formatter type="xml"/>
  427. <batchtest todir="${scratchpad.reports.test}">
  428. <fileset dir="${scratchpad.src.test}">
  429. <include name="**/Test*.java"/>
  430. <exclude name="**/AllTests.java"/>
  431. </fileset>
  432. </batchtest>
  433. </junit>
  434. <delete file="${scratchpad.testokfile}"/>
  435. <antcall target="-test-scratchpad-write-testfile"/>
  436. </target>
  437. <target name="-test-scratchpad-write-testfile" unless="scratchpad.test.failed">
  438. <echo file="${scratchpad.testokfile}" append="false" message="testok"/>
  439. </target>
  440. <target name="single-scratchpad-test" depends="compile-scratchpad,-test-property-check" description="Runs a single test case specified with -Dtestcase=classname">
  441. <junit printsummary="yes" showoutput="true" filtertrace="no" haltonfailure="false" >
  442. <classpath refid="test.classpath"/>
  443. <classpath>
  444. <path refid="scratchpad.classpath"/>
  445. <pathelement location="${main.output.dir}"/>
  446. <pathelement location="${scratchpad.output.dir}"/>
  447. <pathelement location="${scratchpad.output.test.dir}"/>
  448. <pathelement location="${junit.jar1.dir}"/>
  449. </classpath>
  450. <sysproperty key="HSSF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hssf/data"/>
  451. <sysproperty key="HPSF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hpsf/data"/>
  452. <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
  453. <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
  454. <sysproperty key="java.awt.headless" value="true"/>
  455. <sysproperty key="java.awt.headless" value="true"/>
  456. <formatter type="plain" usefile="no"/>
  457. <formatter type="xml"/>
  458. <test name="${testcase}"/>
  459. </junit>
  460. </target>
  461. <target name="-test-contrib-check">
  462. <uptodate property="contrib.test.notRequired" targetfile="${contrib.testokfile}">
  463. <srcfiles dir="${contrib.src}"/>
  464. <srcfiles dir="${contrib.src.test}"/>
  465. </uptodate>
  466. </target>
  467. <target name="test-contrib" depends="compile-main,compile-contrib,-test-contrib-check" unless="contrib.test.notRequired">
  468. <junit printsummary="yes" fork="no" haltonfailure="${halt.on.test.failure}" failureproperty="contrib.test.failed">
  469. <classpath>
  470. <path refid="contrib.classpath"/>
  471. <pathelement location="${main.output.dir}"/>
  472. <pathelement location="${contrib.output.dir}"/>
  473. <pathelement location="${contrib.output.test.dir}"/>
  474. <pathelement location="${junit.jar1.dir}"/>
  475. </classpath>
  476. <sysproperty key="HSSF.testdata.path" file="${contrib.src.test}/org/apache/poi/hssf/data"/>
  477. <sysproperty key="HPSF.testdata.path" file="${contrib.src.test}/org/apache/poi/hpsf/data"/>
  478. <sysproperty key="java.awt.headless" value="true"/>
  479. <formatter type="plain"/>
  480. <formatter type="xml"/>
  481. <batchtest todir="${contrib.reports.test}">
  482. <fileset dir="${contrib.src.test}">
  483. <include name="**/Test*.java"/>
  484. <exclude name="**/AllTests.java"/>
  485. </fileset>
  486. </batchtest>
  487. </junit>
  488. <delete file="${contrib.testokfile}"/>
  489. <antcall target="-test-contrib-write-testfile"/>
  490. </target>
  491. <target name="-test-contrib-write-testfile" unless="contrib.test.failed">
  492. <echo file="${contrib.testokfile}" append="false" message="testok"/>
  493. </target>
  494. <target name="-check-docs">
  495. <uptodate property="main.docs.notRequired" targetfile="${build.site}/index.html">
  496. <srcfiles dir="${build.site.src}"/>
  497. </uptodate>
  498. </target>
  499. <target name="-check-forrest-installed" unless="env.FORREST_HOME">
  500. <echo>Please install Apache Forrest (see
  501. &lt;http://xml.apache.org/forrest/index.html&gt;) and set the
  502. FORREST_HOME environment variable!</echo>
  503. <fail message="Apache Forrest is not installed."/>
  504. </target>
  505. <!-- <target name="check-docs">-->
  506. <!-- <uptodate property="main.docs.notRequired" targetfile="${build.site}/index.html" >-->
  507. <!-- <srcfiles dir= "${build.site.src}"/>-->
  508. <!-- </uptodate>-->
  509. <!-- </target>-->
  510. <target name="docs" depends="init, -check-forrest-installed, -check-docs"
  511. unless="main.docs.notRequired" description="Builds the POI website">
  512. <mkdir dir="${build.site.src}/src/documentation/content/apidocs"/>
  513. <copy todir="${build.site.src}/src/documentation/content/apidocs">
  514. <fileset dir="${apidocs.report.dir}"/>
  515. </copy>
  516. <copy
  517. tofile="${build.site.src}/src/documentation/content/jdepend.ehtml"
  518. file="${jdepend.report.dir}/index.html" failonerror="false"/>
  519. <mkdir dir="${build.site.src}/src/documentation/content/junit"/>
  520. <copy todir="${build.site.src}/src/documentation/content/junit">
  521. <fileset dir="${junit.report.dir}"/>
  522. </copy>
  523. <move
  524. file="${build.site.src}/src/documentation/content/xdocs/status.xml"
  525. tofile="${build.site.src}/status.xml"/>
  526. <ant antfile="${forrest.home}/forrest.antproxy.xml" target="site">
  527. <property name="project.home" location="${build.site.src}"/>
  528. </ant>
  529. <echo>Broken links:</echo>
  530. <echo file="${build.site}/../tmp/brokenlinks.txt"/>
  531. <touch>
  532. <fileset dir="${build.site}"/>
  533. </touch>
  534. </target>
  535. <!-- Checks whether reports are required to be run. If nothing has changed then they dont. -->
  536. <target name="-check-reports">
  537. <condition property="reports.notRequired">
  538. <and>
  539. <equals arg1="${main.test.notRequired}" arg2="true"/>
  540. <equals arg1="${scratchpad.test.notRequired}" arg2="true"/>
  541. <equals arg1="${contrib.test.notRequired}" arg2="true"/>
  542. </and>
  543. </condition>
  544. </target>
  545. <!-- Generates a log of the latest changes in the CVS repository. -->
  546. <target name="cvschangelog" unless="disconnected"
  547. depends="fail-unless-xslt-is-available"
  548. description="Generates a CVS change log report">
  549. <antcall target="cvs-rsh-warning"/>
  550. <cvschangelog destfile="${changelog.file}" daysinpast="30"/>
  551. <style in="${changelog.file}"
  552. out="${build.site.src}/src/documentation/content/changelog.html"
  553. style="changelog.xsl">
  554. <param name="title" expression="POI Change Log"/>
  555. <param name="module" expression="jakarta-poi"/>
  556. <param name="cvsweb" expression="http://cvs.apache.org/viewcvs/"/>
  557. </style>
  558. </target>
  559. <target name="cvs-rsh-warning" unless="env.CVS_RSH">
  560. <echo>
  561. WARNING: The environment variable CVS_RSH is not set. If you cannot
  562. access the CVS repository this could be one of the reasons for the
  563. failure.
  564. </echo>
  565. </target>
  566. <!-- Creates reports and API documentation -->
  567. <target name="reports" unless="reports.notRequired" depends="-check-reports,
  568. fail-unless-xslt-is-available, fail-unless-junit-is-available,
  569. fail-unless-jdepend-is-available, test-ignore-failures, junitreport,
  570. jdepend, cvschangelog, javadocs, clover.html"
  571. description="Creates various reports and the API documentation">
  572. </target>
  573. <!-- Runs all JUnit tests without aborting if one of the tests fails. -->
  574. <target name="test-ignore-failures" depends="init">
  575. <antcall target="test">
  576. <param name="halt.on.test.failure" value="false"/>
  577. </antcall>
  578. </target>
  579. <!-- Produces a report of the JUnit test results -->
  580. <target name="junitreport"
  581. depends="fail-unless-xslt-is-available, test-ignore-failures"
  582. description="Produces a report of the JUnit test results">
  583. <junitreport todir="${junit.report.dir}">
  584. <fileset dir="${main.reports.test}">
  585. <include name="TEST-*.xml"/>
  586. </fileset>
  587. <fileset dir="${scratchpad.reports.test}">
  588. <include name="TEST-*.xml"/>
  589. </fileset>
  590. <fileset dir="${contrib.reports.test}">
  591. <include name="TEST-*.xml"/>
  592. </fileset>
  593. <report format="frames" todir="${junit.report.dir}"/>
  594. </junitreport>
  595. </target>
  596. <!-- Generates the API documentation. -->
  597. <target name="javadocs" depends="init, warn-unless-junit-is-available,
  598. warn-unless-xslt-is-available"
  599. description="Generates the API documentation">
  600. <javadoc verbose="false" author="true" destdir="${apidocs.report.dir}"
  601. windowtitle="POI API Documentation" use="true" version="true">
  602. <packageset dir="${main.src}" defaultexcludes="yes">
  603. <include name="org/apache/poi/**"/>
  604. </packageset>
  605. <packageset dir="${scratchpad.src}" defaultexcludes="yes">
  606. <include name="org/apache/poi/**"/>
  607. <exclude name="org/apache/poi/hdf/**"/>
  608. </packageset>
  609. <packageset dir="${contrib.src}" defaultexcludes="yes">
  610. <include name="org/apache/poi/**"/>
  611. </packageset>
  612. <packageset dir="${examples.src}" defaultexcludes="yes">
  613. <include name="org/apache/poi/**"/>
  614. </packageset>
  615. <classpath id="javadoc.classpath">
  616. <path refid="main.classpath"/>
  617. <path refid="scratchpad.classpath"/>
  618. <path refid="contrib.classpath"/>
  619. <path refid="examples.classpath"/>
  620. <path path="${env.CLASSPATH}"/>
  621. </classpath>
  622. <doctitle><![CDATA[<h1>POI API Documentation</h1>]]></doctitle>
  623. <bottom>
  624. <![CDATA[<i>Copyright ${tstamp.year} The Apache Software Foundation or
  625. its licensors, as applicable.</i>]]>
  626. </bottom>
  627. <group>
  628. <title>DDF - Dreadful Drawing Format</title>
  629. <package name="org.apache.poi.ddf*"/>
  630. </group>
  631. <group>
  632. <title>HPSF - Horrible Property Set Format</title>
  633. <package name="org.apache.poi.hpsf*"/>
  634. </group>
  635. <group>
  636. <title>HSSF - Horrible Spreadsheet Format</title>
  637. <package name="org.apache.poi.hssf*"/>
  638. </group>
  639. <group>
  640. <title>HWPF - Horrible Word Processor Format</title>
  641. <package name="org.apache.poi.hwpf*"/>
  642. </group>
  643. <group>
  644. <title>POIFS - POI File System</title>
  645. <package name="org.apache.poi.poifs*"/>
  646. </group>
  647. <group>
  648. <title>Utilities</title>
  649. <package name="org.apache.poi.util*"/>
  650. </group>
  651. <group>
  652. <title>Examples</title>
  653. <package name="org.apache.poi.hpsf.examples*"/>
  654. <package name="org.apache.poi.hssf.usermodel.examples*"/>
  655. </group>
  656. </javadoc>
  657. <antcall target="clover.html"/>
  658. </target>
  659. <!-- ================================== -->
  660. <!-- Generate records -->
  661. <!-- ================================== -->
  662. <target name="generate-records" depends="init"
  663. description="Generates HSSF records">
  664. <java classname="org.apache.poi.dev.RecordGenerator" fork="yes">
  665. <arg file="src/records/definitions"/>
  666. <arg file="src/records/styles"/>
  667. <arg file="src/java"/>
  668. <arg file="src/testcases"/>
  669. <classpath>
  670. <path refid="scratchpad.classpath"/>
  671. <pathelement location="${main.output.dir}"/>
  672. <pathelement location="${scratchpad.output.dir}"/>
  673. </classpath>
  674. </java>
  675. </target>
  676. <!-- ================================== -->
  677. <!-- Generate types -->
  678. <!-- ================================== -->
  679. <target name="generate-types" depends="init"
  680. description="Generates word types">
  681. <java classname="org.apache.poi.dev.RecordGenerator" fork="yes">
  682. <arg file="src/types/definitions"/>
  683. <arg file="src/types/styles"/>
  684. <arg file="src/scratchpad/src"/>
  685. <arg file="src/scratchpad/testcases"/>
  686. <classpath>
  687. <path refid="scratchpad.classpath">
  688. </path>
  689. <pathelement location="${main.output.dir}"/>
  690. <pathelement location="${scratchpad.output.dir}"/>
  691. </classpath>
  692. </java>
  693. </target>
  694. <!-- Generates documentation and reports -->
  695. <target name="site" depends="reports, docs"
  696. description="Generates POI's website's contents"/>
  697. <target name="maven-dist" depends="clean,compile" description="Builds the jar files for a maven distribution, and the POM to go with them">
  698. <!-- Build a Jar of all the class files -->
  699. <jar destfile="${mavendist.dir}/${jar.name}-${version.id}.jar">
  700. <manifest>
  701. <attribute name="Built-By" value="${user.name}"/>
  702. <section name="common">
  703. <attribute name="Specification-Title" value="Jakarta POI"/>
  704. <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
  705. <attribute name="Specification-Vendor" value="Apache"/>
  706. <attribute name="Implementation-Title" value="Jakarta POI"/>
  707. <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
  708. <attribute name="Implementation-Vendor" value="Apache"/>
  709. </section>
  710. </manifest>
  711. <fileset dir="${main.output.dir}" />
  712. <fileset dir="${contrib.output.dir}" />
  713. <fileset dir="${scratchpad.output.dir}" />
  714. <fileset dir="legal/" />
  715. </jar>
  716. <!-- Build a Jar file of all the source files -->
  717. <jar destfile="${mavendist.dir}/${jar.name}-${version.id}-sources.jar">
  718. <manifest>
  719. <attribute name="Built-By" value="${user.name}"/>
  720. <section name="common">
  721. <attribute name="Specification-Title" value="Jakarta POI"/>
  722. <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
  723. <attribute name="Specification-Vendor" value="Apache"/>
  724. <attribute name="Implementation-Title" value="Jakarta POI"/>
  725. <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
  726. <attribute name="Implementation-Vendor" value="Apache"/>
  727. </section>
  728. </manifest>
  729. <fileset dir="${main.src}" includes="**/*.java" />
  730. <fileset dir="${contrib.src}" includes="**/*.java" />
  731. <fileset dir="${scratchpad.src}" includes="**/*.java" />
  732. <fileset dir="legal/" />
  733. </jar>
  734. <!-- Build the pom -->
  735. <!-- Copy from the base file, and substitute in the version -->
  736. <filter token="VERSION" value="${version.id}" />
  737. <copy
  738. filtering="true"
  739. file="poi.pom"
  740. tofile="${mavendist.dir}/${jar.name}-${version.id}.pom"
  741. />
  742. </target>
  743. <target name="jar" depends="compile" description="Creates jar files for distribution">
  744. <jar destfile="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar">
  745. <fileset dir="${main.output.dir}" />
  746. <fileset dir="legal/" />
  747. <manifest>
  748. <attribute name="Built-By" value="${user.name}"/>
  749. <section name="common">
  750. <attribute name="Specification-Title" value="Jakarta POI"/>
  751. <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
  752. <attribute name="Specification-Vendor" value="Apache"/>
  753. <attribute name="Implementation-Title" value="Jakarta POI"/>
  754. <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
  755. <attribute name="Implementation-Vendor" value="Apache"/>
  756. </section>
  757. </manifest>
  758. </jar>
  759. <jar destfile="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar">
  760. <fileset dir="${contrib.output.dir}" />
  761. <fileset dir="legal/" />
  762. <manifest>
  763. <attribute name="Built-By" value="${user.name}"/>
  764. <section name="common">
  765. <attribute name="Specification-Title" value="Jakarta POI"/>
  766. <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
  767. <attribute name="Specification-Vendor" value="Apache"/>
  768. <attribute name="Implementation-Title" value="Jakarta POI"/>
  769. <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
  770. <attribute name="Implementation-Vendor" value="Apache"/>
  771. </section>
  772. </manifest>
  773. </jar>
  774. <jar destfile="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar">
  775. <fileset dir="${scratchpad.output.dir}" />
  776. <fileset dir="legal/" />
  777. <manifest>
  778. <attribute name="Built-By" value="${user.name}"/>
  779. <section name="common">
  780. <attribute name="Specification-Title" value="Jakarta POI"/>
  781. <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
  782. <attribute name="Specification-Vendor" value="Apache"/>
  783. <attribute name="Implementation-Title" value="Jakarta POI"/>
  784. <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
  785. <attribute name="Implementation-Vendor" value="Apache"/>
  786. </section>
  787. </manifest>
  788. </jar>
  789. </target>
  790. <target name="dist" depends="clean, fail-unless-tools-are-available, compile, site, jar"
  791. description="Creates the entire distribution into build/dist, from scratch">
  792. <property name="zipdir" value="${jar.name}-${version.id}" />
  793. <zip destfile="${dist.dir}/${jar.name}-bin-${version.id}-${DSTAMP}.zip">
  794. <zipfileset dir="legal/" prefix="${zipdir}" />
  795. <zipfileset dir="${build.site}" prefix="${zipdir}/docs"/>
  796. <zipfileset file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
  797. <zipfileset file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
  798. <zipfileset file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
  799. </zip>
  800. <zip destfile="${dist.dir}/${jar.name}-src-${version.id}-${DSTAMP}.zip">
  801. <zipfileset dir="legal/" prefix="${zipdir}" />
  802. <zipfileset dir="${build.site}" prefix="${zipdir}/docs"/>
  803. <zipfileset dir="." prefix="${zipdir}">
  804. <exclude name="build/**"/>
  805. <exclude name="scripts/**"/>
  806. <exclude name="*.ipr"/>
  807. <exclude name="*.iml"/>
  808. <exclude name="*.iws"/>
  809. <exclude name="*.swp"/>
  810. </zipfileset>
  811. </zip>
  812. <tar destfile="${dist.dir}/${jar.name}-bin-${version.id}-${DSTAMP}.tar.gz"
  813. compression="gzip">
  814. <tarfileset dir="legal/" prefix="${zipdir}" />
  815. <tarfileset dir="${build.site}" prefix="${zipdir}/docs"/>
  816. <tarfileset file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
  817. <tarfileset file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
  818. <tarfileset file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
  819. </tar>
  820. <tar destfile="${dist.dir}/${jar.name}-src-${version.id}-${DSTAMP}.tar.gz"
  821. compression="gzip">
  822. <tarfileset dir="legal/" prefix="${zipdir}" />
  823. <tarfileset dir="${build.site}" prefix="${zipdir}/docs"/>
  824. <tarfileset dir="." prefix="${zipdir}">
  825. <exclude name="build/**"/>
  826. <exclude name="scripts/**"/>
  827. <exclude name="*.ipr"/>
  828. <exclude name="*.iml"/>
  829. <exclude name="*.iws"/>
  830. <exclude name="*.swp"/>
  831. </tarfileset>
  832. </tar>
  833. <echo>Distribution located in build/dist</echo>
  834. </target>
  835. <target name="clean-compile" depends="clean, compile"/>
  836. <target name="clean-dist" depends="clean, dist"
  837. description="Cleans the build directory then creates a distribution"/>
  838. <target name="gump" depends="test, jar"/>
  839. <!-- Generates the Ant document type definition (DTD) -->
  840. <target name="dtd"
  841. description="Generates the Ant document type definition (DTD)">
  842. <antstructure output="ant.dtd"/>
  843. </target>
  844. <!-- Abort the build if JUnit is missing. -->
  845. <target name="fail-unless-junit-is-available" depends="init">
  846. <condition property="isAvailable.junit">
  847. <available classname="junit.framework.TestCase"/>
  848. </condition>
  849. <antcall target="fail-junit"/>
  850. </target>
  851. <target name="fail-junit" unless="isAvailable.junit">
  852. <echo>
  853. JUnit is not available. You must download JUnit from
  854. &lt;http://www.junit.org/&gt; and include the JAR file in your
  855. classpath.
  856. </echo>
  857. <fail message="JUnit is not available."/>
  858. </target>
  859. <!-- Warn if JUnit is missing. -->
  860. <target name="warn-unless-junit-is-available" depends="init">
  861. <condition property="isAvailable.junit">
  862. <available classname="junit.framework.TestCase"/>
  863. </condition>
  864. <antcall target="warn-junit"/>
  865. </target>
  866. <target name="warn-junit" unless="isAvailable.junit">
  867. <echo>
  868. WARNING: Since JUnit is not available you might encounter failures
  869. subsequently. In order to avoid this you should download JUnit from
  870. &lt;http://www.junit.org/&gt; and include the JAR file in your
  871. classpath.
  872. </echo>
  873. </target>
  874. <!-- Abort the build if JDepend is missing. -->
  875. <target name="fail-unless-jdepend-is-available" depends="init">
  876. <condition property="isAvailable.jdepend">
  877. <available classname="jdepend.framework.JDepend"/>
  878. </condition>
  879. <antcall target="fail-jdepend"/>
  880. </target>
  881. <target name="fail-jdepend" unless="isAvailable.jdepend">
  882. <echo>
  883. JDepend is not available. You must download JDepend from
  884. &lt;http://www.clarkware.com/software/JDepend.html&gt; and include the
  885. JAR file in your classpath.
  886. </echo>
  887. <fail message="JDepend is not available."/>
  888. </target>
  889. <!-- Abort the build if an XSLT processor is missing. -->
  890. <target name="fail-unless-xslt-is-available" depends="init">
  891. <condition property="isAvailable.xslt">
  892. <available classname="javax.xml.transform.TransformerFactory"/>
  893. </condition>
  894. <antcall target="fail-xslt"/>
  895. </target>
  896. <target name="fail-xslt" unless="isAvailable.xslt">
  897. <echo>
  898. An XSLT processor is missing. You must download e.g. Xalan from
  899. &lt;http://xml.apache.org/xalan-j/&gt; and include the JAR file in your
  900. classpath.
  901. </echo>
  902. <fail message="An XSLT processor is not available."/>
  903. </target>
  904. <!-- Warn if an XSLT processor is missing. -->
  905. <target name="warn-unless-xslt-is-available" depends="init">
  906. <condition property="isAvailable.xslt">
  907. <available classname="javax.xml.transform.TransformerFactory"/>
  908. </condition>
  909. <antcall target="warn-xslt"/>
  910. </target>
  911. <target name="warn-xslt" unless="isAvailable.xslt">
  912. <echo>
  913. WARNING: Since an XSLT processor is not available you might encounter
  914. failures subsequently. In order to avoid this you should download
  915. e.g. Xalan from &lt;http://xml.apache.org/xalan-j/&gt; and include the
  916. JAR file in your classpath.
  917. </echo>
  918. </target>
  919. <!-- Aborts the build if any of the required tools are missing. -->
  920. <target name="fail-unless-tools-are-available"
  921. depends="fail-unless-junit-is-available, fail-unless-junit-is-available,
  922. fail-unless-jdepend-is-available"/>
  923. <!-- Runs jdepend to produce a report about package dependencies -->
  924. <target name="jdepend" depends="fail-unless-jdepend-is-available"
  925. description="Runs jdepend to produce a report about package dependencies">
  926. <jdepend outputfile="${jdepend.report.dir}/jdepend.xml" format="xml">
  927. <classespath>
  928. <pathelement location="${main.output.dir}"/>
  929. <pathelement location="${contrib.output.dir}"/>
  930. <pathelement location="${scratchpad.output.dir}"/>
  931. </classespath>
  932. <classpath>
  933. <path refid="main.classpath"/>
  934. <path refid="contrib.classpath"/>
  935. <path refid="scratchpad.classpath"/>
  936. </classpath>
  937. </jdepend>
  938. <style basedir="${jdepend.report.dir}"
  939. in="${jdepend.report.dir}/jdepend.xml"
  940. out="${jdepend.report.out.dir}/index.html"
  941. style="jdepend.xsl"/>
  942. </target>
  943. </project>
  944. <!-- Keep this comment at the end of the file
  945. Local variables:
  946. mode: xml
  947. sgml-omittag:nil
  948. sgml-shorttag:nil
  949. sgml-namecase-general:nil
  950. sgml-general-insert-case:lower
  951. sgml-minimize-attributes:nil
  952. sgml-always-quote-attributes:t
  953. sgml-indent-step:2
  954. sgml-indent-data:t
  955. sgml-parent-document:nil
  956. sgml-exposed-tags:nil
  957. sgml-local-catalogs:nil
  958. sgml-local-ecat-files:nil
  959. End:
  960. -->