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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539
  1. <?xml version="1.0"?>
  2. <!--
  3. Licensed to the Apache Software Foundation (ASF) under one or more
  4. contributor license agreements. See the NOTICE file distributed with
  5. this work for additional information regarding copyright ownership.
  6. The ASF licenses this file to You under the Apache License, Version 2.0
  7. (the "License"); you may not use this file except in compliance with
  8. the License. You may obtain a copy of the License at
  9. http://www.apache.org/licenses/LICENSE-2.0
  10. Unless required by applicable law or agreed to in writing, software
  11. distributed under the License is distributed on an "AS IS" BASIS,
  12. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. See the License for the specific language governing permissions and
  14. limitations under the License.
  15. -->
  16. <!-- ===========================================================================
  17. * ================== *
  18. | FOP build system |
  19. * ================== *
  20. Building instructions
  21. =====================
  22. First, install Ant (http://ant.apache.org). Check that ant or ant.bat
  23. is in your search path and that JAVA_HOME and ANT_HOME are properly set.
  24. Next make sure your current working directory is where this very file is
  25. located. Then type
  26. ant
  27. If everything is right and all the required packages are visible, this action
  28. will generate a file called "fop.jar" in the "./build" directory.
  29. If you experience any problems with the build please visit the FOP website for
  30. more information: http://xmlgraphics.apache.org/fop
  31. Build targets
  32. =============
  33. The build system is not only responsible for compiling Fop into a jar file,
  34. but is also responsible for creating the javadocs, distributions, examples
  35. and a miscellaneous stuff. In fact, the file you have here is _exactly_ what
  36. is used by fop maintainers to take care of nearly everything in the Fop
  37. project, no less and no more.
  38. Call the Ant (see above) with the parameter "-projecthelp" to get a
  39. list of possible build targets.
  40. ============================================================================ -->
  41. <project default="all" basedir="." name="fop">
  42. <!-- See build.properties and build-local.properties for overriding build settings. -->
  43. <!-- build-local.properties is not stored in SVN and overrides values from build.properties -->
  44. <property environment="env"/>
  45. <property file="${basedir}/build-local.properties"/>
  46. <property file="${basedir}/build.properties"/>
  47. <fileset dir="${basedir}" id="dist.bin">
  48. <include name="KEYS"/>
  49. <include name="LICENSE"/>
  50. <include name="NOTICE"/>
  51. <include name="README"/>
  52. <include name="conf/**"/>
  53. <include name="examples/**"/>
  54. <include name="fop"/>
  55. <include name="fop.bat"/>
  56. <include name="fop.cmd"/>
  57. <include name="fop.js"/>
  58. <include name="status.xml"/>
  59. </fileset>
  60. <fileset dir="${basedir}" id="dist.bin.lib">
  61. <patternset id="dist.lib">
  62. <include name="lib/README*"/>
  63. <include name="lib/avalon-framework*"/>
  64. <include name="lib/batik*"/>
  65. <include name="lib/commons-io*"/>
  66. <include name="lib/commons-logging*"/>
  67. <include name="lib/serializer*"/>
  68. <include name="lib/xalan*"/>
  69. <include name="lib/xerces*"/>
  70. <include name="lib/xml-apis*"/>
  71. <include name="lib/xmlgraphics-commons*"/>
  72. </patternset>
  73. </fileset>
  74. <patternset id="dist.src.lib.build">
  75. <include name="lib/build/asm*"/>
  76. <include name="lib/build/hamcrest*"/>
  77. <include name="lib/build/jaxen*"/>
  78. <include name="lib/build/mockito*"/>
  79. <include name="lib/build/objenesis*"/>
  80. <include name="lib/build/pmd*"/>
  81. <include name="lib/build/qdox*"/>
  82. <include name="lib/build/xmlunit*"/>
  83. </patternset>
  84. <fileset dir="${basedir}" id="dist.src">
  85. <include name="KEYS"/>
  86. <include name="LICENSE"/>
  87. <include name="NOTICE"/>
  88. <include name="README"/>
  89. <include name="build.*"/>
  90. <include name="checkstyle*"/>
  91. <exclude name="checkstyle-noframes.xsl"/>
  92. <include name="conf/**"/>
  93. <include name="examples/**"/>
  94. <include name="findbugs*"/>
  95. <include name="fop"/>
  96. <include name="fop.bat"/>
  97. <include name="fop.cmd"/>
  98. <include name="fop.js"/>
  99. <include name="forrest.*"/>
  100. <include name="hyph/hyphenation.dtd"/>
  101. <include name="hyph/readme"/>
  102. <include name="jacoco*"/>
  103. <include name="known-issues.xml"/>
  104. <include name="lib/servlet*"/>
  105. <include name="src/**"/>
  106. <include name="status.xml"/>
  107. <include name="test/**"/>
  108. <patternset refid="dist.lib"/>
  109. <patternset refid="dist.src.lib.build"/>
  110. </fileset>
  111. <path id="libs-build-classpath">
  112. <fileset dir="${basedir}/lib">
  113. <include name="*.jar"/>
  114. </fileset>
  115. </path>
  116. <property name="lib-tools" value="${basedir}/lib/build"/>
  117. <path id="libs-tools-build-classpath">
  118. <path refid="libs-build-classpath"/>
  119. <fileset dir="${lib-tools}">
  120. <include name="*.jar"/>
  121. </fileset>
  122. </path>
  123. <path id="libs-run-classpath">
  124. <path refid="libs-build-classpath"/>
  125. <fileset dir="${basedir}/build">
  126. <include name="fop.jar"/>
  127. <include name="fop-hyph.jar"/>
  128. </fileset>
  129. </path>
  130. <patternset id="exclude-jai">
  131. <exclude name="org/apache/fop/util/bitmap/JAIMonochromeBitmapConverter.java" unless="jai.present"/>
  132. </patternset>
  133. <patternset id="exclude-jce-dependencies">
  134. <exclude name="org/apache/fop/pdf/PDFEncryptionJCE.java" unless="jce.present"/>
  135. </patternset>
  136. <property name="Name" value="Apache FOP"/>
  137. <property name="name" value="fop"/>
  138. <property name="NAME" value="FOP"/>
  139. <property name="version" value="svn-trunk"/>
  140. <property name="year" value="1999-2015"/>
  141. <property name="javac.debug" value="on"/>
  142. <property name="javac.optimize" value="off"/>
  143. <property name="javac.deprecation" value="on"/>
  144. <property name="javac.source" value="1.5"/>
  145. <property name="javac.target" value="1.5"/>
  146. <property name="javac.fork" value="no"/>
  147. <property name="junit.fork" value="yes"/>
  148. <property name="junit.haltonfailure" value="off"/>
  149. <property name="junit.printsummary" value="off"/>
  150. <property name="junit.formatter.brief" value="on"/>
  151. <property name="javadoc.packages" value="org.apache.fop.*"/>
  152. <property name="src.dir" value="${basedir}/src"/>
  153. <property name="src.codegen.dir" value="${src.dir}/codegen"/>
  154. <property name="src.codegen.fonts.dir" value="${src.codegen.dir}/fonts"/>
  155. <property name="src.java.dir" value="${src.dir}/java"/>
  156. <property name="src.sandbox.dir" value="${src.dir}/sandbox"/>
  157. <property name="src.viewer.resources.dir" value="${src.java.dir}/org/apache/fop/render/awt/viewer/resources"/>
  158. <property name="src.viewer.images.dir" value="${src.java.dir}/org/apache/fop/render/awt/viewer/images"/>
  159. <property name="fo.examples.dir" value="${basedir}/examples/fo/basic"/>
  160. <property name="fo.examples.userconfig" value="conf/fop.xconf"/>
  161. <property name="fo.examples.include" value="**/*.fo"/>
  162. <property name="fo.examples.force" value="false"/>
  163. <property name="xml.tests.include" value="**/*.xml"/>
  164. <property name="xml.tests.force" value="false"/>
  165. <property name="xml.tests.userconfig" value="conf/fop.xconf"/>
  166. <property name="lib.dir" value="${basedir}/lib"/>
  167. <property name="user.hyph.dir" value="${basedir}/hyph"/>
  168. <property name="unidata.dir" value="${basedir}/UNIDATA"/>
  169. <property name="hyph.stacksize" value="512k"/>
  170. <property name="test.dir" value="${basedir}/test"/>
  171. <property name="build.dir" value="${basedir}/build"/>
  172. <property name="build.gensrc.dir" value="${build.dir}/gensrc"/>
  173. <property name="build.classes.dir" value="${build.dir}/classes"/>
  174. <property name="build.sandbox-classes.dir" value="${build.dir}/sandbox-classes"/>
  175. <property name="build.codegen-classes.dir" value="${build.dir}/codegen-classes"/>
  176. <property name="build.codegen.fonts.dir" value="${build.gensrc.dir}/org/apache/fop/fonts/"/>
  177. <property name="build.javadocs.dir" value="${build.dir}/javadocs"/>
  178. <property name="build.examples.dir" value="${build.dir}/examples"/>
  179. <property name="build.unit.tests.dir" value="${build.dir}/test-classes"/>
  180. <property name="build.tests.dir" value="${build.dir}/tests"/>
  181. <property name="build.viewer.resources.dir" value="${build.classes.dir}/org/apache/fop/render/awt/viewer/resources"/>
  182. <property name="build.viewer.images.dir" value="${build.classes.dir}/org/apache/fop/render/awt/viewer/images"/>
  183. <property name="build.property.examples.mime.type" value="application/pdf"/>
  184. <property name="build.property.tests.mime.type" value="application/pdf"/>
  185. <property name="dist.bin.dir" value="${basedir}/dist-bin"/>
  186. <property name="dist.src.dir" value="${basedir}/dist-src"/>
  187. <property name="nightly.dir" value="${basedir}/nightly"/>
  188. <property name="dist.bin.result.dir" value="${dist.bin.dir}/${name}-${version}"/>
  189. <property name="dist.src.result.dir" value="${dist.src.dir}/${name}-${version}"/>
  190. <tstamp/>
  191. <property name="nightly.result.dir" value="${nightly.dir}/${name}-${DSTAMP}"/>
  192. <property name="samedir" value="${basedir}"/>
  193. <property name="junit.reports.dir" value="${build.dir}/test-reports"/>
  194. <property name="junit.html.reports.dir" value="${build.dir}/test-reports/html"/>
  195. <!-- Importing Apache Forrest for building the docs -->
  196. <!--
  197. <property environment="env"/>
  198. <property name="forrest.home" value="${env.FORREST_HOME}"/>
  199. <import file="${env.FORREST_HOME}/main/forrest.build.xml" optional="true"/>
  200. -->
  201. <presetdef name="javac">
  202. <javac fork="${javac.fork}"
  203. debug="${javac.debug}"
  204. deprecation="${javac.deprecation}"
  205. optimize="${javac.optimize}"
  206. source="${javac.source}" target="${javac.target}"/>
  207. </presetdef>
  208. <presetdef name="junit">
  209. <junit haltonfailure="${junit.haltonfailure}"
  210. fork="${junit.fork}"
  211. printsummary="${junit.printsummary}"
  212. maxmemory="256m"/>
  213. </presetdef>
  214. <!-- =================================================================== -->
  215. <!-- Initialization target -->
  216. <!-- =================================================================== -->
  217. <target name="init" depends="init-avail">
  218. </target>
  219. <target name="init-avail">
  220. <echo message="------------------- ${Name} ${version} [${year}] ----------------"/>
  221. <echo message="See build.properties and build-local.properties for additional build settings"/>
  222. <echo message="${ant.version}"/>
  223. <echo message="VM: ${java.vm.version}, ${java.vm.vendor}"/>
  224. <echo message="JAVA_HOME: ${env.JAVA_HOME}"/>
  225. <available property="jai.present" classname="javax.media.jai.JAI" classpathref="libs-build-classpath"/>
  226. <condition property="jai.message" value="JAI Support PRESENT">
  227. <equals arg1="${jai.present}" arg2="true"/>
  228. </condition>
  229. <condition property="jai.message" value="JAI Support NOT Present">
  230. <not>
  231. <equals arg1="${jai.present}" arg2="true"/>
  232. </not>
  233. </condition>
  234. <echo message="${jai.message}"/>
  235. <available property="jce.present" classname="javax.crypto.Cipher" classpathref="libs-build-classpath"/>
  236. <condition property="jce.message" value="JCE Support PRESENT">
  237. <equals arg1="${jce.present}" arg2="true"/>
  238. </condition>
  239. <condition property="jce.message" value="JCE Support NOT Present">
  240. <not>
  241. <equals arg1="${jce.present}" arg2="true"/>
  242. </not>
  243. </condition>
  244. <echo message="${jce.message}"/>
  245. <available property="jdk14.present" classname="java.lang.CharSequence"/>
  246. <fail message="${Name} requires at least Java 1.4!" unless="jdk14.present"/>
  247. <available property="junit.present" classname="org.junit.Test" classpathref="libs-tools-build-classpath"/>
  248. <condition property="junit.message" value="JUnit Support PRESENT">
  249. <equals arg1="${junit.present}" arg2="true"/>
  250. </condition>
  251. <condition property="junit.message" value="JUnit Support NOT Present - Committers are required to have JUnit working">
  252. <not>
  253. <equals arg1="${junit.present}" arg2="true"/>
  254. </not>
  255. </condition>
  256. <echo message="${junit.message}"/>
  257. <condition property="xmlunit.present">
  258. <and>
  259. <available classname="org.custommonkey.xmlunit.XMLTestCase" classpathref="libs-tools-build-classpath"/>
  260. <isset property="junit.present"/>
  261. </and>
  262. </condition>
  263. <condition property="xmlunit.message" value="XMLUnit Support PRESENT">
  264. <equals arg1="${xmlunit.present}" arg2="true"/>
  265. </condition>
  266. <condition property="xmlunit.message" value="XMLUnit Support NOT Present - you can get it from http://xmlunit.sourceforge.net">
  267. <not>
  268. <equals arg1="${xmlunit.present}" arg2="true"/>
  269. </not>
  270. </condition>
  271. <echo message="${xmlunit.message}"/>
  272. </target>
  273. <!-- =================================================================== -->
  274. <!-- Help on usage -->
  275. <!-- =================================================================== -->
  276. <target name="usage">
  277. <echo message="Use the -projecthelp option instead"/>
  278. </target>
  279. <!-- =================================================================== -->
  280. <!-- Generate the source code -->
  281. <!-- =================================================================== -->
  282. <macrodef name="create-font">
  283. <attribute name="name"/>
  284. <sequential>
  285. <xslt in="${src.codegen.fonts.dir}/@{name}.xml" style="${src.codegen.fonts.dir}/font-file.xsl" out="${build.codegen.fonts.dir}/base14/@{name}.java"/>
  286. </sequential>
  287. </macrodef>
  288. <target name="codegen" depends="init" description="Generates the java files from the xml resources">
  289. <echo message="Generating the java files from xml resources"/>
  290. <mkdir dir="${build.gensrc.dir}"/>
  291. <mkdir dir="${build.gensrc.dir}/org/apache/fop/fonts/base14"/>
  292. <xslt in="${src.codegen.fonts.dir}/encodings.xml" style="${src.codegen.fonts.dir}/code-point-mapping.xsl" out="${build.codegen.fonts.dir}/CodePointMapping.java"/>
  293. <xslt basedir="${src.codegen.fonts.dir}" includes="Helvetica*.xml,Times*.xml,Courier*.xml" style="${src.codegen.fonts.dir}/font-file.xsl" destdir="${build.codegen.fonts.dir}/base14/" extension=".java">
  294. <param name="encoding" expression="WinAnsiEncoding"/>
  295. </xslt>
  296. <create-font name="Symbol"/>
  297. <create-font name="ZapfDingbats"/>
  298. </target>
  299. <!-- =================================================================== -->
  300. <!-- Compiles the source directory -->
  301. <!-- =================================================================== -->
  302. <target name="compile-java" depends="init, codegen">
  303. <!-- create directories -->
  304. <mkdir dir="${build.classes.dir}"/>
  305. <javac destdir="${build.classes.dir}" includeAntRuntime="true">
  306. <src path="${build.gensrc.dir}"/>
  307. <src path="${src.java.dir}"/>
  308. <patternset includes="**/*.java"/>
  309. <patternset refid="exclude-jce-dependencies"/>
  310. <patternset refid="exclude-jai"/>
  311. <classpath refid="libs-build-classpath"/>
  312. <compilerarg value="-Xlint:cast"/>
  313. </javac>
  314. <mkdir dir="${build.sandbox-classes.dir}"/>
  315. <javac destdir="${build.sandbox-classes.dir}" includeAntRuntime="true">
  316. <src path="${src.sandbox.dir}"/>
  317. <patternset includes="**/*.java"/>
  318. <patternset refid="exclude-jai"/>
  319. <classpath>
  320. <path refid="libs-build-classpath"/>
  321. <pathelement location="${build.classes.dir}"/>
  322. </classpath>
  323. </javac>
  324. </target>
  325. <target name="resourcegen" depends="compile-java">
  326. <mkdir dir="${build.codegen-classes.dir}"/>
  327. <javac destdir="${build.codegen-classes.dir}" includeAntRuntime="true">
  328. <src path="${src.codegen.dir}/java"/>
  329. <patternset includes="**/*.java"/>
  330. <classpath>
  331. <path refid="libs-tools-build-classpath"/>
  332. <pathelement location="${build.classes.dir}"/>
  333. </classpath>
  334. </javac>
  335. <copy todir="${build.codegen-classes.dir}">
  336. <fileset dir="${src.codegen.dir}/java">
  337. <include name="**/*.xsl"/>
  338. </fileset>
  339. </copy>
  340. <taskdef name="eventResourceGenerator" classname="org.apache.fop.tools.EventProducerCollectorTask">
  341. <classpath>
  342. <path refid="libs-tools-build-classpath"/>
  343. <pathelement location="${build.classes.dir}"/>
  344. <pathelement location="${build.codegen-classes.dir}"/>
  345. </classpath>
  346. </taskdef>
  347. <eventResourceGenerator destdir="${build.gensrc.dir}">
  348. <fileset dir="${src.java.dir}">
  349. <include name="**/*.java"/>
  350. </fileset>
  351. </eventResourceGenerator>
  352. </target>
  353. <target name="compile-copy-resources" depends="resourcegen">
  354. <copy todir="${build.classes.dir}">
  355. <fileset dir="${src.java.dir}">
  356. <include name="META-INF/**"/>
  357. <include name="**/*.icm"/>
  358. <include name="**/*.xml"/>
  359. <include name="**/*.LICENSE.txt"/>
  360. <include name="**/*.xsl"/>
  361. </fileset>
  362. <fileset dir="${build.gensrc.dir}">
  363. <include name="**/*.xml"/>
  364. </fileset>
  365. </copy>
  366. <mkdir dir="${build.viewer.resources.dir}"/>
  367. <copy todir="${build.viewer.resources.dir}">
  368. <fileset dir="${src.viewer.resources.dir}"/>
  369. </copy>
  370. <mkdir dir="${build.viewer.images.dir}"/>
  371. <copy todir="${build.viewer.images.dir}">
  372. <fileset dir="${src.viewer.images.dir}"/>
  373. </copy>
  374. <!-- sandbox -->
  375. <copy todir="${build.sandbox-classes.dir}">
  376. <fileset dir="${src.sandbox.dir}">
  377. <include name="META-INF/**"/>
  378. </fileset>
  379. </copy>
  380. </target>
  381. <target name="compile" depends="compile-java, compile-copy-resources" description="Compiles the source code"/>
  382. <!-- =================================================================== -->
  383. <!-- Helper task to generate source files that have already been checked -->
  384. <!-- into the repository. This task uses Unicode Character Database -->
  385. <!-- files. This task need only be run when the latter files have been -->
  386. <!-- updated. This target should never be part of the normal build -->
  387. <!-- process. Output is UnicodeClasses.CLASSES_XML -->
  388. <!-- (src/java/org/apache/fop/hyphenation/classes.xml). -->
  389. <!-- =================================================================== -->
  390. <target name="codegen-hyphenation-classes">
  391. <javac destdir="${build.codegen-classes.dir}">
  392. <src path="${src.codegen.dir}/unicode/java"/>
  393. </javac>
  394. <java classname="org.apache.fop.hyphenation.UnicodeClasses" resultproperty="classes.result" classpath="${build.codegen-classes.dir}">
  395. <arg value="${src.dir}/java/org/apache/fop/hyphenation/classes.xml"/>
  396. </java>
  397. <condition property="classes.result.message" value="Generation of classes successful">
  398. <not>
  399. <isfailure code="${classes.result}"/>
  400. </not>
  401. </condition>
  402. <condition property="classes.result.message" value="Generation of classes failed">
  403. <isfailure code="${classes.result}"/>
  404. </condition>
  405. <echo message="${classes.result.message}"/>
  406. </target>
  407. <!-- =================================================================== -->
  408. <!-- compiles hyphenation patterns -->
  409. <!-- =================================================================== -->
  410. <target name="compile-hyphenation" depends="compile" description="Compiles the hyphenation pattern files">
  411. <path id="hyph-classpath">
  412. <path refid="libs-build-classpath"/>
  413. <pathelement location="${build.classes.dir}"/>
  414. </path>
  415. <mkdir dir="${build.classes.dir}/hyph"/>
  416. <java classname="org.apache.fop.hyphenation.SerializeHyphPattern" fork="true" resultproperty="hyph.result" classpathref="hyph-classpath">
  417. <arg value="${user.hyph.dir}"/>
  418. <arg value="${build.classes.dir}/hyph"/>
  419. <jvmarg value="-Xss${hyph.stacksize}"/>
  420. </java>
  421. <condition property="hyph.result.message" value="Hyphenation successful">
  422. <not>
  423. <isfailure code="${hyph.result}"/>
  424. </not>
  425. </condition>
  426. <condition property="hyph.result.message" value="Hyphenation failed">
  427. <isfailure code="${hyph.result}"/>
  428. </condition>
  429. <echo message="${hyph.result.message}"/>
  430. </target>
  431. <target name="uptodate-jar-hyphenation" depends="compile-hyphenation">
  432. <uptodate property="jar.hyphenation.uptodate" targetfile="${build.dir}/fop-hyph.jar">
  433. <srcfiles dir="${build.classes.dir}/hyph"/>
  434. </uptodate>
  435. </target>
  436. <target name="jar-hyphenation" depends="compile-hyphenation,uptodate-jar-hyphenation" description="Generates the hyphenation jar file" unless="jar.hyphenation.uptodate">
  437. <tstamp>
  438. <format property="ts" pattern="yyyyMMdd-HHmmss-z"/>
  439. </tstamp>
  440. <jar jarfile="${build.dir}/fop-hyph.jar" basedir="${build.classes.dir}" includes="hyph/*.hyp">
  441. <manifest>
  442. <attribute name="Implementation-Title" value="${Name}"/>
  443. <attribute name="Implementation-Version" value="${version}"/>
  444. <attribute name="Implementation-Vendor" value="The Apache Software Foundation (http://xmlgraphics.apache.org/fop/)"/>
  445. <attribute name="Build-Id" value="${ts} (${user.name} [${os.name} ${os.version} ${os.arch}, Java ${java.runtime.version}, Target Java ${javac.target}])"/>
  446. </manifest>
  447. </jar>
  448. </target>
  449. <!-- =================================================================== -->
  450. <!-- main FOP JARs -->
  451. <!-- =================================================================== -->
  452. <target name="uptodate-jar-main" depends="compile">
  453. <uptodate property="jar.main.uptodate" targetfile="${build.dir}/fop.jar">
  454. <srcfiles dir="${build.classes.dir}"/>
  455. </uptodate>
  456. </target>
  457. <target name="jar-main" depends="compile,uptodate-jar-main" description="Generates the main jar file" unless="jar.main.uptodate">
  458. <tstamp>
  459. <format property="ts" pattern="yyyyMMdd-HHmmss-z"/>
  460. </tstamp>
  461. <pathconvert property="manifest.classpath" dirsep="/" pathsep=" " refid="libs-build-classpath">
  462. <map from="${basedir}${file.separator}lib${file.separator}" to=""/>
  463. </pathconvert>
  464. <jar jarfile="${build.dir}/fop.jar" basedir="${build.classes.dir}">
  465. <manifest>
  466. <attribute name="Main-Class" value="org.apache.fop.cli.Main"/>
  467. <attribute name="Build-Id" value="${ts} (${user.name} [${os.name} ${os.version} ${os.arch}, Java ${java.runtime.version}, Target Java ${javac.target}])"/>
  468. <section name="org/apache/fop/">
  469. <attribute name="Specification-Title" value="XSL-FO - Extensible Stylesheet Language"/>
  470. <attribute name="Specification-Version" value="1.1"/>
  471. <attribute name="Specification-Vendor" value="World Wide Web Consortium"/>
  472. <attribute name="Specification-URL" value="http://www.w3.org/TR/xsl"/>
  473. <attribute name="Implementation-Title" value="${Name}"/>
  474. <attribute name="Implementation-Version" value="${version}"/>
  475. <attribute name="Implementation-Vendor" value="The Apache Software Foundation (http://xmlgraphics.apache.org/fop/)"/>
  476. </section>
  477. </manifest>
  478. <metainf dir="${basedir}" includes="LICENSE,NOTICE"/>
  479. </jar>
  480. </target>
  481. <target name="uptodate-jar-sandbox" depends="compile">
  482. <uptodate property="jar.sandbox.uptodate" targetfile="${build.dir}/fop-sandbox.jar">
  483. <srcfiles dir="${build.sandbox-classes.dir}"/>
  484. </uptodate>
  485. </target>
  486. <target name="jar-sandbox" depends="compile,uptodate-jar-sandbox" description="Generates the sandbox jar file" unless="jar.sandbox.uptodate">
  487. <tstamp>
  488. <format property="ts" pattern="yyyyMMdd-HHmmss-z"/>
  489. </tstamp>
  490. <jar jarfile="${build.dir}/fop-sandbox.jar" basedir="${build.sandbox-classes.dir}">
  491. <manifest>
  492. <attribute name="Build-Id" value="${ts} (${user.name} [${os.name} ${os.version} ${os.arch}, Java ${java.runtime.version}, Target Java ${javac.target}])"/>
  493. </manifest>
  494. <metainf dir="${basedir}" includes="LICENSE,NOTICE"/>
  495. </jar>
  496. </target>
  497. <target name="uptodate-jar-sources" depends="codegen">
  498. <uptodate property="jar.sources.uptodate" targetfile="${build.dir}/fop-sources.jar">
  499. <srcfiles dir="${build.gensrc.dir}"/>
  500. <srcfiles dir="${src.java.dir}"/>
  501. </uptodate>
  502. </target>
  503. <target name="jar-sources" depends="codegen" description="Generates a jar file with all the sources" unless="jar.sources.uptodate">
  504. <tstamp>
  505. <format property="ts" pattern="yyyyMMdd-HHmmss-z"/>
  506. </tstamp>
  507. <patternset id="java-only">
  508. <include name="**/*.java"/>
  509. </patternset>
  510. <jar jarfile="${build.dir}/${name}-${version}-sources.jar">
  511. <fileset dir="${build.gensrc.dir}">
  512. <patternset refid="java-only"/>
  513. </fileset>
  514. <fileset dir="${src.java.dir}">
  515. <patternset refid="java-only"/>
  516. </fileset>
  517. <fileset dir="${basedir}">
  518. <include name="LICENSE"/>
  519. <include name="NOTICE"/>
  520. </fileset>
  521. </jar>
  522. </target>
  523. <!-- =================================================================== -->
  524. <!-- Creates the class package -->
  525. <!-- =================================================================== -->
  526. <target name="package" depends="jar-main,jar-hyphenation,jar-sandbox" description="Generates the jar files"/>
  527. <target name="servlet" depends="package" description="Generates the WAR with the sample FOP servlet">
  528. <echo message="Creating the WAR file"/>
  529. <war warfile="${build.dir}/fop.war" webxml="${src.dir}/conf/web.xml">
  530. <lib dir="${lib.dir}">
  531. <include name="avalon-framework*.jar"/>
  532. <include name="commons-logging*.jar"/>
  533. <include name="batik*.jar"/>
  534. <include name="commons-io*.jar"/>
  535. <include name="xmlgraphics*.jar"/>
  536. </lib>
  537. <lib dir="${build.dir}">
  538. <include name="fop.jar"/>
  539. </lib>
  540. </war>
  541. </target>
  542. <patternset id="transcoder-classes">
  543. <!-- General classes -->
  544. <patternset>
  545. <include name="org/apache/fop/Version.class"/>
  546. <include name="org/apache/fop/accessibility/StructureTreeElement.class"/>
  547. <include name="org/apache/fop/apps/Fop.class"/>
  548. <include name="org/apache/fop/apps/FOPException.class"/>
  549. <include name="org/apache/fop/apps/io/**"/>
  550. <include name="org/apache/fop/area/AreaTreeControl*"/>
  551. <include name="org/apache/fop/complexscripts/bidi/BidiClass.class"/>
  552. <include name="org/apache/fop/complexscripts/bidi/BidiConstants.class"/>
  553. <include name="org/apache/fop/complexscripts/bidi/UnicodeBidiAlgorithm.class"/>
  554. <include name="org/apache/fop/complexscripts/fonts/*.class"/>
  555. <include name="org/apache/fop/complexscripts/util/GlyphTester.class"/>
  556. <include name="org/apache/fop/events/EventProducer.class"/>
  557. <include name="org/apache/fop/fo/Constants.class"/>
  558. <include name="org/apache/fop/fo/FOTreeBuilder.class"/>
  559. <include name="org/apache/fop/image/loader/batik/BatikImageFlavors*.class"/>
  560. <include name="org/apache/fop/svg/**"/>
  561. <include name="org/apache/fop/fonts/**"/>
  562. <include name="org/apache/fop/render/gradient/**"/>
  563. <include name="org/apache/fop/traits/Direction.class"/>
  564. <include name="org/apache/fop/traits/MinOptMax.class"/>
  565. <include name="org/apache/fop/traits/TraitEnum.class"/>
  566. <include name="org/apache/fop/util/CMYKColorSpace*.class"/>
  567. <include name="org/apache/fop/util/Color*.class"/>
  568. <include name="org/apache/fop/util/ASCII*.class"/>
  569. <include name="org/apache/fop/util/*OutputStream.class"/>
  570. <include name="org/apache/fop/util/SubInputStream.class"/>
  571. <include name="org/apache/fop/util/Finalizable.class"/>
  572. <include name="org/apache/fop/util/CharUtilities.class"/>
  573. <include name="org/apache/fop/util/DecimalFormatCache*.class"/>
  574. <include name="org/apache/fop/util/ImageObject.class"/>
  575. </patternset>
  576. <!-- PDF transcoder -->
  577. <patternset>
  578. <include name="org/apache/fop/render/pdf/**"/>
  579. <exclude name="org/apache/fop/render/pdf/PDFRenderer.class"/>
  580. <exclude name="org/apache/fop/render/pdf/PDFXMLHandler*"/>
  581. <include name="org/apache/fop/render/intermediate/IFDocumentHandlerConfigurator.class"/>
  582. <include name="org/apache/fop/render/**Config**"/>
  583. <include name="org/apache/fop/util/AbstractPaintingState**"/>
  584. <include name="org/apache/fop/pdf/**"/>
  585. </patternset>
  586. <!-- PS transcoder -->
  587. <patternset>
  588. <include name="org/apache/fop/render/ps/**"/>
  589. <exclude name="org/apache/fop/render/pdf/PSRenderer.class"/>
  590. <exclude name="org/apache/fop/render/pdf/PSXMLHandler*"/>
  591. </patternset>
  592. </patternset>
  593. <fileset dir="${build.classes.dir}" id="transcoder-classes-files">
  594. <patternset refid="transcoder-classes"/>
  595. </fileset>
  596. <fileset dir="${lib.dir}" id="transcoder-lib-files">
  597. <include name="commons-io*.jar"/>
  598. <include name="avalon-framework*.jar"/>
  599. <include name="commons-logging*.jar"/>
  600. <include name="xmlgraphics-commons*.jar"/>
  601. </fileset>
  602. <target name="uptodate-transcoder-pkg" depends="compile">
  603. <uptodate property="transcoder.pkg.uptodate" targetfile="${build.dir}/fop-transcoder.jar">
  604. <srcfiles refid="transcoder-classes-files"/>
  605. <srcfiles refid="transcoder-lib-files"/>
  606. </uptodate>
  607. </target>
  608. <target name="transcoder-pkg" depends="remove-cache, uptodate-transcoder-pkg, compile" description="Generates the jar for the transcoder package for Batik" unless="transcoder.pkg.uptodate">
  609. <echo message="Creating the jar file ${build.dir}/fop-transcoder.jar"/>
  610. <property name="fop-transcoder.name" value="FOP Transcoder Package"/>
  611. <property name="fop-transcoder.version" value="${version}"/>
  612. <tstamp>
  613. <format property="ts" pattern="yyyyMMdd-HHmmss-z"/>
  614. </tstamp>
  615. <!-- lean transcoder jar -->
  616. <jar jarfile="${build.dir}/fop-transcoder.jar">
  617. <fileset refid="transcoder-classes-files"/>
  618. <manifest>
  619. <attribute name="Implementation-Title" value="${fop-transcoder.name}"/>
  620. <attribute name="Implementation-Version" value="${fop-transcoder.version}"/>
  621. <attribute name="Implementation-Vendor" value="The Apache Software Foundation (http://xmlgraphics.apache.org/fop/)"/>
  622. <attribute name="Build-Id" value="${ts} (${user.name} [${os.name} ${os.version} ${os.arch}, Java ${java.runtime.version}, Target Java ${javac.target}])"/>
  623. </manifest>
  624. <metainf dir="${basedir}" includes="LICENSE,NOTICE"/>
  625. </jar>
  626. <!-- all-in-one transcoder jar -->
  627. <property name="transcoder-deps" value="${build.dir}/transcoder-dependencies"/>
  628. <mkdir dir="${transcoder-deps}"/>
  629. <unjar dest="${transcoder-deps}">
  630. <patternset>
  631. <include name="org/apache/avalon/framework/*"/>
  632. <include name="org/apache/avalon/framework/activity/*"/>
  633. <include name="org/apache/avalon/framework/configuration/*"/>
  634. <include name="org/apache/avalon/framework/container/*"/>
  635. <include name="org/apache/commons/logging/**"/>
  636. <include name="org/apache/commons/io/*.class"/>
  637. <include name="org/apache/commons/io/filefilter/*.class"/>
  638. <include name="org/apache/commons/io/output/*.class"/>
  639. </patternset>
  640. <fileset refid="transcoder-lib-files"/>
  641. </unjar>
  642. <mkdir dir="${transcoder-deps}/legal"/>
  643. <copy todir="${transcoder-deps}/legal">
  644. <fileset dir="${lib.dir}">
  645. <include name="avalon.LICENSE.txt"/>
  646. <include name="commons-io.LICENSE.txt"/>
  647. <include name="commons-logging.LICENSE.txt"/>
  648. </fileset>
  649. </copy>
  650. <jar jarfile="${build.dir}/fop-transcoder-allinone.jar">
  651. <fileset refid="transcoder-classes-files"/>
  652. <fileset dir="${transcoder-deps}"/>
  653. <manifest>
  654. <attribute name="Implementation-Title" value="${fop-transcoder.name}"/>
  655. <attribute name="Implementation-Version" value="${fop-transcoder.version}"/>
  656. <attribute name="Implementation-Vendor" value="The Apache Software Foundation (http://xmlgraphics.apache.org/fop/)"/>
  657. <attribute name="Build-Id" value="${ts} (${user.name} [${os.name} ${os.version} ${os.arch}, Java ${java.runtime.version}, Target Java ${javac.target}])"/>
  658. </manifest>
  659. <metainf dir="${basedir}" includes="LICENSE,NOTICE"/>
  660. </jar>
  661. </target>
  662. <target name="all" depends="package, servlet, transcoder-pkg, junit"/>
  663. <!-- "all" target for us Makefile converts ;-) -->
  664. <!-- =================================================================== -->
  665. <!-- Testing -->
  666. <!-- =================================================================== -->
  667. <target name="junit-init" depends="init-avail" if="xmlunit.present">
  668. <condition property="junit.formatter.brief.use">
  669. <istrue value="${junit.formatter.brief}"/>
  670. </condition>
  671. </target>
  672. <target name="junit-with-xmlunit" depends="junit-init" if="xmlunit.present">
  673. <patternset id="test-sources"/>
  674. </target>
  675. <target name="junit-without-xmlunit" depends="junit-init" unless="xmlunit.present">
  676. <patternset id="test-sources">
  677. <exclude name="**/intermediate/*"/>
  678. </patternset>
  679. </target>
  680. <target name="junit-compile-java" depends="package, transcoder-pkg, junit-with-xmlunit, junit-without-xmlunit" if="junit.present">
  681. <mkdir dir="${build.unit.tests.dir}"/>
  682. <mkdir dir="${build.dir}/test-gensrc"/>
  683. <mkdir dir="${junit.reports.dir}"/>
  684. <javac destdir="${build.unit.tests.dir}" includeAntRuntime="true">
  685. <src path="${test.dir}/java"/>
  686. <patternset refid="test-sources"/>
  687. <classpath>
  688. <path refid="libs-tools-build-classpath"/>
  689. <fileset dir="${build.dir}">
  690. <include name="fop.jar"/>
  691. </fileset>
  692. </classpath>
  693. </javac>
  694. <copy todir="${build.unit.tests.dir}">
  695. <fileset dir="${test.dir}/java">
  696. <include name="**/*.xsl"/>
  697. <include name="**/*.txt"/>
  698. <include name="**/*.afm"/>
  699. <include name="**/*.fo"/>
  700. <include name="**/*.svg"/>
  701. </fileset>
  702. </copy>
  703. </target>
  704. <target name="junit-compile-copy-resources" if="junit.present">
  705. <eventResourceGenerator
  706. destdir="${build.dir}/test-gensrc">
  707. <fileset dir="${test.dir}/java">
  708. <include name="**/*.java"/>
  709. </fileset>
  710. </eventResourceGenerator>
  711. <copy todir="${build.unit.tests.dir}">
  712. <fileset dir="${test.dir}/java">
  713. <include name="META-INF/**"/>
  714. <include name="**/*.xml"/>
  715. <include name="**/*.fo"/>
  716. <include name="**/BidiTestData*.ser"/>
  717. <include name="**/*.afp"/>
  718. <include name="**/*.ps"/>
  719. <include name="**/*.xsl"/>
  720. </fileset>
  721. <fileset dir="${build.dir}/test-gensrc">
  722. <include name="**/*.xml"/>
  723. </fileset>
  724. </copy>
  725. </target>
  726. <target name="junit-compile" depends="junit-compile-java, junit-compile-copy-resources" description="Compiles FOP's JUnit tests" if="junit.present"/>
  727. <target name="junit-transcoder" depends="junit-compile" description="Runs FOP's JUnit transcoder tests" if="junit.present">
  728. <path id="transcoder-classpath">
  729. <pathelement location="${build.unit.tests.dir}"/>
  730. <path refid="libs-tools-build-classpath"/>
  731. <fileset dir="${build.dir}">
  732. <include name="fop-transcoder.jar"/>
  733. </fileset>
  734. </path>
  735. <junit-run classpath="transcoder-classpath" title="basic functionality for fop-transcoder.jar" testsuite="org.apache.fop.BasicTranscoderTestSuite" outfile="TEST-transcoder"/>
  736. <echo message="Running basic functionality tests for fop-transcoder-allinone.jar"/>
  737. <!-- These are the same tests as in the block above but testing the "allinone" JAR
  738. instead. Please don't add any additional paths other than the test classes, the
  739. allinone JAR and the any Batik JARs to the classpath. If this fails, but the
  740. previous test block succeeded it indicates that the packaging of the allinone
  741. JAR needs to be updated.
  742. -->
  743. <path id="transcoder-all-classpath">
  744. <pathelement location="${build.unit.tests.dir}"/>
  745. <path refid="libs-build-classpath"/>
  746. <fileset dir="build">
  747. <include name="fop-transcoder-allinone.jar"/>
  748. </fileset>
  749. <fileset dir="${lib.dir}">
  750. <include name="xml-apis*.jar"/>
  751. <include name="xerces*.jar"/>
  752. <include name="batik*.jar"/>
  753. </fileset>
  754. </path>
  755. <junit-run classpath="transcoder-all-classpath" title="basic functionality for fop-transcoder-allinone.jar" testsuite="org.apache.fop.BasicTranscoderTestSuite" outfile="TEST-transcoder-allinone"/>
  756. </target>
  757. <target name="hyphenation-present" depends="junit-compile" if="junit.present">
  758. <condition property="hyphenation.present">
  759. <and>
  760. <!-- All the hyphenation files required by the layout test cases to be listed here -->
  761. <available resource="hyph/en.hyp" classpathref="libs-run-classpath"/>
  762. <available resource="hyph/de.hyp" classpathref="libs-run-classpath"/>
  763. </and>
  764. </condition>
  765. <condition property="hyphenation.message" value="Hyphenation Support PRESENT">
  766. <equals arg1="${hyphenation.present}" arg2="true"/>
  767. </condition>
  768. <condition property="hyphenation.message" value="Hyphenation Support NOT Present - Layout tests which require hyphenation are NOT being run!">
  769. <not>
  770. <equals arg1="${hyphenation.present}" arg2="true"/>
  771. </not>
  772. </condition>
  773. <echo message="${hyphenation.message}"/>
  774. </target>
  775. <path id="standard-junit-classpath">
  776. <pathelement location="${build.unit.tests.dir}"/>
  777. <path refid="libs-tools-build-classpath"/>
  778. <fileset dir="${build.dir}">
  779. <include name="fop.jar"/>
  780. <include name="fop-hyph.jar"/>
  781. </fileset>
  782. </path>
  783. <macrodef name="junit-run">
  784. <attribute name="title"/>
  785. <attribute name="basedir" default=""/>
  786. <attribute name="testsuite"/>
  787. <attribute name="outfile"/>
  788. <attribute name="classpath" default="standard-junit-classpath"/>
  789. <sequential>
  790. <echo message="Running @{title} tests..."/>
  791. <junit dir="${basedir}" haltonfailure="yes" fork="${junit.fork}" forkmode="once"
  792. errorproperty="fop.junit.error" failureproperty="fop.junit.failure" printsummary="${junit.printsummary}">
  793. <sysproperty key="basedir" value="${basedir}/@{basedir}"/>
  794. <sysproperty key="jawa.awt.headless" value="true"/>
  795. <formatter type="brief" usefile="false" if="junit.formatter.brief.use"/>
  796. <formatter type="plain" usefile="true"/>
  797. <formatter type="xml" usefile="true"/>
  798. <classpath>
  799. <path refid="@{classpath}"/>
  800. </classpath>
  801. <assertions>
  802. <enable/>
  803. </assertions>
  804. <test name="@{testsuite}" todir="${junit.reports.dir}" outfile="@{outfile}"/>
  805. </junit>
  806. </sequential>
  807. </macrodef>
  808. <target name="junit-all" depends="junit-compile, junit-transcoder, junit-layout-hyphenation"
  809. description="Runs FOP's JUnit basic tests" if="junit.present">
  810. <junit dir="${basedir}" haltonfailure="yes" fork="${junit.fork}" forkmode="once"
  811. errorproperty="fop.junit.error" failureproperty="fop.junit.failure" printsummary="${junit.printsummary}">
  812. <sysproperty key="jawa.awt.headless" value="true"/>
  813. <formatter type="brief" usefile="false" if="junit.formatter.brief.use"/>
  814. <formatter type="plain" usefile="true"/>
  815. <formatter type="xml" usefile="true"/>
  816. <classpath>
  817. <path refid="standard-junit-classpath"/>
  818. </classpath>
  819. <assertions>
  820. <enable/>
  821. </assertions>
  822. <batchtest todir="${junit.reports.dir}">
  823. <fileset dir="${build.unit.tests.dir}" includes="**/*TestCase.class"/>
  824. </batchtest>
  825. </junit>
  826. </target>
  827. <target name="junit-basic" depends="junit-compile" description="Runs FOP's JUnit basic tests" if="junit.present">
  828. <junit-run title="Standard test suite" testsuite="org.apache.fop.StandardTestSuite" outfile="TEST-standard-tests-suite"/>
  829. </target>
  830. <target name="junit-userconfig" depends="junit-compile" if="junit.present" description="Runs FOP's user config JUnit tests">
  831. <junit-run title="user config" testsuite="org.apache.fop.config.UserConfigTestSuite" outfile="TEST-userconfig"/>
  832. </target>
  833. <target name="junit-layout-standard" depends="junit-compile, junit-fotree" if="junit.present" description="Runs FOP's standard JUnit layout tests">
  834. <junit-run title="standard layout engine" testsuite="org.apache.fop.layoutengine.LayoutEngineTestSuite" outfile="TEST-layoutengine-standard"/>
  835. </target>
  836. <target name="junit-layout-hyphenation" depends="hyphenation-present, junit-compile" if="hyphenation.present" description="Runs FOP's JUnit hyphenation layout tests">
  837. <junit-run title="hyphenation layout engine" testsuite="org.apache.fop.layoutengine.HyphenationLayoutTestCase"
  838. outfile="TEST-layoutengine-hyphenation"/>
  839. </target>
  840. <target name="junit-layout" depends="junit-layout-standard, junit-layout-hyphenation" description="Runs all FOP's JUnit layout tests"/>
  841. <target name="junit-fotree" depends="junit-compile" description="Runs FOP's FO tree JUnit tests" if="junit.present">
  842. <junit-run title="fo tree" testsuite="org.apache.fop.fotreetest.FOTreeTestSuite" outfile="TEST-FO-tree"/>
  843. </target>
  844. <target name="junit-area-tree-xml-format" depends="junit-compile" description="Runs FOP's area tree XML format JUnit tests" if="xmlunit.present">
  845. <junit-run title="area tree XML format" testsuite="org.apache.fop.intermediate.AreaTreeXMLFormatTestSuite" outfile="TEST-area-tree-xml-format"/>
  846. </target>
  847. <target name="junit-intermediate-layout" depends="junit-compile" if="xmlunit.present">
  848. <junit-run title="intermediate format from layout tests"
  849. testsuite="org.apache.fop.intermediate.LayoutIFTestSuite"
  850. outfile="TEST-intermediate-format-from-layout"/>
  851. </target>
  852. <target name="junit-intermediate-format" depends="junit-compile,junit-intermediate-layout"
  853. description="Runs FOP's intermediate format JUnit tests" if="xmlunit.present">
  854. <junit-run title="intermediate format"
  855. testsuite="org.apache.fop.intermediate.IntermediateFormatTestSuite"
  856. outfile="TEST-intermediate-format"/>
  857. </target>
  858. <target name="junit-events" depends="junit-compile" description="Runs FOP's event JUnit tests" if="junit.present">
  859. <junit-run title="event" testsuite="org.apache.fop.events.EventProcessingTestCase" outfile="TEST-events"/>
  860. </target>
  861. <target name="junit-text-linebreak" depends="junit-compile" description="Runs FOP's JUnit unicode linebreak tests" if="junit.present">
  862. <junit-run title="Unicode UAX#14 support" testsuite="org.apache.fop.text.linebreak.LineBreakStatusTestCase" outfile="TEST-linebreak"/>
  863. </target>
  864. <target name="junit-fonts" depends="junit-compile">
  865. <echo message="Running tests for the fonts package"/>
  866. <junit-run title="fonts" testsuite="org.apache.fop.fonts.FOPFontsTestSuite" outfile="TEST-fonts"/>
  867. </target>
  868. <target name="junit-render-ps" depends="junit-compile">
  869. <echo message="Running tests for the render ps package"/>
  870. <junit-run title="render-ps" testsuite="org.apache.fop.render.ps.RenderPSTestSuite" outfile="TEST-render-ps"/>
  871. </target>
  872. <target name="junit-render-pdf" depends="junit-compile">
  873. <junit-run title="render-pdf" testsuite="org.apache.fop.render.pdf.RenderPDFTestSuite" outfile="TEST-render-pdf"/>
  874. </target>
  875. <target name="junit-complexscripts" depends="junit-compile">
  876. <junit-run title="complexscripts" testsuite="org.apache.fop.complexscripts.ComplexScriptsTestSuite" outfile="TEST-complexscripts"/>
  877. </target>
  878. <target name="junit-complexscripts-layout" depends="junit-compile" if="junit.present">
  879. <junit-run title="standard layout engine" testsuite="org.apache.fop.complexscripts.layout.ComplexScriptsLayoutTestSuite" outfile="TEST-complexscripts-layout"/>
  880. </target>
  881. <target name="junit-reduced" depends="junit-userconfig, junit-basic, junit-transcoder,
  882. junit-text-linebreak, junit-fotree, junit-fonts, junit-render-pdf, junit-render-ps,
  883. junit-complexscripts, junit-complexscripts-layout"/>
  884. <target name="junit" depends="remove-cache, junit-all" description="Runs all of FOP's JUnit tests"
  885. if="junit.present">
  886. <fail><condition><or><isset property="fop.junit.error"/><isset
  887. property="fop.junit.failure"/><not><isset
  888. property="hyphenation.present"/></not></or></condition>
  889. NOTE:
  890. **************************************************************************
  891. * One or more of the Junit tests had Failures or Errors or were skipped! *
  892. * Please check the output above for relevant messages. *
  893. * Or use the "junit-reports" target to generate HTML test reports. *
  894. **************************************************************************
  895. </fail>
  896. <echo>All Junit tests passed!</echo>
  897. <echo>Use the "junit-reports" target to generate HTML test reports</echo>
  898. </target>
  899. <!-- haven't made this dependent on "junit" as that would rerun all tests -->
  900. <target name="junit-reports" description="Generates HTML test reports">
  901. <mkdir dir="${junit.html.reports.dir}"/>
  902. <junitreport todir="${junit.reports.dir}">
  903. <fileset dir="${junit.reports.dir}">
  904. <include name="TEST-*.xml"/>
  905. </fileset>
  906. <report format="frames" todir="${junit.html.reports.dir}"/>
  907. </junitreport>
  908. <echo>JUnit HTML test reports should be available in ${junit.html.reports.dir}</echo>
  909. </target>
  910. <!-- =================================================================== -->
  911. <!-- Creates the API documentation -->
  912. <!-- =================================================================== -->
  913. <target name="javadocs" depends="codegen" description="Generates javadocs">
  914. <!--condition property="javadoc.version.ok">
  915. <not>
  916. <or>
  917. <equals arg1="${ant.java.version}" arg2="1.1"/>
  918. <equals arg1="${ant.java.version}" arg2="1.2"/>
  919. <equals arg1="${ant.java.version}" arg2="1.3"/>
  920. </or>
  921. </not>
  922. </condition>
  923. <fail message="Building FOP javadocs requires at least Java 1.4" unless="javadoc.version.ok"/-->
  924. <property name="javadoc.public" value="false"/>
  925. <property name="javadoc.package" value="false"/>
  926. <property name="javadoc.private" value="false"/>
  927. <condition property="javadoc.level" value=" (level: private)">
  928. <equals arg1="${javadoc.private}" arg2="true"/>
  929. </condition>
  930. <condition property="javadoc.level" value=" (level: package)">
  931. <equals arg1="${javadoc.package}" arg2="true"/>
  932. </condition>
  933. <condition property="javadoc.level" value=" (level: public)">
  934. <equals arg1="${javadoc.public}" arg2="true"/>
  935. </condition>
  936. <property name="javadoc.level" value=""/>
  937. <echo message="Producing the javadoc files${javadoc.level}"/>
  938. <mkdir dir="${build.javadocs.dir}"/>
  939. <javadoc failonerror="true" source="${javac.source}" destdir="${build.javadocs.dir}"
  940. packagenames="${javadoc.packages}"
  941. public="${javadoc.public}" package="${javadoc.package}" private="${javadoc.private}"
  942. author="true" version="true" use="true"
  943. windowtitle="${Name} ${version} API"
  944. doctitle="Apache Formatting Objects Processor (FOP)"
  945. bottom="Copyright ${year} The Apache Software Foundation. All Rights Reserved."
  946. overview="${src.dir}/java/org/apache/fop/overview.html"
  947. maxmemory="256M">
  948. <header><![CDATA[${name} ${version}]]></header>
  949. <footer><![CDATA[${name} ${version}]]></footer>
  950. <classpath>
  951. <path refid="libs-build-classpath"/>
  952. <pathelement path="${java.class.path}"/>
  953. </classpath>
  954. <sourcepath>
  955. <pathelement path="${src.java.dir}"/>
  956. <pathelement path="${src.sandbox.dir}"/>
  957. <pathelement path="${build.gensrc.dir}"/>
  958. </sourcepath>
  959. <tag name="event.severity" scope="all" description="Event severity level:"/>
  960. <group title="Control and Startup">
  961. <package name="org.apache.fop"/>
  962. <package name="org.apache.fop.apps"/>
  963. <package name="org.apache.fop.cli"/>
  964. <package name="org.apache.fop.configuration"/>
  965. <package name="org.apache.fop.messaging"/>
  966. <package name="org.apache.fop.servlet"/>
  967. </group>
  968. <group title="XSL-FO Tree">
  969. <package name="org.apache.fop.fo"/>
  970. <package name="org.apache.fop.fo.*"/>
  971. <package name="org.apache.fop.datatypes"/>
  972. <package name="org.apache.fop.extensions"/>
  973. </group>
  974. <group title="Layout">
  975. <package name="org.apache.fop.layoutmgr"/>
  976. <package name="org.apache.fop.layoutmgr.*"/>
  977. </group>
  978. <group title="Area Tree">
  979. <package name="org.apache.fop.area"/>
  980. <package name="org.apache.fop.area.*"/>
  981. <package name="org.apache.fop.traits"/>
  982. </group>
  983. <group title="Paginated Rendering">
  984. <package name="org.apache.fop.render"/>
  985. <package name="org.apache.fop.render.*"/>
  986. </group>
  987. <group title="Structural Rendering">
  988. <package name="org.apache.fop.render.rtf"/>
  989. <package name="org.apache.fop.render.mif"/>
  990. </group>
  991. <group title="Fonts">
  992. <package name="org.apache.fop.fonts"/>
  993. <package name="org.apache.fop.fonts.*"/>
  994. </group>
  995. <group title="Events">
  996. <package name="org.apache.fop.events"/>
  997. <package name="org.apache.fop.events.*"/>
  998. </group>
  999. <group title="Utility">
  1000. <package name="org.apache.fop.hyphenation"/>
  1001. <package name="org.apache.fop.tools"/>
  1002. <package name="org.apache.fop.tools.*"/>
  1003. <package name="org.apache.fop.image"/>
  1004. <package name="org.apache.fop.image.*"/>
  1005. <package name="org.apache.fop.text.*"/>
  1006. <package name="org.apache.fop.util"/>
  1007. <package name="org.apache.fop.util.*"/>
  1008. </group>
  1009. <group title="AFP library">
  1010. <package name="org.apache.fop.afp"/>
  1011. <package name="org.apache.fop.afp.*"/>
  1012. </group>
  1013. <group title="PDF library">
  1014. <package name="org.apache.fop.pdf"/>
  1015. <package name="org.apache.fop.svg"/>
  1016. </group>
  1017. <group title="RTFLib (formerly JFor) Subpackage Candidate">
  1018. <package name="org.apache.fop.render.rtf.rtflib"/>
  1019. <package name="org.apache.fop.render.rtf.rtflib.*"/>
  1020. </group>
  1021. </javadoc>
  1022. </target>
  1023. <target name="jar-javadocs" depends="javadocs" description="Generates a jar file containing the Javadocs">
  1024. <jar jarfile="${build.dir}/${name}-${version}-javadoc.jar">
  1025. <manifest>
  1026. <attribute name="Build-Id" value="${ts} (${user.name} [${os.name} ${os.version} ${os.arch}, Java ${java.runtime.version}, Target Java ${javac.target}])"/>
  1027. </manifest>
  1028. <fileset dir="${build.javadocs.dir}"/>
  1029. <metainf dir="${basedir}" includes="LICENSE,NOTICE"/>
  1030. </jar>
  1031. </target>
  1032. <!-- =================================================================== -->
  1033. <!-- Checkstyle -->
  1034. <!-- =================================================================== -->
  1035. <property name="checkstyle.location" value="${lib-tools}/checkstyle-5.5-all.jar" />
  1036. <property name="checkstyle.config" value="${basedir}/checkstyle-5.5.xml" />
  1037. <path id="checkstyle-classpath">
  1038. <pathelement location="${checkstyle.location}"/>
  1039. </path>
  1040. <condition property="checkstyle.avail">
  1041. <and>
  1042. <available classname="com.puppycrawl.tools.checkstyle.CheckStyleTask">
  1043. <classpath refid="checkstyle-classpath"/>
  1044. </available>
  1045. <available file="${checkstyle.config}"/>
  1046. </and>
  1047. </condition>
  1048. <target name="checkstyle-avail" unless="checkstyle.avail">
  1049. <echo message="Checkstyle support NOT present. Please download it from http://checkstyle.sf.net/ and"/>
  1050. <echo message="... please provide ${checkstyle.location}"/>
  1051. <echo message="... please provide ${checkstyle.config}"/>
  1052. </target>
  1053. <target name="checkstyle" depends="package, checkstyle-avail" if="checkstyle.avail" description="Runs Checkstyle for a code quality report">
  1054. <taskdef name="checkstyle" classname="com.puppycrawl.tools.checkstyle.CheckStyleTask" classpathref="checkstyle-classpath"/>
  1055. <mkdir dir="${build.dir}"/>
  1056. <checkstyle config="${checkstyle.config}" failonviolation="true" maxWarnings="0">
  1057. <classpath>
  1058. <path refid="checkstyle-classpath"/>
  1059. <pathelement location="${build.classes.dir}"/>
  1060. <pathelement location="${build.sandbox-classes.dir}"/>
  1061. <pathelement location="${build.codegen-classes.dir}"/>
  1062. </classpath>
  1063. <fileset dir="${src.dir}" includes="**/*.java"/>
  1064. <fileset dir="${test.dir}" includes="**/*.java"/>
  1065. <formatter type="xml" toFile="${build.dir}/report_checkstyle.xml"/>
  1066. <formatter type="plain"/>
  1067. </checkstyle>
  1068. </target>
  1069. <!-- =================================================================== -->
  1070. <!-- PMD -->
  1071. <!-- =================================================================== -->
  1072. <target name="pmd" depends="init" description="Runs PMD for a code quality report">
  1073. <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask">
  1074. <classpath>
  1075. <path refid="libs-build-classpath"/>
  1076. <path refid="libs-tools-build-classpath"/>
  1077. </classpath>
  1078. </taskdef>
  1079. <mkdir dir="${build.dir}"/>
  1080. <pmd shortFilenames="true" targetjdk="${javac.target}">
  1081. <ruleset>basic</ruleset>
  1082. <ruleset>rulesets/migrating_to_14.xml</ruleset>
  1083. <ruleset>sunsecure</ruleset>
  1084. <formatter type="html" toFile="${build.dir}/report_pmd.html"/>
  1085. <fileset dir="${src.java.dir}">
  1086. <include name="**/*.java"/>
  1087. </fileset>
  1088. </pmd>
  1089. </target>
  1090. <target name="cpd" depends="init" description="Runs PMD/CDP for a code quality report">
  1091. <taskdef name="cpd" classname="net.sourceforge.pmd.cpd.CPDTask">
  1092. <classpath>
  1093. <path refid="libs-build-classpath"/>
  1094. <path refid="libs-tools-build-classpath"/>
  1095. </classpath>
  1096. </taskdef>
  1097. <cpd minimumTokenCount="100" outputFile="${build.dir}/report_cpd.txt">
  1098. <fileset dir="${src.java.dir}">
  1099. <include name="**/*.java"/>
  1100. </fileset>
  1101. </cpd>
  1102. </target>
  1103. <!-- =================================================================== -->
  1104. <!-- Findbugs -->
  1105. <!-- =================================================================== -->
  1106. <target name="findbugs-maybe-describe-install" unless="findbugs.present">
  1107. <echo message="Please download FINDBUGS from http://findbugs.sf.net/ and set property findbugs.home.dir"/>
  1108. <echo message="in build-local.properties to the top-level directory of the binary distribution."/>
  1109. </target>
  1110. <target name="findbugs-avail">
  1111. <condition property="findbugs.present">
  1112. <and>
  1113. <isset property="findbugs.home.dir"/>
  1114. <available file="${findbugs.home.dir}" type="dir"/>
  1115. </and>
  1116. </condition>
  1117. <condition property="findbugs.message" value="FINDBUGS Support PRESENT">
  1118. <equals arg1="${findbugs.present}" arg2="true"/>
  1119. </condition>
  1120. <condition property="findbugs.message" value="FINDBUGS Support NOT Present">
  1121. <not>
  1122. <equals arg1="${findbugs.present}" arg2="true"/>
  1123. </not>
  1124. </condition>
  1125. <echo message="${findbugs.message}"/>
  1126. <antcall target="findbugs-maybe-describe-install"/>
  1127. </target>
  1128. <target name="findbugs-exec" depends="compile-java" if="findbugs.present">
  1129. <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask">
  1130. <classpath>
  1131. <fileset dir="${findbugs.home.dir}/lib">
  1132. <include name="*.jar"/>
  1133. </fileset>
  1134. </classpath>
  1135. </taskdef>
  1136. <findbugs home="${findbugs.home.dir}" output="${findbugs.output.format}" reportLevel="low" effort="max"
  1137. outputFile="${build.dir}/report_findbugs.${findbugs.output.extension}" excludeFilter="findbugs-exclude.xml" jvmargs="-Xmx1024m">
  1138. <sourcePath path="${src.java.dir}"/>
  1139. <class location="${build.classes.dir}"/>
  1140. <auxClasspath>
  1141. <path refid="libs-build-classpath"/>
  1142. <path>
  1143. <fileset dir="${ant.library.dir}">
  1144. <include name="ant.jar"/>
  1145. <include name="ant-launcher.jar"/>
  1146. </fileset>
  1147. </path>
  1148. </auxClasspath>
  1149. </findbugs>
  1150. </target>
  1151. <target name="findbugs-xml" depends="findbugs-avail" if="findbugs.present" description="Runs findbugs for a code quality report in XML">
  1152. <property name="findbugs.output.format" value="xml"/>
  1153. <property name="findbugs.output.extension" value="xml"/>
  1154. <antcall target="findbugs-exec"/>
  1155. </target>
  1156. <target name="findbugs-html" depends="findbugs-avail" if="findbugs.present" description="Runs findbugs for a code quality report in HTML">
  1157. <property name="findbugs.output.format" value="html"/>
  1158. <property name="findbugs.output.extension" value="html"/>
  1159. <antcall target="findbugs-exec"/>
  1160. </target>
  1161. <target name="findbugs" depends="findbugs-html" description="Runs findbugs for a code quality report in HTML"/>
  1162. <!-- =================================================================== -->
  1163. <!-- Creates the reports -->
  1164. <!-- =================================================================== -->
  1165. <target name="reports" depends="checkstyle, pmd, cpd, findbugs" description="Runs all configured code quality reports"/>
  1166. <!-- =================================================================== -->
  1167. <!-- Creates the documentation - (CL20130210 moved to ASF-CMS) -->
  1168. <!-- =================================================================== -->
  1169. <!-- =================================================================== -->
  1170. <!-- Creates the distribution -->
  1171. <!-- =================================================================== -->
  1172. <!-- It would be better to make dist depend on distclean. But as long as the forrest projectInfo plugin depends on a higher Java version (1.5) than we use for the compilation (1.4), leaving it out enables a workaround -->
  1173. <target name="dist" depends="dist-prereq,dist-src,dist-bin,maven-artifacts" description="Generates the distribution package"/>
  1174. <target name="dist-prereq" depends="init,dist-get-jai">
  1175. <fail message="A complete binary build requires JAI" unless="jai.present"/>
  1176. <fail message="A complete binary build requires JCE" unless="jce.present"/>
  1177. </target>
  1178. <target name="dist-get-jai" description="Attempts to download the JAI library dependency" unless="jai.present">
  1179. <echo message="JAI Support NOT present - attempting to download... "/>
  1180. <get src="http://download.java.net/media/jai/builds/release/1_1_3/jai-1_1_3-lib.zip" dest="${java.io.tmpdir}/jai-1_1_3-lib.zip" verbose="true" />
  1181. <unzip src="${java.io.tmpdir}/jai-1_1_3-lib.zip" dest="${java.io.tmpdir}">
  1182. <patternset>
  1183. <include name="jai-1_1_3/lib/*"/>
  1184. </patternset>
  1185. </unzip>
  1186. <copy todir="${basedir}/lib" file="${java.io.tmpdir}/jai-1_1_3/lib/jai_core.jar" />
  1187. <copy todir="${basedir}/lib" file="${java.io.tmpdir}/jai-1_1_3/lib/jai_codec.jar" />
  1188. <delete dir="${java.io.tmpdir}/jai-1_1_3" />
  1189. <delete file="${java.io.tmpdir}/jai-1_1_3-lib.zip" />
  1190. <property name="jai.present" value="true"/>
  1191. </target>
  1192. <target name="dist-bin" depends="all,javadocs">
  1193. <echo message="Building the binary distribution files (zip,tar)"/>
  1194. <mkdir dir="${dist.bin.result.dir}"/>
  1195. <copy todir="${dist.bin.result.dir}">
  1196. <fileset refid="dist.bin"/>
  1197. <fileset refid="dist.bin.lib"/>
  1198. </copy>
  1199. <copy todir="${dist.bin.result.dir}/javadocs">
  1200. <fileset dir="${build.javadocs.dir}"/>
  1201. </copy>
  1202. <mkdir dir="${dist.bin.result.dir}/build"/>
  1203. <copy todir="${dist.bin.result.dir}/build" file="build/fop.jar"/>
  1204. <chmod file="${dist.bin.result.dir}/fop" perm="ugo+rx"/>
  1205. <zip zipfile="${name}-${version}-bin.zip" basedir="${dist.bin.dir}" includes="**"/>
  1206. <tar longfile="gnu" destfile="${name}-${version}-bin.tar">
  1207. <tarfileset dir="${dist.bin.dir}" mode="755">
  1208. <include name="${name}-${version}/fop"/>
  1209. </tarfileset>
  1210. <tarfileset dir="${dist.bin.dir}">
  1211. <include name="**"/>
  1212. <exclude name="${name}-${version}/fop"/>
  1213. </tarfileset>
  1214. </tar>
  1215. <gzip zipfile="${name}-${version}-bin.tar.gz" src="${name}-${version}-bin.tar"/>
  1216. <delete file="${name}-${version}-bin.tar"/>
  1217. </target>
  1218. <target name="dist-src">
  1219. <echo message="Building the source distribution files (zip,tar)"/>
  1220. <mkdir dir="${dist.src.result.dir}"/>
  1221. <copy todir="${dist.src.result.dir}">
  1222. <fileset refid="dist.src"/>
  1223. </copy>
  1224. <chmod file="${dist.src.result.dir}/fop" perm="ugo+rx"/>
  1225. <zip zipfile="${name}-${version}-src.zip" basedir="${dist.src.dir}" includes="**"/>
  1226. <tar longfile="gnu" destfile="${name}-${version}-src.tar">
  1227. <tarfileset dir="${dist.src.dir}" mode="755">
  1228. <include name="${name}-${version}/fop"/>
  1229. </tarfileset>
  1230. <tarfileset dir="${dist.src.dir}">
  1231. <include name="**"/>
  1232. <exclude name="${name}-${version}/fop"/>
  1233. </tarfileset>
  1234. </tar>
  1235. <gzip zipfile="${name}-${version}-src.tar.gz" src="${name}-${version}-src.tar"/>
  1236. <delete file="${name}-${version}-src.tar"/>
  1237. </target>
  1238. <target name="release-dist" depends="dist" description="Generates the distribution package and signs the release">
  1239. <property name="bin.suffix" value="bin"/>
  1240. <input message="Passphrase for your default private key (attention: passphrase will be echoed in clear text on the display!)" addproperty="pwd"/>
  1241. <antcall target="md5">
  1242. <param name="sign.archive" value="${name}-${version}-src.zip"/>
  1243. </antcall>
  1244. <antcall target="sign-file">
  1245. <param name="sign.archive" value="${name}-${version}-src.zip"/>
  1246. <param name="pwd" value="${pwd}"/>
  1247. </antcall>
  1248. <antcall target="md5">
  1249. <param name="sign.archive" value="${name}-${version}-src.tar.gz"/>
  1250. </antcall>
  1251. <antcall target="sign-file">
  1252. <param name="sign.archive" value="${name}-${version}-src.tar.gz"/>
  1253. <param name="pwd" value="${pwd}"/>
  1254. </antcall>
  1255. <antcall target="md5">
  1256. <param name="sign.archive" value="${name}-${version}-${bin.suffix}.zip"/>
  1257. </antcall>
  1258. <antcall target="sign-file">
  1259. <param name="sign.archive" value="${name}-${version}-${bin.suffix}.zip"/>
  1260. <param name="pwd" value="${pwd}"/>
  1261. </antcall>
  1262. <antcall target="md5">
  1263. <param name="sign.archive" value="${name}-${version}-${bin.suffix}.tar.gz"/>
  1264. </antcall>
  1265. <antcall target="sign-file">
  1266. <param name="sign.archive" value="${name}-${version}-${bin.suffix}.tar.gz"/>
  1267. <param name="pwd" value="${pwd}"/>
  1268. </antcall>
  1269. </target>
  1270. <target name="md5">
  1271. <property name="md5.exec" value="md5sum"/>
  1272. <property name="md5.options" value=""/>
  1273. <exec executable="${md5.exec}" output="${sign.archive}.md5">
  1274. <arg line="${md5.options} ${sign.archive}"/>
  1275. </exec>
  1276. </target>
  1277. <target name="sign-file">
  1278. <property name="gpg.exec" value="gpg"/>
  1279. <property name="gpg.options" value="--armor --detach-sign --force-v3-sigs --batch --verbose --passphrase-fd 0"/>
  1280. <delete file="${sign.archive}.asc"/>
  1281. <exec executable="${gpg.exec}" inputstring="${pwd}">
  1282. <arg line="${gpg.options} ${sign.archive}"/>
  1283. </exec>
  1284. </target>
  1285. <!-- =================================================================== -->
  1286. <!-- Maven artifacts -->
  1287. <!-- =================================================================== -->
  1288. <target name="maven-artifacts" depends="jar-main, jar-sources, jar-javadocs" description="Builds a Maven artifact that can be uploaded to a Maven repository">
  1289. <filter token="version" value="${version}"/>
  1290. <mkdir dir="${build.dir}/maven"/>
  1291. <copy file="${basedir}/xmlgraphics-fop-pom-template.pom" tofile="${build.dir}/maven/pom.xml" filtering="true"/>
  1292. <copy file="${build.dir}/${name}.jar" tofile="${build.dir}/${name}-${version}.jar"/>
  1293. <fileset id="bundle-files" dir="${build.dir}">
  1294. <patternset>
  1295. <include name="${name}-${version}.jar"/>
  1296. <include name="${name}-${version}-sources.jar"/>
  1297. <include name="${name}-${version}-javadoc.jar"/>
  1298. </patternset>
  1299. <patternset>
  1300. <include name="maven/pom.xml"/>
  1301. </patternset>
  1302. </fileset>
  1303. <checksum algorithm="md5">
  1304. <fileset refid="bundle-files"/>
  1305. </checksum>
  1306. <checksum algorithm="sha1">
  1307. <fileset refid="bundle-files"/>
  1308. </checksum>
  1309. <input message="Passphrase for your default private key (attention: passphrase will be echoed in clear text on the display!)" addproperty="pwd"/>
  1310. <antcall target="sign-file">
  1311. <param name="sign.archive" value="${build.dir}/${name}-${version}.jar"/>
  1312. <param name="pwd" value="${pwd}"/>
  1313. </antcall>
  1314. <antcall target="sign-file">
  1315. <param name="sign.archive" value="${build.dir}/${name}-${version}-sources.jar"/>
  1316. <param name="pwd" value="${pwd}"/>
  1317. </antcall>
  1318. <antcall target="sign-file">
  1319. <param name="sign.archive" value="${build.dir}/${name}-${version}-javadoc.jar"/>
  1320. <param name="pwd" value="${pwd}"/>
  1321. </antcall>
  1322. <antcall target="sign-file">
  1323. <param name="sign.archive" value="${build.dir}/maven/pom.xml"/>
  1324. <param name="pwd" value="${pwd}"/>
  1325. </antcall>
  1326. <jar jarfile="${build.dir}/${name}-${version}-bundle.jar">
  1327. <manifest>
  1328. <attribute name="Build-Id" value="${ts} (${user.name} [${os.name} ${os.version} ${os.arch}, Java ${java.runtime.version}])"/>
  1329. </manifest>
  1330. <fileset dir="${build.dir}">
  1331. <patternset>
  1332. <include name="${name}-${version}.jar*"/>
  1333. <include name="${name}-${version}-sources.jar*"/>
  1334. <include name="${name}-${version}-javadoc.jar*"/>
  1335. </patternset>
  1336. </fileset>
  1337. <fileset dir="${build.dir}/maven">
  1338. <patternset>
  1339. <include name="pom.xml*"/>
  1340. </patternset>
  1341. </fileset>
  1342. <metainf dir="${basedir}" includes="LICENSE,NOTICE"/>
  1343. </jar>
  1344. <move file="${build.dir}/${name}-${version}-bundle.jar" todir="${basedir}"/>
  1345. </target>
  1346. <!-- =================================================================== -->
  1347. <!-- Nightly builds -->
  1348. <!-- =================================================================== -->
  1349. <target name="junit-nightly-build" depends="junit-userconfig,junit-text-linebreak,junit-fotree">
  1350. <fail>
  1351. <condition>
  1352. <or>
  1353. <isset property="fop.junit.error"/>
  1354. <isset property="fop.junit.failure"/>
  1355. </or>
  1356. </condition>
  1357. NOTE:
  1358. **************************************************************************
  1359. * One or more of the Junit tests had Failures or Errors or were skipped! *
  1360. * Please check the output above for relevant messages. *
  1361. * Or use the "junit-reports" target to generate HTML test reports. *
  1362. **************************************************************************
  1363. </fail>
  1364. <echo>All Junit tests passed!</echo>
  1365. </target>
  1366. <target name="nightly-build" depends="clean,jar-main,junit-nightly-build">
  1367. <echo message="Building the binary distribution files (zip,tar)"/>
  1368. <delete dir="${nightly.dir}"/>
  1369. <mkdir dir="${nightly.result.dir}"/>
  1370. <copy todir="${nightly.result.dir}">
  1371. <fileset refid="dist.bin"/>
  1372. <fileset refid="dist.bin.lib"/>
  1373. </copy>
  1374. <mkdir dir="${nightly.result.dir}/build"/>
  1375. <copy todir="${nightly.result.dir}/build" file="build/fop.jar"/>
  1376. <chmod file="${nightly.result.dir}/fop" perm="ugo+rx"/>
  1377. <zip zipfile="${name}-${DSTAMP}-bin.zip" basedir="${nightly.dir}" includes="**"/>
  1378. <tar longfile="gnu" destfile="${name}-${DSTAMP}-bin.tar">
  1379. <tarfileset dir="${nightly.dir}" mode="755">
  1380. <include name="${name}-${DSTAMP}/fop"/>
  1381. </tarfileset>
  1382. <tarfileset dir="${nightly.dir}">
  1383. <include name="**"/>
  1384. <exclude name="${name}-${DSTAMP}/fop"/>
  1385. </tarfileset>
  1386. </tar>
  1387. <gzip zipfile="${name}-${DSTAMP}-bin.tar.gz" src="${name}-${DSTAMP}-bin.tar"/>
  1388. <delete file="${name}-${DSTAMP}-bin.tar"/>
  1389. </target>
  1390. <!-- =================================================================== -->
  1391. <!-- Generate examples -->
  1392. <!-- =================================================================== -->
  1393. <target name="examples" depends="package" description="Generates the example files">
  1394. <taskdef name="fop" classname="org.apache.fop.tools.anttasks.Fop" classpathref="libs-run-classpath"/>
  1395. <mkdir dir="${build.examples.dir}"/>
  1396. <fop format="${build.property.examples.mime.type}" outdir="${build.examples.dir}" messagelevel="debug" basedir="${fo.examples.dir}" userconfig="${fo.examples.userconfig}" force="${fo.examples.force}">
  1397. <fileset dir="${fo.examples.dir}">
  1398. <include name="${fo.examples.include}"/>
  1399. </fileset>
  1400. </fop>
  1401. </target>
  1402. <!-- =================================================================== -->
  1403. <!-- Generate unit tests -->
  1404. <!-- =================================================================== -->
  1405. <target name="tests" depends="package" description="Generates the test files">
  1406. <taskdef name="fop" classname="org.apache.fop.tools.anttasks.Fop" classpathref="libs-run-classpath"/>
  1407. <mkdir dir="${build.tests.dir}"/>
  1408. <fop format="${build.property.tests.mime.type}" xsltfile="${test.dir}/layoutengine/testcase2fo.xsl" outdir="${build.tests.dir}" messagelevel="debug" basedir="${test.dir}" userconfig="${fo.examples.userconfig}" force="${xml.tests.force}">
  1409. <fileset dir="${test.dir}">
  1410. <include name="${xml.tests.include}"/>
  1411. </fileset>
  1412. </fop>
  1413. </target>
  1414. <!-- =================================================================== -->
  1415. <!-- Helper task to generate source files that have already been -->
  1416. <!-- checked into CVS. For these files, CVS version is the official one -->
  1417. <!-- and may have updates that will *not* be generated by below. This -->
  1418. <!-- target should never be part of the normal build process. -->
  1419. <!-- =================================================================== -->
  1420. <target name="codegen-fo">
  1421. <style in="${src.codegen.dir}/fo/constants.xml" style="${src.codegen.dir}/fo/constants.xsl" out="Constants.java"/>
  1422. <style in="${src.codegen.dir}/fo/foelements.xml" style="${src.codegen.dir}/fo/property-sets.xsl" out="PropertySets.java"/>
  1423. </target>
  1424. <!-- =================================================================== -->
  1425. <!-- Helper tasks to generate source files that have already been checked -->
  1426. <!-- into the repository. For these files, the version in the -->
  1427. <!-- repository is the official one and may have updates that will *not* -->
  1428. <!-- be generated by below. This target should never be part of the -->
  1429. <!-- normal build process. -->
  1430. <!-- =================================================================== -->
  1431. <target name="codegen-unicode" depends="compile-java">
  1432. <mkdir dir="${build.codegen-classes.dir}"/>
  1433. <javac destdir="${build.codegen-classes.dir}">
  1434. <src path="${src.codegen.dir}/unicode/java"/>
  1435. <classpath>
  1436. <path refid="libs-build-classpath"/>
  1437. <pathelement location="${build.classes.dir}"/>
  1438. <pathelement location="${build.codegen-classes.dir}"/>
  1439. </classpath>
  1440. </javac>
  1441. <java classname="org.apache.fop.text.linebreak.GenerateLineBreakUtils" classpath="${build.codegen-classes.dir}">
  1442. <arg line="-o ${src.dir}/java/org/apache/fop/text/linebreak/LineBreakUtils.java"/>
  1443. </java>
  1444. </target>
  1445. <target name="codegen-unicode-bidi" depends="compile-java">
  1446. <mkdir dir="${build.codegen-classes.dir}"/>
  1447. <javac destdir="${build.codegen-classes.dir}" includeAntRuntime="true">
  1448. <src path="${src.codegen.dir}/unicode/java"/>
  1449. <classpath>
  1450. <path refid="libs-build-classpath"/>
  1451. <pathelement location="${build.classes.dir}"/>
  1452. <pathelement location="${build.codegen-classes.dir}"/>
  1453. </classpath>
  1454. </javac>
  1455. <java classname="org.apache.fop.complexscripts.bidi.GenerateBidiClass" classpath="${build.codegen-classes.dir}">
  1456. <arg line="-b http://www.unicode.org/Public/6.0.0/ucd/extracted/DerivedBidiClass.txt"/>
  1457. <arg line="-o ${src.dir}/java/org/apache/fop/complexscripts/bidi/BidiClass.java"/>
  1458. </java>
  1459. <delete>
  1460. <fileset dir="${test.dir}/java/org/apache/fop/complexscripts/bidi">
  1461. <include name="**/BidiTestData*.ser"/>
  1462. </fileset>
  1463. </delete>
  1464. <java classname="org.apache.fop.text.bidi.GenerateBidiTestData" classpath="${build.codegen-classes.dir}" fork="yes">
  1465. <arg line="-v"/>
  1466. <arg line="-i"/>
  1467. <arg line="-b http://www.unicode.org/Public/6.0.0/ucd/BidiTest.txt"/>
  1468. <arg line="-d http://www.unicode.org/Public/6.0.0/ucd/UnicodeData.txt"/>
  1469. <arg line="-o ${test.dir}/java/org/apache/fop/complexscripts/bidi/BidiTestData.java"/>
  1470. </java>
  1471. </target>
  1472. <target name="resgen-complexscripts" depends="compile-java">
  1473. <mkdir dir="${build.unit.tests.dir}"/>
  1474. <javac destdir="${build.unit.tests.dir}" includeAntRuntime="true" memoryMaximumSize="1024m">
  1475. <src path="${test.dir}/java/org/apache/fop/complexscripts/"/>
  1476. <classpath>
  1477. <path refid="libs-build-classpath"/>
  1478. <pathelement location="${build.classes.dir}"/>
  1479. </classpath>
  1480. </javac>
  1481. <java classname="org.apache.fop.complexscripts.scripts.arabic.GenerateArabicTestData">
  1482. <classpath>
  1483. <path refid="libs-build-classpath"/>
  1484. <pathelement location="${build.classes.dir}"/>
  1485. <pathelement location="${build.unit.tests.dir}"/>
  1486. </classpath>
  1487. <arg line="-c"/>
  1488. </java>
  1489. </target>
  1490. <!-- =================================================================== -->
  1491. <!-- Special target for Gump -->
  1492. <!-- =================================================================== -->
  1493. <target name="gump"/>
  1494. <target name="gump-test"/>
  1495. <!-- =================================================================== -->
  1496. <!-- Clean targets -->
  1497. <!-- =================================================================== -->
  1498. <target name="clean" description="Cleans the build directory">
  1499. <delete dir="${build.dir}"/>
  1500. </target>
  1501. <target name="remove-cache" description="Removes the .fop cache directory">
  1502. <delete dir="${user.home}/.fop" />
  1503. </target>
  1504. <target name="distclean" depends="clean" description="Cleans the distribution target directories">
  1505. <delete dir="${dist.src.dir}"/>
  1506. <delete dir="${dist.bin.dir}"/>
  1507. <delete>
  1508. <fileset dir="${basedir}" includes="${name}-*.tar.gz"/>
  1509. <fileset dir="${basedir}" includes="${name}-*.zip"/>
  1510. <fileset dir="${basedir}" includes="${name}-bundle.jar"/>
  1511. </delete>
  1512. </target>
  1513. <!-- =================================================================== -->
  1514. <!-- Local targets -->
  1515. <!-- =================================================================== -->
  1516. <import file="build-local.targets.xml" optional="true"/>
  1517. </project>