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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279
  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. Bruno Girin brunogirin@gmail.com
  25. This build was tested with ant 1.6.2 although it will probably work with
  26. other versions. The following jar files should be available on the
  27. classpath when running ant:
  28. LIBRARY LOCATION
  29. ======= ========
  30. junit(3.8+) http://www.ibiblio.org/maven/junit/jars/
  31. jdepend http://www.ibiblio.org/maven/jdepend/jars/
  32. The ant jar "optional.jar" should also be available otherwise the
  33. build will fail.
  34. To build the documentation you will need to install forrest and set
  35. the FORREST_HOME environment variable. Forrest 0.5.1 required.
  36. Since POI 3.5 you will need JDK 1.5 or newer to build POI.
  37. Some people may find the tests hang when run through Ant. If this
  38. happens to you, try giving Ant some more memory when you run it, eg:
  39. ANT_OPTS="-Xmx1024m -XX:MaxPermSize=256m" ant test
  40. TO BE COMPLETED:
  41. Convert book.xml files to a sitemap.
  42. -->
  43. <project name="POI Build" default="help" basedir=".">
  44. <description>
  45. The POI project Ant build.
  46. </description>
  47. <property environment="env"/>
  48. <property name="repository.m2" value="http://repo1.maven.org"/>
  49. <property name="forrest.home" value="${env.FORREST_HOME}"/>
  50. <!-- Main: -->
  51. <property name="main.resource1.dir" value="src/resources/main"/>
  52. <property name="main.src" location="src/java"/>
  53. <property name="main.src.test" location="src/testcases"/>
  54. <property name="main.documentation" value="src/documentation"/>
  55. <property name="main.output.dir" location="build/classes"/>
  56. <property name="main.output.test.dir" location="build/test-classes"/>
  57. <property name="main.lib" location="lib"/>
  58. <property name="ooxml.lib" location="ooxml-lib"/>
  59. <property name="main.reports.test" location="build/test-results"/>
  60. <property name="poi.test.dir" location="test-data"/>
  61. <property name="main.commons-logging.jar" location="${main.lib}/commons-logging-1.1.jar"/>
  62. <property name="main.commons-logging.url" value="${repository.m2}/maven2/commons-logging/commons-logging/1.1/commons-logging-1.1.jar"/>
  63. <property name="main.log4j.jar" location="${main.lib}/log4j-1.2.13.jar"/>
  64. <property name="main.log4j.url" value="${repository.m2}/maven2/log4j/log4j/1.2.13/log4j-1.2.13.jar"/>
  65. <property name="main.junit.jar" location="${main.lib}/junit-3.8.1.jar"/>
  66. <property name="main.junit.url" value="${repository.m2}/maven2/junit/junit/3.8.1/junit-3.8.1.jar"/>
  67. <property name="main.testokfile" location="build/main-testokfile.txt"/>
  68. <!-- Scratchpad: -->
  69. <property name="scratchpad.resource1.dir" value="src/resources/scratchpad"/>
  70. <property name="scratchpad.src" location="src/scratchpad/src"/>
  71. <property name="scratchpad.src.test" location="src/scratchpad/testcases"/>
  72. <property name="scratchpad.lib" location="src/scratchpad/lib"/>
  73. <property name="scratchpad.reports.test" location="build/scratchpad-test-results"/>
  74. <property name="scratchpad.output.dir" location="build/scratchpad-classes"/>
  75. <property name="scratchpad.output.test.dir" location="build/scratchpad-test-classes"/>
  76. <property name="scratchpad.testokfile" location="build/scratchpad-testokfile.txt"/>
  77. <!-- Contributed software: -->
  78. <property name="contrib.src" location="src/contrib/src"/>
  79. <property name="contrib.src.test" location="src/contrib/testcases"/>
  80. <property name="contrib.lib" location="src/contrib/lib"/>
  81. <property name="contrib.reports.test" location="build/contrib-test-results"/>
  82. <property name="contrib.output.dir" location="build/contrib-classes"/>
  83. <property name="contrib.output.test.dir" location="build/contrib-test-classes"/>
  84. <property name="contrib.testokfile" location="build/contrib-testokfile.txt"/>
  85. <!-- Examples: -->
  86. <property name="examples.src" location="src/examples/src"/>
  87. <property name="examples.output.dir" location="build/examples-classes"/>
  88. <!-- Scratchpad Examples: -->
  89. <property name="scratchpad.examples.src" location="src/scratchpad/examples/src"/>
  90. <property name="scratchpad.examples.output.dir" location="build/scratchpad-examples-classes"/>
  91. <!-- OOXML support: -->
  92. <property name="ooxml.src" location="src/ooxml/java"/>
  93. <property name="ooxml.src.test" location="src/ooxml/testcases"/>
  94. <property name="ooxml.reports.test" location="build/ooxml-test-results"/>
  95. <property name="ooxml.output.dir" location="build/ooxml-classes"/>
  96. <property name="ooxml.output.test.dir" location="build/ooxml-test-classes"/>
  97. <property name="ooxml.testokfile" location="build/ooxml-testokfile.txt"/>
  98. <!-- The following jars are downloaded by the fetch-ooxml-jars task -->
  99. <property name="ooxml.dom4j.jar" location="${ooxml.lib}/dom4j-1.6.1.jar"/>
  100. <property name="ooxml.dom4j.url" value="${repository.m2}/maven2/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar"/>
  101. <property name="ooxml.xmlbeans.jar" location="${ooxml.lib}/xmlbeans-2.3.0.jar"/>
  102. <property name="ooxml.xmlbeans.url" value="${repository.m2}/maven2/org/apache/xmlbeans/xmlbeans/2.3.0/xmlbeans-2.3.0.jar"/>
  103. <property name="ooxml.jsr173.jar" location="${ooxml.lib}/geronimo-stax-api_1.0_spec-1.0.jar"/>
  104. <property name="ooxml.jsr173.url" value="${repository.m2}/maven2/org/apache/geronimo/specs/geronimo-stax-api_1.0_spec/1.0/geronimo-stax-api_1.0_spec-1.0.jar"/>
  105. <property name="ooxml.schemas.jar" location="${ooxml.lib}/ooxml-schemas-1.0.jar"/>
  106. <property name="ooxml.schemas.url" value="${repository.m2}/maven2/org/apache/poi/ooxml-schemas/1.0/ooxml-schemas-1.0.jar"/>
  107. <!-- See http://www.ecma-international.org/publications/standards/Ecma-376.htm -->
  108. <!-- "Copy these file(s), free of charge" -->
  109. <property name="ooxml.xsds.ozip" location="${ooxml.lib}/OfficeOpenXML-Part4.zip"/>
  110. <property name="ooxml.xsds.izip" location="${ooxml.lib}/OfficeOpenXML-XMLSchema.zip"/>
  111. <property name="ooxml.xsds.url" value="http://www.ecma-international.org/publications/files/ECMA-ST/Office%20Open%20XML%201st%20edition%20Part%204%20(PDF).zip" />
  112. <property name="ooxml.xsds.jar" location="${ooxml.lib}/ooxml-schemas.jar"/>
  113. <property name="maven.ooxml.xsds.version.id" value="1.0"/>
  114. <property name="maven.ooxml.xsds.jar" value="ooxml-schemas-${maven.ooxml.xsds.version.id}.jar"/>
  115. <property name="build.site" location="build/tmp/site/build/site"/>
  116. <property name="build.site.src" location="build/tmp/site"/>
  117. <property name="junit.report.dir" location="${build.site}/junit"/>
  118. <property name="jdepend.report.dir" location="${build.site}/jdepend"/>
  119. <property name="jdepend.report.out.dir" location="${build.site.src}/src/documentation/content/jdepend"/>
  120. <property name="apidocs.report.dir" location="${build.site}/apidocs"/>
  121. <property name="dist.dir" location="build/dist"/>
  122. <property name="mavendist.ooxml.dir" location="build/maven-ooxml-dependencies"/>
  123. <property name="apache.repository" value="scp://people.apache.org/www/people.apache.org/repo/m2-ibiblio-rsync-repository"/>
  124. <property name="snapshots.repository" value="scp://people.apache.org/www/people.apache.org/repo/m2-snapshot-repository/"/>
  125. <property name="jar.name" value="poi"/>
  126. <property name="version.id" value="3.6-beta1"/>
  127. <property name="halt.on.test.failure" value="true"/>
  128. <property name="jdk.version.source" value="1.5"
  129. description="JDK version of source code"/>
  130. <property name="jdk.version.class" value="1.5"
  131. description="JDK version of generated class files"/>
  132. <path id="main.classpath">
  133. <fileset dir="${main.lib}">
  134. <include name="*.jar"/>
  135. </fileset>
  136. <pathelement location="${main.resource1.dir}"/>
  137. </path>
  138. <path id="scratchpad.classpath">
  139. <path refid="main.classpath"/>
  140. <pathelement location="${main.output.dir}"/>
  141. <pathelement location="${scratchpad.resource1.dir}"/>
  142. </path>
  143. <path id="contrib.classpath">
  144. <path refid="main.classpath"/>
  145. <pathelement location="${main.output.dir}"/>
  146. <pathelement location="${main.output.test.dir}"/>
  147. <pathelement location="${scratchpad.output.dir}"/>
  148. <pathelement location="${scratchpad.output.test.dir}"/>
  149. <pathelement location="${contrib.output.dir}"/>
  150. <pathelement location="${contrib.output.test.dir}"/>
  151. </path>
  152. <path id="ooxml.classpath">
  153. <path refid="main.classpath"/>
  154. <pathelement location="${main.output.dir}"/>
  155. <pathelement location="${scratchpad.output.dir}"/>
  156. <fileset dir="${ooxml.lib}">
  157. <include name="*.jar" />
  158. </fileset>
  159. </path>
  160. <path id="test.classpath">
  161. <path refid="main.classpath"/>
  162. <pathelement location="${main.output.dir}"/>
  163. <pathelement location="${main.output.test.dir}"/>
  164. <pathelement location="${junit.jar1.dir}"/>
  165. </path>
  166. <path id="test.ooxml.classpath">
  167. <path refid="ooxml.classpath"/>
  168. <pathelement location="${ooxml.output.dir}"/>
  169. <pathelement location="${ooxml.output.test.dir}"/>
  170. <pathelement location="${main.output.test.dir}"/> <!-- ooxml tests use some utilities from main tests -->
  171. <pathelement location="${scratchpad.output.test.dir}"/>
  172. <pathelement location="${junit.jar1.dir}"/>
  173. </path>
  174. <path id="examples.classpath">
  175. <path refid="main.classpath"/>
  176. <pathelement location="${main.output.dir}"/>
  177. <pathelement location="${scratchpad.output.dir}"/>
  178. </path>
  179. <!-- Prints POI's Ant usage help -->
  180. <target name="help" description="Prints POI's Ant usage help">
  181. <echo>
  182. - Execute "ant -projecthelp" to view a listing of the main build
  183. targets.
  184. - Execute "ant help-properties" to view a listing of some properties
  185. controlling the build process.
  186. </echo>
  187. </target>
  188. <target name="help-properties"
  189. description="Prints a listing of build controlling properties">
  190. <echo>
  191. The following properties control the build process:
  192. -Ddisconnected="true": Do not execute any targets that require an online
  193. connection to the Internet.
  194. -Dtestcase=org.apache.poi.xxx.xxx : for the single-test target, specify
  195. the test to run
  196. -Dfilename=xxxx.xls : for the command line task targets, specify the
  197. file to run against
  198. WARNING: This list is not exhaustive.
  199. </echo>
  200. </target>
  201. <target name="with.clover" if="clover.present">
  202. <taskdef resource="clovertasks"/>
  203. <clover-setup initString="mycoverage.db"/>
  204. </target>
  205. <target name="clover.html" depends="with.clover" if="clover.present">
  206. <echo>Generating clover report</echo>
  207. <clover-report>
  208. <current outfile="build/tmp/site/build/site/clover_html">
  209. <format type="html"/>
  210. </current>
  211. </clover-report>
  212. </target>
  213. <target name="init" depends="fetch-jars,fetch-ooxml-jars">
  214. <tstamp>
  215. <format property="tstamp.year" pattern="yyyy"/>
  216. </tstamp>
  217. <available resource="clovertasks" property="clover.present"/>
  218. <antcall target="with.clover"/>
  219. <mkdir dir="build"/>
  220. <mkdir dir="build/non-ant-classes"/>
  221. <mkdir dir="${main.output.dir}"/>
  222. <mkdir dir="${scratchpad.output.dir}"/>
  223. <mkdir dir="${contrib.output.dir}"/>
  224. <mkdir dir="${examples.output.dir}"/>
  225. <mkdir dir="${scratchpad.examples.output.dir}"/>
  226. <mkdir dir="${ooxml.output.dir}"/>
  227. <mkdir dir="${main.output.test.dir}"/>
  228. <mkdir dir="${contrib.output.test.dir}"/>
  229. <mkdir dir="${scratchpad.output.test.dir}"/>
  230. <mkdir dir="${ooxml.output.test.dir}"/>
  231. <mkdir dir="${main.reports.test}"/>
  232. <mkdir dir="${scratchpad.reports.test}"/>
  233. <mkdir dir="${contrib.reports.test}"/>
  234. <mkdir dir="${ooxml.reports.test}"/>
  235. <mkdir dir="${junit.report.dir}"/>
  236. <mkdir dir="${jdepend.report.dir}"/>
  237. <mkdir dir="${jdepend.report.out.dir}"/>
  238. <mkdir dir="${apidocs.report.dir}"/>
  239. <mkdir dir="${dist.dir}"/>
  240. <mkdir dir="${build.site.src}/${main.documentation}"/>
  241. <copy todir="${build.site.src}/${main.documentation}">
  242. <fileset dir="${main.documentation}"/>
  243. </copy>
  244. <copy file="forrest.properties" tofile="${build.site.src}/forrest.properties"/>
  245. </target>
  246. <target name="clean">
  247. <delete dir="build"/>
  248. </target>
  249. <target name="testexist">
  250. <echo message="Testing for ${destfile}" level="debug"/>
  251. <available file="${destfile}" property="exist"/>
  252. </target>
  253. <target name="downloadfile" unless="exist" depends="testexist">
  254. <get src="${sourcefile}" dest="${destfile}" />
  255. </target>
  256. <target name="check-jars">
  257. <condition property="jars.present">
  258. <or>
  259. <and>
  260. <available file="${main.commons-logging.jar}"/>
  261. <available file="${main.log4j.jar}"/>
  262. <available file="${main.junit.jar}"/>
  263. </and>
  264. <isset property="disconnected"/>
  265. </or>
  266. </condition>
  267. </target>
  268. <target name="fetch-jars" depends="check-jars" unless="jars.present"
  269. description="Fetches needed JAR files from the Internet">
  270. <antcall target="downloadfile">
  271. <param name="sourcefile" value="${main.commons-logging.url}"/>
  272. <param name="destfile" value="${main.commons-logging.jar}"/>
  273. </antcall>
  274. <antcall target="downloadfile">
  275. <param name="sourcefile" value="${main.log4j.url}"/>
  276. <param name="destfile" value="${main.log4j.jar}"/>
  277. </antcall>
  278. <antcall target="downloadfile">
  279. <param name="sourcefile" value="${main.junit.url}"/>
  280. <param name="destfile" value="${main.junit.jar}"/>
  281. </antcall>
  282. </target>
  283. <target name="check-ooxml-jars">
  284. <condition property="ooxml.jars.present">
  285. <or>
  286. <and>
  287. <available file="${ooxml.dom4j.jar}"/>
  288. <available file="${ooxml.xmlbeans.jar}"/>
  289. <available file="${ooxml.jsr173.jar}"/>
  290. <available file="${ooxml.schemas.jar}"/>
  291. </and>
  292. <isset property="disconnected"/>
  293. </or>
  294. </condition>
  295. </target>
  296. <target name="fetch-ooxml-jars" depends="check-ooxml-jars" unless="ooxml.jars.present">
  297. <antcall target="downloadfile">
  298. <param name="sourcefile" value="${ooxml.dom4j.url}"/>
  299. <param name="destfile" value="${ooxml.dom4j.jar}"/>
  300. </antcall>
  301. <antcall target="downloadfile">
  302. <param name="sourcefile" value="${ooxml.xmlbeans.url}"/>
  303. <param name="destfile" value="${ooxml.xmlbeans.jar}"/>
  304. </antcall>
  305. <antcall target="downloadfile">
  306. <param name="sourcefile" value="${ooxml.jsr173.url}"/>
  307. <param name="destfile" value="${ooxml.jsr173.jar}"/>
  308. </antcall>
  309. <antcall target="downloadfile">
  310. <param name="sourcefile" value="${ooxml.schemas.url}"/>
  311. <param name="destfile" value="${ooxml.schemas.jar}"/>
  312. </antcall>
  313. </target>
  314. <target name="check-ooxml-xsds">
  315. <condition property="ooxml-xsds.present">
  316. <or>
  317. <and>
  318. <available file="${ooxml.xsds.izip}"/>
  319. </and>
  320. <isset property="disconnected"/>
  321. </or>
  322. </condition>
  323. </target>
  324. <target name="fetch-ooxml-xsds" unless="ooxml-xsds.present"
  325. description="Fetches needed OOXML xsd files from the Internet">
  326. <get src="${ooxml.xsds.url}" dest="${ooxml.xsds.ozip}"/>
  327. <unzip src="${ooxml.xsds.ozip}" dest="${ooxml.lib}">
  328. <patternset>
  329. <include name="OfficeOpenXML-XMLSchema.zip" />
  330. </patternset>
  331. </unzip>
  332. </target>
  333. <target name="check-compiled-ooxml-xsds">
  334. <condition property="ooxml-compiled-xsds.present">
  335. <or>
  336. <and>
  337. <available file="${ooxml.xsds.jar}"/>
  338. </and>
  339. <isset property="disconnected"/>
  340. </or>
  341. </condition>
  342. </target>
  343. <target name="compile-ooxml-xsds" unless="ooxml-compiled-xsds.present"
  344. depends="check-jars,fetch-jars"
  345. description="Unpacks the OOXML xsd files, and compiles them into XmlBeans">
  346. <taskdef name="xmlbean"
  347. classname="org.apache.xmlbeans.impl.tool.XMLBean"
  348. classpath="${ooxml.jar2.dir}:${ooxml.jar3.dir}:${ooxml.jar4.dir}:${ooxml.jar4.dir}:${ooxml.jar5.dir}" />
  349. <unzip src="${ooxml.xsds.izip}" dest="build/ooxml-xsds/" />
  350. <!--
  351. schema="build/ooxml-xsds/"
  352. schema="build/ooxml-xsds/sml-workbook.xsd"
  353. -->
  354. <xmlbean
  355. schema="build/ooxml-xsds/"
  356. destfile="${ooxml.xsds.jar}"
  357. javasource="1.4"
  358. failonerror="true"
  359. fork="true"
  360. memoryMaximumSize="512m"
  361. >
  362. <classpath refid="ooxml.classpath"/>
  363. </xmlbean>
  364. </target>
  365. <target name="compile" depends="init, compile-main,
  366. compile-scratchpad, compile-contrib, compile-examples, compile-scratchpad-examples"
  367. description="Compiles the POI main classes, scratchpad, contrib, examples, and scratchpad examples"/>
  368. <target name="compile-main">
  369. <copy todir="${main.output.dir}">
  370. <fileset dir="${main.resource1.dir}"/>
  371. </copy>
  372. <javac target="${jdk.version.class}" source="${jdk.version.source}"
  373. failonerror="true" destdir="${main.output.dir}" debug="on" fork="yes">
  374. <src path="${main.src}" />
  375. <classpath refid="main.classpath"/>
  376. </javac>
  377. <javac target="${jdk.version.class}" source="${jdk.version.source}"
  378. failonerror="true" destdir="${main.output.test.dir}" debug="on"
  379. fork="yes" srcdir="${main.src.test}">
  380. <classpath>
  381. <path refid="main.classpath"/>
  382. <pathelement path="${main.output.dir}"/>
  383. <pathelement location="${junit.jar1.dir}"/>
  384. </classpath>
  385. </javac>
  386. </target>
  387. <target name="compile-scratchpad" depends="init,compile-main">
  388. <javac target="${jdk.version.class}" source="${jdk.version.source}"
  389. failonerror="true" destdir="${scratchpad.output.dir}" debug="on"
  390. fork="yes" srcdir="${scratchpad.src}">
  391. <classpath refid="scratchpad.classpath"/>
  392. </javac>
  393. <javac target="${jdk.version.class}" source="${jdk.version.source}"
  394. failonerror="true" destdir="${scratchpad.output.test.dir}" debug="on"
  395. fork="yes" srcdir="${scratchpad.src.test}">
  396. <classpath>
  397. <path refid="scratchpad.classpath"/>
  398. <pathelement location="${main.output.test.dir}"/>
  399. <pathelement location="${scratchpad.output.dir}"/>
  400. <pathelement location="${junit.jar1.dir}"/>
  401. </classpath>
  402. </javac>
  403. <!-- Copy HSLF Resources over -->
  404. <property name="hslf.data" value="org/apache/poi/hslf/data" />
  405. <mkdir dir="${scratchpad.output.dir}/${hslf.data}" />
  406. <copy todir="${scratchpad.output.dir}/${hslf.data}">
  407. <fileset dir="${scratchpad.src}/${hslf.data}">
  408. <include name="*.ppt" />
  409. </fileset>
  410. </copy>
  411. <!-- Copy HDGF Resources over -->
  412. <copy todir="${scratchpad.output.dir}">
  413. <fileset dir="${scratchpad.resource1.dir}"/>
  414. </copy>
  415. </target>
  416. <target name="compile-contrib" depends="init">
  417. <javac target="${jdk.version.class}" source="${jdk.version.source}"
  418. failonerror="true" destdir="${contrib.output.dir}" debug="on" fork="yes"
  419. srcdir="${contrib.src}">
  420. <classpath refid="contrib.classpath"/>
  421. </javac>
  422. <javac target="${jdk.version.class}" source="${jdk.version.source}"
  423. failonerror="true" destdir="${contrib.output.test.dir}" debug="on"
  424. fork="yes" srcdir="${contrib.src.test}">
  425. <classpath>
  426. <path refid="contrib.classpath"/>
  427. <pathelement path="${contrib.output.dir}"/>
  428. <pathelement location="${junit.jar1.dir}"/>
  429. </classpath>
  430. </javac>
  431. </target>
  432. <target name="compile-examples" depends="init,compile-ooxml">
  433. <javac target="${jdk.version.class}" source="${jdk.version.source}"
  434. failonerror="true" destdir="${examples.output.dir}" debug="on" fork="yes"
  435. srcdir="${examples.src}">
  436. <classpath>
  437. <path refid="examples.classpath"/>
  438. <path refid="ooxml.classpath"/>
  439. <pathelement path="${ooxml.output.dir}"/>
  440. <pathelement location="${junit.jar1.dir}"/>
  441. </classpath>
  442. </javac>
  443. </target>
  444. <target name="compile-scratchpad-examples" depends="init,compile-ooxml">
  445. <javac target="${jdk.version.class}" source="${jdk.version.source}"
  446. failonerror="true" destdir="${scratchpad.examples.output.dir}" debug="on" fork="yes"
  447. srcdir="${scratchpad.examples.src}">
  448. <classpath>
  449. <path refid="examples.classpath"/>
  450. <path refid="ooxml.classpath"/>
  451. <pathelement path="${ooxml.output.dir}"/>
  452. <pathelement location="${junit.jar1.dir}"/>
  453. </classpath>
  454. </javac>
  455. </target>
  456. <target name="compile-ooxml" depends="init, compile-main, compile-scratchpad">
  457. <javac target="1.5" source="1.5"
  458. destdir="${ooxml.output.dir}" debug="on" srcdir="${ooxml.src}">
  459. <classpath refid="ooxml.classpath"/>
  460. </javac>
  461. <javac target="1.5" source="1.5"
  462. failonerror="true" destdir="${ooxml.output.test.dir}" debug="on"
  463. fork="yes" srcdir="${ooxml.src.test}">
  464. <classpath>
  465. <path refid="ooxml.classpath"/>
  466. <pathelement path="${ooxml.output.dir}"/>
  467. <pathelement path="${main.output.test.dir}"/>
  468. <pathelement path="${scratchpad.output.test.dir}"/>
  469. <pathelement location="${junit.jar1.dir}"/>
  470. </classpath>
  471. </javac>
  472. </target>
  473. <target name="compile-version" depends="init"
  474. description="Compiles the version class">
  475. <!-- Generate the .java file -->
  476. <property name="version.java" value="${main.output.dir}/org/apache/poi/Version.java" />
  477. <delete file="${version.java}" />
  478. <copy
  479. file="src/resources/version/Version.java.template"
  480. tofile="${version.java}">
  481. <filterset>
  482. <filter token="VERSION" value="${version.id}" />
  483. <filter token="DSTAMP" value="${DSTAMP}" />
  484. </filterset>
  485. </copy>
  486. <!-- Compile -->
  487. <javac target="${jdk.version.class}" source="${jdk.version.source}"
  488. failonerror="true" destdir="${main.output.dir}" debug="on" fork="yes"
  489. srcdir="${main.output.dir}" />
  490. <!-- Tidy up -->
  491. <delete file="${version.java}" />
  492. </target>
  493. <target name="test" depends="compile,test-main,test-scratchpad,test-contrib,test-ooxml"
  494. description="Tests main, contrib, scratchpad and ooxml"/>
  495. <target name="-test-main-check">
  496. <uptodate property="main.test.notRequired" targetfile="${main.testokfile}">
  497. <srcfiles dir="${main.src}"/>
  498. <srcfiles dir="${main.src.test}"/>
  499. <srcfiles dir="${ooxml.src}"/>
  500. </uptodate>
  501. </target>
  502. <target name="test-main" unless="main.test.notRequired"
  503. depends="compile-main, -test-main-check">
  504. <junit fork="yes" forkmode="once" printsummary="yes" haltonfailure="${halt.on.test.failure}"
  505. failureproperty="main.test.failed" showoutput="true">
  506. <classpath refid="test.classpath"/>
  507. <sysproperty key="user.language" value="en"/>
  508. <sysproperty key="user.country" value="US"/>
  509. <sysproperty key="POI.testdata.path" file="${poi.test.dir}"/>
  510. <sysproperty key="java.awt.headless" value="true"/>
  511. <formatter type="plain"/>
  512. <formatter type="xml"/>
  513. <batchtest todir="${main.reports.test}">
  514. <fileset dir="${main.src.test}">
  515. <include name="**/Test*.java"/>
  516. <exclude name="**/All*Tests.java"/>
  517. <exclude name="**/TestUnfixedBugs.java"/>
  518. <exclude name="**/TestcaseRecordInputStream.java"/>
  519. </fileset>
  520. </batchtest>
  521. </junit>
  522. <delete file="${main.testokfile}"/>
  523. <antcall target="-test-main-write-testfile"/>
  524. </target>
  525. <target name="test-fail" depends="compile-main"
  526. description="run tests that are known to fail">
  527. <junit printsummary="yes" showoutput="true" filtertrace="no"
  528. haltonfailure="false">
  529. <classpath refid="test.classpath"/>
  530. <classpath>
  531. <path refid="scratchpad.classpath"/>
  532. <pathelement location="${main.output.dir}"/>
  533. <pathelement location="${scratchpad.output.dir}"/>
  534. <pathelement location="${scratchpad.output.test.dir}"/>
  535. <pathelement location="${junit.jar1.dir}"/>
  536. </classpath>
  537. <sysproperty key="user.language" value="en"/>
  538. <sysproperty key="user.country" value="US"/>
  539. <sysproperty key="POI.testdata.path" file="${poi.test.dir}"/>
  540. <sysproperty key="java.awt.headless" value="true"/>
  541. <formatter type="plain" usefile="no"/>
  542. <batchtest todir="${main.reports.test}">
  543. <fileset dir="${main.src.test}">
  544. <include name="**/TestEmptyDocument.java"/>
  545. <include name="**/TestUnfixedBugs.java"/>
  546. </fileset>
  547. </batchtest>
  548. </junit>
  549. </target>
  550. <target name="single-test" depends="-test-property-check,compile-main" description="Runs a single test case specified with -Dtestcase=classname">
  551. <junit printsummary="yes" showoutput="true" filtertrace="no" haltonfailure="false" >
  552. <classpath refid="test.classpath"/>
  553. <classpath>
  554. <path refid="test.classpath"/>
  555. <pathelement location="${main.output.dir}"/>
  556. <pathelement location="${scratchpad.output.dir}"/>
  557. <pathelement location="${scratchpad.output.test.dir}"/>
  558. <pathelement location="${junit.jar1.dir}"/>
  559. </classpath>
  560. <sysproperty key="user.language" value="en"/>
  561. <sysproperty key="user.country" value="US"/>
  562. <sysproperty key="POI.testdata.path" file="${poi.test.dir}"/>
  563. <sysproperty key="java.awt.headless" value="true"/>
  564. <formatter type="plain" usefile="no"/>
  565. <formatter type="xml"/>
  566. <test name="${testcase}"/>
  567. </junit>
  568. </target>
  569. <target name="-test-property-check" unless="testcase">
  570. <echo message="Please use -Dtestcase=org.your.testcase to run a single test"/>
  571. <fail/>
  572. </target>
  573. <target name="-test-main-write-testfile" unless="main.test.failed">
  574. <echo file="${main.testokfile}" append="false" message="testok"/>
  575. </target>
  576. <target name="-test-scratchpad-check">
  577. <uptodate property="scratchpad.test.notRequired" targetfile="${scratchpad.testokfile}">
  578. <srcfiles dir="${scratchpad.src}"/>
  579. <srcfiles dir="${scratchpad.src.test}"/>
  580. </uptodate>
  581. </target>
  582. <target name="test-scratchpad" depends="compile-main,compile-scratchpad,-test-scratchpad-check" unless="scratchpad.test.notRequired">
  583. <junit printsummary="yes" fork="yes" forkmode="once" haltonfailure="${halt.on.test.failure}" failureproperty="scratchpad.test.failed">
  584. <classpath>
  585. <path refid="scratchpad.classpath"/>
  586. <pathelement location="${main.output.dir}"/>
  587. <pathelement location="${main.output.test.dir}"/>
  588. <pathelement location="${scratchpad.output.dir}"/>
  589. <pathelement location="${scratchpad.output.test.dir}"/>
  590. <pathelement location="${junit.jar1.dir}"/>
  591. </classpath>
  592. <sysproperty key="user.language" value="en"/>
  593. <sysproperty key="user.country" value="US"/>
  594. <sysproperty key="POI.testdata.path" file="${poi.test.dir}"/>
  595. <sysproperty key="java.awt.headless" value="true"/>
  596. <formatter type="plain"/>
  597. <formatter type="xml"/>
  598. <batchtest todir="${scratchpad.reports.test}">
  599. <fileset dir="${scratchpad.src.test}">
  600. <include name="**/Test*.java"/>
  601. <exclude name="**/AllTests.java"/>
  602. </fileset>
  603. </batchtest>
  604. </junit>
  605. <delete file="${scratchpad.testokfile}"/>
  606. <antcall target="-test-scratchpad-write-testfile"/>
  607. </target>
  608. <target name="-test-scratchpad-write-testfile" unless="scratchpad.test.failed">
  609. <echo file="${scratchpad.testokfile}" append="false" message="testok"/>
  610. </target>
  611. <target name="single-scratchpad-test" depends="compile-scratchpad,-test-property-check" description="Runs a single test case specified with -Dtestcase=classname">
  612. <junit printsummary="yes" showoutput="true" filtertrace="no" haltonfailure="false" >
  613. <classpath refid="test.classpath"/>
  614. <classpath>
  615. <path refid="scratchpad.classpath"/>
  616. <pathelement location="${main.output.dir}"/>
  617. <pathelement location="${scratchpad.output.dir}"/>
  618. <pathelement location="${scratchpad.output.test.dir}"/>
  619. <pathelement location="${junit.jar1.dir}"/>
  620. </classpath>
  621. <sysproperty key="user.language" value="en"/>
  622. <sysproperty key="user.country" value="US"/>
  623. <sysproperty key="POI.testdata.path" file="${poi.test.dir}"/>
  624. <sysproperty key="java.awt.headless" value="true"/>
  625. <sysproperty key="java.awt.headless" value="true"/>
  626. <formatter type="plain" usefile="no"/>
  627. <formatter type="xml"/>
  628. <test name="${testcase}"/>
  629. </junit>
  630. </target>
  631. <target name="-test-contrib-check">
  632. <uptodate property="contrib.test.notRequired" targetfile="${contrib.testokfile}">
  633. <srcfiles dir="${contrib.src}"/>
  634. <srcfiles dir="${contrib.src.test}"/>
  635. </uptodate>
  636. </target>
  637. <target name="test-contrib" depends="compile-main,compile-contrib,-test-contrib-check" unless="contrib.test.notRequired">
  638. <junit printsummary="yes" fork="yes" haltonfailure="${halt.on.test.failure}" failureproperty="contrib.test.failed">
  639. <classpath>
  640. <path refid="contrib.classpath"/>
  641. <pathelement location="${main.output.dir}"/>
  642. <pathelement location="${contrib.output.dir}"/>
  643. <pathelement location="${contrib.output.test.dir}"/>
  644. <pathelement location="${junit.jar1.dir}"/>
  645. </classpath>
  646. <sysproperty key="user.language" value="en"/>
  647. <sysproperty key="user.country" value="US"/>
  648. <sysproperty key="java.awt.headless" value="true"/>
  649. <formatter type="plain"/>
  650. <formatter type="xml"/>
  651. <batchtest todir="${contrib.reports.test}">
  652. <fileset dir="${contrib.src.test}">
  653. <include name="**/Test*.java"/>
  654. <exclude name="**/AllTests.java"/>
  655. </fileset>
  656. </batchtest>
  657. </junit>
  658. <delete file="${contrib.testokfile}"/>
  659. <antcall target="-test-contrib-write-testfile"/>
  660. </target>
  661. <target name="-test-contrib-write-testfile" unless="contrib.test.failed">
  662. <echo file="${contrib.testokfile}" append="false" message="testok"/>
  663. </target>
  664. <target name="-test-ooxml-check">
  665. <uptodate property="ooxml.test.notRequired" targetfile="${ooxml.testokfile}">
  666. <srcfiles dir="${ooxml.src}"/>
  667. <srcfiles dir="${ooxml.src.test}"/>
  668. </uptodate>
  669. </target>
  670. <target name="test-ooxml" depends="compile-main,compile-ooxml,-test-ooxml-check" unless="ooxml.test.notRequired">
  671. <junit printsummary="yes" fork="yes" forkmode="once" haltonfailure="${halt.on.test.failure}" failureproperty="ooxml.test.failed">
  672. <classpath refid="test.ooxml.classpath" />
  673. <sysproperty key="user.language" value="en"/>
  674. <sysproperty key="user.country" value="US"/>
  675. <sysproperty key="POI.testdata.path" file="${poi.test.dir}"/>
  676. <sysproperty key="java.awt.headless" value="true"/>
  677. <formatter type="plain"/>
  678. <formatter type="xml"/>
  679. <batchtest todir="${ooxml.reports.test}">
  680. <fileset dir="${ooxml.src.test}">
  681. <include name="**/Test*.java"/>
  682. <exclude name="**/All*Tests.java"/>
  683. </fileset>
  684. </batchtest>
  685. </junit>
  686. <delete file="${ooxml.testokfile}"/>
  687. <antcall target="-test-ooxml-write-testfile"/>
  688. </target>
  689. <target name="-test-ooxml-write-testfile" unless="ooxml.test.failed">
  690. <echo file="${ooxml.testokfile}" append="false" message="testok"/>
  691. </target>
  692. <target name="single-test-ooxml" depends="-test-property-check,compile-main,compile-ooxml" description="Runs a single ooxml test case specified with -Dtestcase=classname">
  693. <junit printsummary="yes" showoutput="true" filtertrace="no" haltonfailure="false" >
  694. <classpath refid="test.ooxml.classpath" />
  695. <sysproperty key="user.language" value="en"/>
  696. <sysproperty key="user.country" value="US"/>
  697. <sysproperty key="POI.testdata.path" file="${poi.test.dir}"/>
  698. <sysproperty key="java.awt.headless" value="true"/>
  699. <formatter type="plain" usefile="no"/>
  700. <formatter type="xml"/>
  701. <test name="${testcase}"/>
  702. </junit>
  703. </target>
  704. <target name="-check-docs">
  705. <uptodate property="main.docs.notRequired" targetfile="${build.site}/index.html">
  706. <srcfiles dir="${build.site.src}"/>
  707. </uptodate>
  708. </target>
  709. <target name="-check-forrest-installed" unless="env.FORREST_HOME">
  710. <echo>Please install Apache Forrest (see
  711. &lt;http://xml.apache.org/forrest/index.html&gt;) and set the
  712. FORREST_HOME environment variable!</echo>
  713. <fail message="Apache Forrest is not installed."/>
  714. </target>
  715. <!-- <target name="check-docs">-->
  716. <!-- <uptodate property="main.docs.notRequired" targetfile="${build.site}/index.html" >-->
  717. <!-- <srcfiles dir= "${build.site.src}"/>-->
  718. <!-- </uptodate>-->
  719. <!-- </target>-->
  720. <target name="docs" depends="init, -check-forrest-installed, -check-docs"
  721. unless="main.docs.notRequired" description="Builds the POI website">
  722. <mkdir dir="${build.site.src}/src/documentation/content/apidocs"/>
  723. <copy todir="${build.site.src}/src/documentation/content/apidocs">
  724. <fileset dir="${apidocs.report.dir}"/>
  725. </copy>
  726. <copy
  727. tofile="${build.site.src}/src/documentation/content/jdepend.ehtml"
  728. file="${jdepend.report.dir}/index.html" failonerror="false"/>
  729. <mkdir dir="${build.site.src}/src/documentation/content/junit"/>
  730. <copy todir="${build.site.src}/src/documentation/content/junit">
  731. <fileset dir="${junit.report.dir}"/>
  732. </copy>
  733. <move
  734. file="${build.site.src}/src/documentation/content/xdocs/status.xml"
  735. tofile="${build.site.src}/status.xml"/>
  736. <ant antfile="${forrest.home}/forrest.antproxy.xml" target="site">
  737. <property name="project.home" location="${build.site.src}"/>
  738. </ant>
  739. <echo>Broken links:</echo>
  740. <echo file="${build.site}/../tmp/brokenlinks.txt"/>
  741. <touch>
  742. <fileset dir="${build.site}"/>
  743. </touch>
  744. </target>
  745. <!-- Checks whether reports are required to be run. If nothing has changed then they dont. -->
  746. <target name="-check-reports">
  747. <condition property="reports.notRequired">
  748. <and>
  749. <equals arg1="${main.test.notRequired}" arg2="true"/>
  750. <equals arg1="${scratchpad.test.notRequired}" arg2="true"/>
  751. <equals arg1="${contrib.test.notRequired}" arg2="true"/>
  752. </and>
  753. </condition>
  754. </target>
  755. <!-- Creates reports and API documentation -->
  756. <target name="reports" unless="reports.notRequired" depends="-check-reports,
  757. fail-unless-jdepend-is-available, test-ignore-failures, junitreport,
  758. jdepend, javadocs, clover.html"
  759. description="Creates various reports and the API documentation">
  760. </target>
  761. <!-- Runs all JUnit tests without aborting if one of the tests fails. -->
  762. <target name="test-ignore-failures" depends="init">
  763. <antcall target="test">
  764. <param name="halt.on.test.failure" value="false"/>
  765. </antcall>
  766. </target>
  767. <!-- Produces a report of the JUnit test results -->
  768. <target name="junitreport"
  769. depends="test-ignore-failures"
  770. description="Produces a report of the JUnit test results">
  771. <junitreport todir="${junit.report.dir}">
  772. <fileset dir="${main.reports.test}">
  773. <include name="TEST-*.xml"/>
  774. </fileset>
  775. <fileset dir="${scratchpad.reports.test}">
  776. <include name="TEST-*.xml"/>
  777. </fileset>
  778. <fileset dir="${contrib.reports.test}">
  779. <include name="TEST-*.xml"/>
  780. </fileset>
  781. <report format="frames" todir="${junit.report.dir}"/>
  782. </junitreport>
  783. </target>
  784. <!-- Generates the API documentation. -->
  785. <target name="javadocs" depends="init"
  786. description="Generates the API documentation">
  787. <javadoc verbose="false" author="true" destdir="${apidocs.report.dir}"
  788. windowtitle="POI API Documentation" use="true" version="true" maxmemory="256M">
  789. <packageset dir="${main.src}" defaultexcludes="yes">
  790. <include name="org/apache/poi/**"/>
  791. </packageset>
  792. <packageset dir="${scratchpad.src}" defaultexcludes="yes">
  793. <include name="org/apache/poi/**"/>
  794. <exclude name="org/apache/poi/hdf/**"/>
  795. </packageset>
  796. <packageset dir="${contrib.src}" defaultexcludes="yes">
  797. <include name="org/apache/poi/**"/>
  798. </packageset>
  799. <packageset dir="${ooxml.src}" defaultexcludes="yes">
  800. <include name="org/apache/poi/**"/>
  801. </packageset>
  802. <classpath id="javadoc.classpath">
  803. <path refid="main.classpath"/>
  804. <path refid="scratchpad.classpath"/>
  805. <path refid="contrib.classpath"/>
  806. <path refid="ooxml.classpath"/>
  807. <path path="${env.CLASSPATH}"/>
  808. </classpath>
  809. <doctitle><![CDATA[<h1>POI API Documentation</h1>]]></doctitle>
  810. <bottom>
  811. <![CDATA[<i>Copyright ${tstamp.year} The Apache Software Foundation or
  812. its licensors, as applicable.</i>]]>
  813. </bottom>
  814. <group>
  815. <title>DDF - Dreadful Drawing Format</title>
  816. <package name="org.apache.poi.ddf*"/>
  817. </group>
  818. <group>
  819. <title>HPSF - Horrible Property Set Format</title>
  820. <package name="org.apache.poi.hpsf*"/>
  821. </group>
  822. <group>
  823. <title>HSSF - Horrible Spreadsheet Format</title>
  824. <package name="org.apache.poi.hssf*"/>
  825. </group>
  826. <group>
  827. <title>HWPF - Horrible Word Processor Format</title>
  828. <package name="org.apache.poi.hwpf*"/>
  829. </group>
  830. <group>
  831. <title>POIFS - POI File System</title>
  832. <package name="org.apache.poi.poifs*"/>
  833. </group>
  834. <group>
  835. <title>Utilities</title>
  836. <package name="org.apache.poi.util*"/>
  837. </group>
  838. <group>
  839. <title>Examples</title>
  840. <package name="org.apache.poi.hpsf.examples*"/>
  841. <package name="org.apache.poi.hssf.usermodel.examples*"/>
  842. </group>
  843. </javadoc>
  844. <antcall target="clover.html"/>
  845. </target>
  846. <!-- Generates documentation and reports -->
  847. <target name="site" depends="reports, docs"
  848. description="Generates POI's website's contents"/>
  849. <target name="maven-poms" depends="jar" description="Builds the POM files for a maven distribution, and copies these and the jars to the appropriate locations">
  850. <!-- TODO: Decide about source jars, and copy them if we have some -->
  851. <!-- Build the org.apache.poi poms -->
  852. <copy file="maven/poi.pom" tofile="${dist.dir}/poi-${version.id}.pom">
  853. <filterchain>
  854. <replacetokens>
  855. <token key="VERSION" value="${version.id}" />
  856. </replacetokens>
  857. </filterchain>
  858. </copy>
  859. <copy file="maven/poi-contrib.pom" tofile="${dist.dir}/poi-contrib-${version.id}.pom">
  860. <filterchain>
  861. <replacetokens>
  862. <token key="VERSION" value="${version.id}" />
  863. </replacetokens>
  864. </filterchain>
  865. </copy>
  866. <copy file="maven/poi-scratchpad.pom" tofile="${dist.dir}/poi-scratchpad-${version.id}.pom">
  867. <filterchain>
  868. <replacetokens>
  869. <token key="VERSION" value="${version.id}" />
  870. </replacetokens>
  871. </filterchain>
  872. </copy>
  873. <copy file="maven/poi-ooxml.pom" tofile="${dist.dir}/poi-ooxml-${version.id}.pom">
  874. <filterchain>
  875. <replacetokens>
  876. <token key="VERSION" value="${version.id}" />
  877. </replacetokens>
  878. </filterchain>
  879. </copy>
  880. <copy file="maven/mvn-deploy.sh" todir="${dist.dir}">
  881. <filterchain>
  882. <replacetokens>
  883. <token key="REPOSITORY" value="${apache.repository}" />
  884. <token key="VERSION" value="${version.id}" />
  885. <token key="DSTAMP" value="${DSTAMP}" />
  886. </replacetokens>
  887. </filterchain>
  888. </copy>
  889. </target>
  890. <target name="maven-ooxml-dependencies" description="Builds the POM files for the compiled XmlBeans generated from the Ecma supplied xsds">
  891. <!-- ooxml-schemas -->
  892. <copy file="${ooxml.xsds.jar}" tofile="${mavendist.ooxml.dir}/org.apache.poi/jars/${maven.ooxml.xsds.jar}" />
  893. <copy file="maven/ooxml-schemas.pom" tofile="${mavendist.ooxml.dir}/org.apache.poi/poms/ooxml-schemas-${maven.ooxml.xsds.version.id}.pom">
  894. <filterchain>
  895. <replacetokens>
  896. <token key="VERSION" value="${maven.ooxml.xsds.version.id}" />
  897. </replacetokens>
  898. </filterchain>
  899. </copy>
  900. </target>
  901. <target name="jar" depends="compile, compile-version" description="Creates jar files for distribution">
  902. <jar destfile="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar">
  903. <fileset dir="${main.output.dir}" />
  904. <fileset dir="legal/" />
  905. <manifest>
  906. <attribute name="Built-By" value="${user.name}"/>
  907. <attribute name="Specification-Title" value="Apache POI"/>
  908. <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
  909. <attribute name="Specification-Vendor" value="Apache"/>
  910. <attribute name="Implementation-Title" value="Apache POI"/>
  911. <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
  912. <attribute name="Implementation-Vendor" value="Apache"/>
  913. </manifest>
  914. </jar>
  915. <jar destfile="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar">
  916. <fileset dir="${contrib.output.dir}" />
  917. <fileset dir="legal/" />
  918. <manifest>
  919. <attribute name="Built-By" value="${user.name}"/>
  920. <attribute name="Specification-Title" value="Apache POI"/>
  921. <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
  922. <attribute name="Specification-Vendor" value="Apache"/>
  923. <attribute name="Implementation-Title" value="Apache POI"/>
  924. <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
  925. <attribute name="Implementation-Vendor" value="Apache"/>
  926. </manifest>
  927. </jar>
  928. <jar destfile="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar">
  929. <fileset dir="${scratchpad.output.dir}" />
  930. <fileset dir="legal/" />
  931. <manifest>
  932. <attribute name="Built-By" value="${user.name}"/>
  933. <attribute name="Specification-Title" value="Apache POI"/>
  934. <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
  935. <attribute name="Specification-Vendor" value="Apache"/>
  936. <attribute name="Implementation-Title" value="Apache POI"/>
  937. <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
  938. <attribute name="Implementation-Vendor" value="Apache"/>
  939. </manifest>
  940. </jar>
  941. <jar destfile="${dist.dir}/${jar.name}-ooxml-${version.id}-${DSTAMP}.jar">
  942. <fileset dir="${ooxml.output.dir}" />
  943. <fileset dir="legal/" />
  944. <manifest>
  945. <attribute name="Built-By" value="${user.name}"/>
  946. <attribute name="Specification-Title" value="Apache POI"/>
  947. <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
  948. <attribute name="Specification-Vendor" value="Apache"/>
  949. <attribute name="Implementation-Title" value="Apache POI"/>
  950. <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
  951. <attribute name="Implementation-Vendor" value="Apache"/>
  952. </manifest>
  953. </jar>
  954. </target>
  955. <target name="jar-examples" depends="compile, compile-version" description="Creates a jar file of the examples, in case people want to use them as-is">
  956. <jar destfile="${dist.dir}/${jar.name}-examples-${version.id}-${DSTAMP}.jar">
  957. <fileset dir="${examples.output.dir}" />
  958. <fileset dir="legal/" />
  959. <manifest>
  960. <attribute name="Built-By" value="${user.name}"/>
  961. <attribute name="Specification-Title" value="Apache POI"/>
  962. <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
  963. <attribute name="Specification-Vendor" value="Apache"/>
  964. <attribute name="Implementation-Title" value="Apache POI"/>
  965. <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
  966. <attribute name="Implementation-Vendor" value="Apache"/>
  967. </manifest>
  968. </jar>
  969. </target>
  970. <target name="dist" depends="clean, fail-unless-tools-are-available, compile, site, jar"
  971. description="Creates the entire distribution into build/dist, from scratch">
  972. <property name="zipdir" value="${jar.name}-${version.id}" />
  973. <zip destfile="${dist.dir}/${jar.name}-bin-${version.id}-${DSTAMP}.zip">
  974. <zipfileset dir="legal/" prefix="${zipdir}" />
  975. <zipfileset dir="lib/" prefix="${zipdir}/lib" />
  976. <zipfileset dir="ooxml-lib/" prefix="${zipdir}/ooxml-lib">
  977. <exclude name="*.zip"/>
  978. </zipfileset>
  979. <zipfileset dir="${build.site}" prefix="${zipdir}/docs"/>
  980. <zipfileset file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
  981. <zipfileset file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
  982. <zipfileset file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
  983. <zipfileset file="${dist.dir}/${jar.name}-ooxml-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
  984. </zip>
  985. <zip destfile="${dist.dir}/${jar.name}-src-${version.id}-${DSTAMP}.zip">
  986. <zipfileset dir="legal/" prefix="${zipdir}" />
  987. <zipfileset dir="${build.site}" prefix="${zipdir}/docs"/>
  988. <zipfileset dir="." prefix="${zipdir}">
  989. <exclude name="build/**"/>
  990. <exclude name="scripts/**"/>
  991. <exclude name="TEST*"/>
  992. <exclude name="*.ipr"/>
  993. <exclude name="*.iml"/>
  994. <exclude name="*.iws"/>
  995. <exclude name="*.swp"/>
  996. <exclude name=".classpath"/>
  997. <exclude name=".project"/>
  998. </zipfileset>
  999. </zip>
  1000. <tar destfile="${dist.dir}/${jar.name}-bin-${version.id}-${DSTAMP}.tar.gz"
  1001. compression="gzip">
  1002. <tarfileset dir="legal/" prefix="${zipdir}" />
  1003. <tarfileset dir="lib/" prefix="${zipdir}/lib" />
  1004. <tarfileset dir="ooxml-lib/" prefix="${zipdir}/ooxml-lib">
  1005. <exclude name="*.zip"/>
  1006. </tarfileset>
  1007. <tarfileset dir="${build.site}" prefix="${zipdir}/docs"/>
  1008. <tarfileset file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
  1009. <tarfileset file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
  1010. <tarfileset file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
  1011. <tarfileset file="${dist.dir}/${jar.name}-ooxml-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
  1012. </tar>
  1013. <tar destfile="${dist.dir}/${jar.name}-src-${version.id}-${DSTAMP}.tar.gz"
  1014. compression="gzip">
  1015. <tarfileset dir="legal/" prefix="${zipdir}" />
  1016. <tarfileset dir="${build.site}" prefix="${zipdir}/docs"/>
  1017. <tarfileset dir="." prefix="${zipdir}">
  1018. <exclude name="build/**"/>
  1019. <exclude name="scripts/**"/>
  1020. <exclude name="TEST*"/>
  1021. <exclude name="*.ipr"/>
  1022. <exclude name="*.iml"/>
  1023. <exclude name="*.iws"/>
  1024. <exclude name="*.swp"/>
  1025. <exclude name=".classpath"/>
  1026. <exclude name=".project"/>
  1027. </tarfileset>
  1028. </tar>
  1029. <echo>Creating Maven POMs</echo>
  1030. <antcall target="maven-poms"/>
  1031. <echo>Distribution located in build/dist</echo>
  1032. </target>
  1033. <target name="clean-compile" depends="clean, compile"/>
  1034. <target name="clean-dist" depends="clean, dist"
  1035. description="Cleans the build directory then creates a distribution"/>
  1036. <target name="gump" depends="test, jar"/>
  1037. <!-- Generates the Ant document type definition (DTD) -->
  1038. <target name="dtd"
  1039. description="Generates the Ant document type definition (DTD)">
  1040. <antstructure output="ant.dtd"/>
  1041. </target>
  1042. <!-- Abort the build if JDepend is missing. -->
  1043. <target name="fail-unless-jdepend-is-available" depends="init">
  1044. <condition property="isAvailable.jdepend">
  1045. <available classname="jdepend.framework.JDepend"/>
  1046. </condition>
  1047. <antcall target="fail-jdepend"/>
  1048. </target>
  1049. <target name="fail-jdepend" unless="isAvailable.jdepend">
  1050. <echo>
  1051. JDepend is not available. You must download JDepend from
  1052. &lt;http://www.clarkware.com/software/JDepend.html&gt; and include the
  1053. JAR file in your classpath.
  1054. </echo>
  1055. <fail message="JDepend is not available."/>
  1056. </target>
  1057. <!-- Aborts the build if any of the required tools are missing. -->
  1058. <target name="fail-unless-tools-are-available"
  1059. depends="fail-unless-jdepend-is-available"/>
  1060. <!-- Runs jdepend to produce a report about package dependencies -->
  1061. <target name="jdepend" depends="fail-unless-jdepend-is-available"
  1062. description="Runs jdepend to produce a report about package dependencies">
  1063. <jdepend outputfile="${jdepend.report.dir}/jdepend.xml" format="xml">
  1064. <classespath>
  1065. <pathelement location="${main.output.dir}"/>
  1066. <pathelement location="${contrib.output.dir}"/>
  1067. <pathelement location="${scratchpad.output.dir}"/>
  1068. </classespath>
  1069. <classpath>
  1070. <path refid="main.classpath"/>
  1071. <path refid="contrib.classpath"/>
  1072. <path refid="scratchpad.classpath"/>
  1073. </classpath>
  1074. </jdepend>
  1075. <style basedir="${jdepend.report.dir}"
  1076. in="${jdepend.report.dir}/jdepend.xml"
  1077. out="${jdepend.report.out.dir}/index.html"
  1078. style="jdepend.xsl"/>
  1079. </target>
  1080. <target name="-require-filename" description="Ensure -Dfilename=... was given">
  1081. <fail unless="filename" message="A filename must be supplied with -Dfilename=, eg -Dfilename=test.xls" />
  1082. </target>
  1083. <!-- These tasks make it easy to run our command line tools, -->
  1084. <!-- without you needing to worry about classpaths etc -->
  1085. <target name="POIFSViewer" depends="compile-main,-require-filename"
  1086. description="Runs poifs.dev.POIFSViewer against the supplied file">
  1087. <java classname="org.apache.poi.poifs.dev.POIFSViewer">
  1088. <arg line="${filename}" />
  1089. <classpath refid="test.classpath"/>
  1090. </java>
  1091. </target>
  1092. <target name="OOXMLLister" depends="compile-ooxml,-require-filename"
  1093. description="Runs dev.OOXMLLister against the supplied file">
  1094. <java classname="org.apache.poi.dev.OOXMLLister">
  1095. <arg line="${filename}" />
  1096. <classpath refid="test.ooxml.classpath"/>
  1097. </java>
  1098. </target>
  1099. <target name="BiffViewer" depends="compile-main,-require-filename"
  1100. description="Runs hssf.dev.BiffViewer against the supplied file">
  1101. <java classname="org.apache.poi.hssf.dev.BiffViewer">
  1102. <arg line="${filename}" />
  1103. <classpath refid="test.classpath"/>
  1104. </java>
  1105. </target>
  1106. </project>
  1107. <!-- Keep this comment at the end of the file
  1108. Local variables:
  1109. mode: xml
  1110. sgml-omittag:nil
  1111. sgml-shorttag:nil
  1112. sgml-namecase-general:nil
  1113. sgml-general-insert-case:lower
  1114. sgml-minimize-attributes:nil
  1115. sgml-always-quote-attributes:t
  1116. sgml-indent-step:2
  1117. sgml-indent-data:t
  1118. sgml-parent-document:nil
  1119. sgml-exposed-tags:nil
  1120. sgml-local-catalogs:nil
  1121. sgml-local-ecat-files:nil
  1122. End:
  1123. -->