aboutsummaryrefslogtreecommitdiffstats
path: root/build.xml
blob: 80915ab5717c238647e3bcded299a5ac5abf4a76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
<?xml version="1.0"?>

<!-- ===========================================================================


                           * ================= *
                           |  How to build Fop |
                           * ================= *

           Adaption from the Cocoon build.xml written by Stefano Mazzocchi
                by Giacomo Pati with some addition by Fotis Jannidis 


Introduction
============

FOP is the world's first print formatter driven by XSL formatting objects. It 
is a Java 1.2 application that reads a formatting object tree and then turns 
it into a PDF document. The formatting object tree, can be in the form of an 
XML document (output by an XSLT engine like Xalan) or can be passed in 
memory as a DOM Document or SAX events.
    
FOP is part of Apache's XML project. The homepage of FOP is 
http:/xml.apache.org/fop 

HTML-Documentation can be found in the subdirectory ./docs. 


Installing the build tools
==========================

The Fop build system is based on Jakarta Ant, which is a Java building tool
originally developed for the Jakarta Tomcat project but now used in many other
Apache projects and extended by many developers.

Ant is a little but very handy tool that uses a build file written in XML
(this file) as building instructions. For more information refer to
"http://jakarta.apache.org/ant/".

To make things easier for you, the Fop distribution contains a
precompiled version of Ant and the build scripts take care of all the
classpath issues except the following:

You need to have xerces.jar and xalan.jar in your classpath. You can get
those from http://xml.apache.org/xerces and http://xml.apache.org/xalan
respectively.

Additionaly you have to make sure, that the "JAVA_HOME" environment
property should be set to match the JVM you want to use. That's it.


Building instructions
=====================

First, make sure your current working directory is where this very file is 
located. Then type

  ./build.sh (unix)
  .\build.bat (win32)

if everything is right and all the required packages are visible, this action
will generate a file called "fop.jar" in the "./build" directory. Note, that
if you do further development, compilation time is reduced since Ant is able
to detect which files have changed an to recompile them at need.

If something went wrong, go to the FAQ section below.

Also, you'll note that reusing a single JVM instance for each task, increases
tremendously the performance of the whole build system, compared to other
tools (i.e. make or shell scripts) where a new JVM is started for each task.


Build targets
=============

The build system is not only responsible of compiling Fop into a jar file,
but is also responsible for creating the HTML documentation, javadocs,
distributions and web site. In fact, the file you have here is _exactly_ what
is used by fop maintainers to take care of everything in the Fop
project, no less and no more. (only partially implemented)

These are the meaningful targets for this build file:

 - package [default] -> creates ./build/fop.jar
 - usage -> shows a help screen
 - codegen -> generates needed java sources from xml resources
 - htmldoc -> generates the HTML documentation in ./build/docs/html-docs
 - javadocs -> generates the API documentation in ./build/javadocs
 - pdfdoc -> generates the PDF documentation in ./build/docs/xml-docs
 - dist -> generates the Fop distribution
 - clean -> restores the distribution to its original and clean state 
            (excepting dist files)
 - distclean -> restores the distribution to its original and clean state
 - site -> generates the web site in ../xml-site/targets/fop (not yet impl.)

====================================== FAQ =====================================

1) Why some of the classes present in the original jar are not built anymore?

The fop build system is very flexible: if a module requires a package that
is not present in the classpath at build time, the module is skipped but
the built process is not stopped.

2) I see a lot of warnings starting like this: "Warning: file modified in the future:"
Sometimes ant gives out this warnings, but the build is finished without any problems

============================================================================ -->

<project default="package" basedir=".">

  <fileset dir="${basedir}" id="dist.bin">
     <include name="conf/**"/>
     <include name="docs/**"/>
     <include name="hyph/**"/>
     <include name="CHANGES"/>
     <include name="LICENSE"/>
     <include name="README"/>
     <include name="STATUS"/>
     <include name="fop.bat"/>
     <include name="fop.sh"/>
     <exclude name="src/**"/>
     <exclude name="dist/**"/>
     <exclude name="build/**"/>
     <exclude name="lib/**"/>
  </fileset>

  <fileset dir="${basedir}" id="dist.bin.lib">
     <include name="lib/xercesImpl-2.0.1.jar"/>
     <include name="lib/xalan-2.3.1.jar"/>
     <include name="lib/xml-apis.jar"/>
     <include name="lib/batik.jar"/>
     <include name="lib/avalon-framework*.jar"/>
     <include name="lib/jimi*"/>
  </fileset>

  <fileset dir="${basedir}" id="dist.src">
     <exclude name="lib/classes/**"/>
     <exclude name="lib/org/**"/>
     <exclude name="lib/src/**"/>
     <exclude name="build/**"/>
     <include name="src/**"/>
     <include name="conf/**"/>
     <include name="docs/**"/>
     <include name="hyph/**"/>
     <include name="lib/**"/>
     <include name="CHANGES"/>
     <include name="LICENSE"/>
     <include name="README"/>
     <include name="STATUS"/>
     <include name="build*"/>
     <include name="fop.bat"/>
     <include name="fop.sh"/>
  </fileset>

  <path id="libs-build-classpath">
    <fileset dir="lib">
      <include name="*.jar"/>
    </fileset>
  </path>

  <path id="libs-run-classpath">
    <fileset dir="lib">
      <include name="*.jar"/>
      <exclude name="ant.jar"/>
      <exclude name="buildtools.jar"/>
      <exclude name="stylebook.jar"/>
    </fileset>
    <fileset dir="build">
      <include name="fop.jar"/>
    </fileset>
  </path>

  <!-- =================================================================== -->
  <!-- Initialization target                                               -->
  <!-- =================================================================== -->
  <target name="init" depends="init-avail">
    <tstamp/>
    <property name="Name" value="Fop"/>
    <property name="name" value="fop"/>
    <property name="version" value="1.0dev"/>
    <filter  token="version" value="${version}"/>
    <property name="year" value="1999-2002"/>

    <echo message="------------------- ${Name} ${version} [${year}] ----------------"/>

    <property name="build.compiler" value="classic"/>
    <property name="debug" value="on"/>
    <property name="optimize" value="off"/>
    <property name="deprecation" value="off"/>

    <property name="textfontencoding" value="WinAnsiEncoding"/>

    <property name="src.dir" value="./src"/>
    <property name="src.codegen" value="./src/codegen"/>
    <property name="docs.dir" value="./docs"/>
    <property name="lib.dir" value="./lib"/>
    <property name="hyph.dir" value="./hyph"/>
    <property name="conf.dir" value="./conf"/>
    <property name="packages" value="org.apache.fop.*"/>

    <property name="docs"           value="docs/html-docs"/>
    <property name="xdocs"           value="docs/xml-docs"/>
    <property name="skins"           value="docs/xml-docs/skins/xml.apache.org/"/>
    <property name="doc.generator" value="org.apache.stylebook.StyleBook"/>
    <property name="doc.generator.package" value="${lib.dir}/stylebook-1.0-b2.jar"/>

    <property name="viewer.resources.src.dir" value="./src/org/apache/fop/viewer/resources"/>
    <property name="viewer.images.src.dir" value="./src/org/apache/fop/viewer/Images"/>
	
    <property name="build.dir" value="./build"/>
    <property name="build.src" value="./build/src"/>
    <property name="build.codegen" value="./build/src/codegen"/>
    <property name="build.dest" value="./build/classes"/>
    <property name="build.docs" value="./build/docs"/>
    <property name="build.javadocs" value="./build/javadocs"/>

    <property name="viewer.resources.dest.dir" value="${build.dest}/org/apache/fop/viewer/resources"/>
    <property name="viewer.images.dest.dir" value="${build.dest}/org/apache/fop/viewer/Images"/>

    <property name="dist.bin.dir" value="./dist-bin"/>
    <property name="dist.src.dir" value="./dist-src"/>
    <property name="dist.bin.result.dir" value="${dist.bin.dir}/${Name}-${version}"/>
    <property name="dist.src.result.dir" value="${dist.src.dir}/${Name}-${version}"/>

    <property name="properties.dir" value="org/apache/fop/fo/properties"/>
    <property name="fonts.dir" value="org/apache/fop/render/pdf/fonts"/>
    <property name="svg.dir" value="org/apache/fop/svg"/>
    <property name="replacestring" value="org/apache/fop"/>
    <property name="ignore_this" value="ignore_this.java"/>
    <property name="jimi" value="JimiImage.java"/>
    <property name="jai" value="JAIImage.java"/>

    <property name="xslt" value="org.apache.xalan.xslt.Process"/>
    <property name="src.properties.xsl" value="${src.codegen}/properties.xsl"/>
    <property name="src.propmaker.xsl" value="${src.codegen}/propmaker.xsl"/>
    <property name="foproperties.xml" value="${build.codegen}/foproperties.xml"/>
    <property name="colorkw.xml" value="${build.codegen}/colorkw.xml"/>
    <property name="allprops.xml" value="${build.codegen}/allprops.xml"/>

    <property name="properties.xsl" value="${build.codegen}/properties.xsl"/>
    <property name="propmap.xsl" value="${build.codegen}/propmap.xsl"/>
    <property name="enumgen.xsl" value="${build.codegen}/enumgen.xsl"/>
    <property name="propinc.xsl" value="${build.codegen}/propinc.xsl"/>
    <property name="genconst.xsl" value="${build.codegen}/genconst.xsl"/>
    <property name="src.charlist.xsl" value="${src.codegen}/code-point-mapping.xsl"/>
    <property name="encodings.xml" value="${build.codegen}/encodings.xml"/>
    <property name="charlist.xsl" value="${build.codegen}/code-point-mapping.xsl"/>  
    <property name="fontfile.xsl" value="${build.codegen}/font-file.xsl"/>  
    <property name="t1fontfile.xsl" value="${build.codegen}/t1font-file.xsl"/>
    <property name="ttffontfile.xsl" value="${build.codegen}/ttffontfile.xsl"/>
    <property name="ZapfDingbats.xml" value="${build.codegen}/ZapfDingbats.xml"/>
    <property name="Symbol.xml" value="${build.codegen}/Symbol.xml"/>

    <property name="trax" value="TraxTransform.java"/>
    <property name="xsltransform" value="XSLTransform.java"/>

    <property name="tools.pkg" value="org/apache/fop/tools"/>


    <!-- insert custom font information here (step 1 of 2) -->
    <!-- use this as a template 
    <property name="myfont.xml" value="${build.codegen}/myfont.xml"/>
    -->

    <taskdef name="serHyph" classname="org.apache.fop.tools.anttasks.SerializeHyphPattern"/> 
    <taskdef name="runTest" classname="org.apache.fop.tools.anttasks.RunTest"/>

    <property name="main.class" value="org.apache.fop.apps.Fop"/>
   
  </target>

  <target name="init-avail">
    <available property="jimi.present" classname="com.sun.jimi.core.Jimi"/>
    <available property="jai.present" classname="javax.media.jai.JAI"/>

    <available property="trax.present" classname="javax.xml.transform.Transformer"/>

  </target>

  <!-- =================================================================== -->
  <!-- Help on usage                                                       -->
  <!-- =================================================================== -->
  <target name="usage">
  	<echo message="Use the -projecthelp option instead" />
  </target>

  <!-- =================================================================== -->
  <!-- Prepares the build directory                                        -->
  <!-- =================================================================== -->
  <target name="prepare" depends="init">
    <!-- create directories -->
    <echo message="Preparing the build directories"/>
    <mkdir dir="${build.dir}"/>
    <mkdir dir="${build.src}"/>
    <mkdir dir="${build.src}/${properties.dir}"/>
    <mkdir dir="${build.src}/${fonts.dir}"/>
    <mkdir dir="${build.src}/${svg.dir}"/>
    <mkdir dir="${build.dest}/conf"/>
    <mkdir dir="${build.dest}/hyph"/>
    <copy todir="${build.dest}/conf" filtering="yes">
       <fileset dir="./conf"/>
    </copy>
  </target>

  <!-- =================================================================== -->
  <!-- compiles hyphenation patterns                                       -->
  <!-- =================================================================== -->

  <target name="hyphenation" depends="prepare">
    <serHyph includes="*.xml" 
             sourceDir="./hyph" 
             targetDir="${build.dest}/hyph"/> 
  </target>

  <!-- =================================================================== -->
  <!-- copies special image class only if Jimi library is present          -->
  <!-- =================================================================== -->
  <target name="prepare-jimi" depends="prepare" if="jimi.present">
    <echo message="Jimi library is present. Fop installs jimi support."/>
    <copy todir="${build.src}">
      <fileset dir="${src.dir}" includes="**/${jimi}"/>
    </copy>
  </target>

  <!-- =================================================================== -->
  <!-- copies special image class only if JAI library is present          -->
  <!-- =================================================================== -->
  <target name="prepare-jai" depends="prepare" if="jai.present">
    <echo message="JAI library is present. Fop installs JAI support."/>
    <copy todir="${build.src}">
      <fileset dir="${src.dir}" includes="**/${jai}"/>
    </copy>
  </target>

  <target name="prepare-trax" if="trax.present">
    <echo message="JAXP1.1 transforms is present. Installing TRaX support"/>
    <copy todir="${build.src}">
      <fileset dir="${src.dir}" includes="**/${xsltransform},**/${trax},**/apps/TraxInputHandler.java"/>
    </copy>
  </target>


  <!-- =================================================================== -->
  <!-- Prepares the source code                                            -->
  <!-- =================================================================== -->
  <target name="prepare-src" depends="prepare, prepare-jimi, prepare-jai, prepare-trax">
    <!-- copy src files -->
    <copy todir="${build.src}">
      <fileset dir="${src.dir}" 
         excludes="**/${jimi},**/${jai},**/${xsltransform},**/${trax},**/apps/TraxInputHandler.java"/>
    </copy>
  </target>

  <!-- =================================================================== -->
  <!-- Generate the source code                                            -->
  <!-- =================================================================== -->
  <target name="codegen" depends="prepare" description="Generates the java files from the xml resources">
    <!-- resetting codegen directory -->
    <echo message="Resetting codegen directory"/>

    <!-- copy codegen directory -->
    <copy todir="${build.codegen}" filtering="on">
      <fileset dir="${src.codegen}"/>
    </copy>

    <!-- generate the java files from xml resources -->
    <echo message="Generating the java files from xml resources"/>
    <dependset>
        <srcfilelist dir="./" files="${foproperties.xml},${colorkw.xml}"/>
        <targetfilelist dir="./" files="${build.src}/${replacestring}/fo/properties/Constants.java,${build.src}/${replacestring}/fo/properties/fo_${ignore_this}"/>
    </dependset>
    <dependset>
        <srcfilelist dir="./" files="${propinc.xsl}"/>
        <targetfilelist dir="./" files="${build.src}/${replacestring}/fo/properties/fo_${ignore_this},${build.src}/${replacestring}/fo/properties/FOPropertyMapping.java,${build.src}/${replacestring}/fo/properties/foenums_${ignore_this}"/>
    </dependset>

    <style in="${allprops.xml}" style="${genconst.xsl}"
        out="${build.src}/${replacestring}/fo/properties/Constants.java"/>

    <style in="${foproperties.xml}" style="${properties.xsl}"
        out="${build.src}/${replacestring}/fo/properties/fo_${ignore_this}"/>
    <style in="${foproperties.xml}" style="${propmap.xsl}"
        out="${build.src}/${replacestring}/fo/properties/FOPropertyMapping.java"/>
    <style in="${foproperties.xml}" style="${enumgen.xsl}"
        out="${build.src}/${replacestring}/fo/properties/foenums_${ignore_this}"/>

    <style in="${encodings.xml}" style="${charlist.xsl}" 
        out="${build.src}/${replacestring}/render/pdf/CodePointMapping.java"/>

    <style basedir="src/codegen" includes="Helvetica*.xml,Times*.xml,Courier*.xml"
        style="${fontfile.xsl}"
        destdir="${build.src}/${replacestring}/render/pdf/fonts" extension=".java">
        <param name="encoding" expression="${textfontencoding}"/>
    </style>
    <style
        in="${Symbol.xml}" style="${fontfile.xsl}"
        out="${build.src}/${replacestring}/render/pdf/fonts/Symbol.java"/>
    <style
        in="${ZapfDingbats.xml}" style="${fontfile.xsl}"
        out="${build.src}/${replacestring}/render/pdf/fonts/ZapfDingbats.java"/>

    <!-- custom fonts (Use t1fontfile.xsl instead of fontfile.xsl for Type 1 fonts!) step 2/2 -->
    <!-- use this as a template for type 1 fonts: 
    <style in="${myfont.xml}" style="${t1fontfile.xsl}"
        out="${build.src}/${replacestring}/render/pdf/fonts/myfont.java"/>
    -->
    <!-- use this as a template for truetype fonts 
    <style in="${myfont.xml}" style="${ttffontfile.xsl}" 
        out="${build.src}/${replacestring}/render/pdf/fonts/myfont.java"/>
    -->

  </target>

  <!-- =================================================================== -->
  <!-- Compiles the source directory                                       -->
  <!-- =================================================================== -->
  <target name="compile" depends="codegen, prepare-src" description="Compiles the source code">
    <echo message="Compiling the sources "/>
    <!-- create directories -->
    <mkdir dir="${build.dest}"/>

    <mkdir dir="${viewer.resources.dest.dir}"/>
    <copy todir="${viewer.resources.dest.dir}">
      <fileset dir="${viewer.resources.src.dir}"/>
    </copy>
    <mkdir dir="${viewer.images.dest.dir}"/>
    <copy todir="${viewer.images.dest.dir}">
      <fileset dir="${viewer.images.src.dir}"/>
    </copy>

    <javac destdir="${build.dest}" debug="${debug}" deprecation="${deprecation}" optimize="${optimize}">
      <src path="${build.src}"/>
      <classpath refid="libs-build-classpath"/>
      <exclude name="**/${ignore_this}"/>
      <exclude name="${jimi}"/>
     </javac>
  </target>

  <!-- =================================================================== -->
  <!-- Creates the class package                                           -->
  <!-- =================================================================== -->
  <target name="package" depends="compile,hyphenation" description="Generates the jar files">
    <echo message="Creating the jar file ${build.dir}/${name}.jar"/>
    <tstamp>
      <format property="ts" pattern="yyyyMMdd-HHmmss-z"/>
    </tstamp>
    <pathconvert property="manifest-classpath" dirsep="/" pathsep=" " refid="libs-run-classpath">
      <map from="${basedir}${file.separator}lib${file.separator}" to=""/>
      <map from="${basedir}${file.separator}build${file.separator}fop.jar" to=""/>
    </pathconvert>
    <jar jarfile="${build.dir}/${name}.jar"
         basedir="${build.dest}"
         includes="org/**,conf/**,hyph/**">
    <manifest>
        <attribute name="Main-Class" value="${main.class}"/>
        <attribute name="Class-Path" value="${manifest-classpath}"/>
        <attribute name="Implementation-Title" value="${Name}"/>
        <attribute name="Implementation-Version" value="${version}"/>
        <attribute name="Implementation-Vendor" value="Apache Software Foundation (http://xml.apache.org/fop/)"/>
        <attribute name="Build-Id" value="${ts} (${user.name} [${os.name} ${os.version} ${os.arch}, Java ${java.runtime.version}])"/>
    </manifest>
    </jar>
  </target>

  <target name="pdf-transcoder" depends="compile" description="Generates the jar for the pdf transcoder for Batik">
    <echo message="Creating the jar file ${build.dir}/pdf-transcoder.jar"/>

    <property name="pdf-transcoder.name" value="FOP PDF Transcoder"/>
    <property name="pdf-transcoder.version" value="1.0beta2"/>

    <tstamp>
      <format property="ts" pattern="yyyyMMdd-HHmmss-z"/>
    </tstamp>
    <jar jarfile="${build.dir}/pdf-transcoder.jar">
    <fileset dir="${build.dest}" includes="org/apache/fop/pdf/**"/>
    <fileset dir="${build.dest}" includes="org/apache/fop/svg/**"/>
    <fileset dir="${build.dest}" includes="org/apache/fop/render/pdf/**"
             excludes="org/apache/fop/render/pdf/PDFRenderer.class,org/apache/fop/render/pdf/PDFXMLHandler*"/>
    <fileset dir="${build.dest}" includes="org/apache/fop/layout/Font*.class,org/apache/fop/image/FopImag*.class,org/apache/fop/image/Jpeg*,org/apache/fop/image/Abstract*,org/apache/fop/util/StreamUtilities.class"/>
    <manifest>
        <attribute name="Implementation-Title" value="${pdf-transcoder.name}"/>
        <attribute name="Implementation-Version" value="${pdf-transcoder.version}"/>
        <attribute name="Implementation-Vendor" value="Apache Software Foundation (http://xml.apache.org/fop/)"/>
        <attribute name="Build-Id" value="${ts} (${user.name} [${os.name} ${os.version} ${os.arch}, Java ${java.runtime.version}])"/>
    </manifest>
    </jar>
  </target>

  <target name="test" depends="package" description="Runs the test suite">
    <echo message="Testing build in jar file ${build.dir}/${name}.jar against reference"/>
    <runTest testSuite="basictests.xml" basedir="test/" reference="test/reference/fop.jar"
         refVersion="FOP 1.0dev"/>
    <runTest testSuite="bugtests.xml" basedir="test/" reference="test/reference/fop.jar"
         refVersion="FOP 1.0dev"/>
<!--
    <runTest testSuite="testsuite.xml" basedir="TestSuite/NIST/" reference="test/reference/fop.jar"
         refVersion="FOP 1.0dev"/>
    <runTest testSuite="testsuite.xml" basedir="TestSuite/contrib/IBM/" reference="test/reference/fop.jar"
         refVersion="FOP 1.0dev"/>
    <runTest testSuite="testsuite.xml" basedir="TestSuite/contrib/FOP/" reference="test/reference/fop.jar"
         refVersion="FOP 1.0dev"/>
    <runTest testSuite="testsuite.xml" basedir="TestSuite/contrib/XEP/" reference="test/reference/fop.jar"
         refVersion="FOP 1.0dev"/>
    <runTest testSuite="testsuite.xml" basedir="TestSuite/contrib/XSLFormatter/" reference="test/reference/fop.jar"
         refVersion="FOP 1.0dev"/>
-->
  </target>

  <target name="all" depends="package"/> <!-- "all" target for us Makefile converts ;-) -->

  <!-- =================================================================== -->
  <!-- Prepares the docs                                                   -->
  <!-- =================================================================== -->
  <target name="prepare-docs" depends="init">
    <mkdir dir="${build.docs}"/>
  </target>


  <!-- =================================================================== -->
  <!-- Creates the API documentation                                       -->
  <!-- =================================================================== -->
  <target name="javadocs" depends="prepare-src" description="Generates javadocs">
    <echo message="Producing the javadoc files "/>
    <mkdir dir="${build.javadocs}"/>
    <javadoc packagenames="${packages}"
             sourcepath="${build.src}"
             destdir="${build.javadocs}"
             classpathref="libs-build-classpath"
             author="true"
             version="true"
             windowtitle="${Name} API"
             doctitle="${Name}"
             bottom="Copyright &#169; ${year} Apache Software Foundation. All Rights Reserved."
             overview="${build.src}/overview.html"
             failonerror="true"
    />
  </target>

  <target name="html" depends="javadocs, htmldoc" description="Generates javadocs and documentation in html format"/>
  
  <target name="htmldoc" depends= "html-fop, html-design" description="Generates documentation in html format"/>

  <target name="html-fop" depends="prepare-src">
    <copy file="${xdocs}/fop.xml"
          tofile="${xdocs}/book.xml"
          filtering="on"/>
    <java classname="${doc.generator}" fork="yes">
      <classpath refid="libs-build-classpath"/>
      <arg line="targetDirectory=${docs} ${xdocs}/book.xml ${skins}"/>
    </java>
  </target>

  <target name="html-design" depends="prepare-src, html-newdesign,
	  html-altdesign, html-understanding"/>

  <target name="html-newdesign" depends="prepare-src">
    <java classname="${doc.generator}" fork="yes">
      <classpath refid="libs-build-classpath"/>
      <arg line="targetDirectory=${docs}/design/ docs/design/book.xml ${skins}"/>
    </java>
  </target>

  <target name="html-altdesign" depends="prepare-src">
    <java classname="${doc.generator}" fork="yes">
      <classpath refid="libs-build-classpath"/>
      <arg line="targetDirectory=${docs}/design/alt.design/ docs/design/alt.design/book.xml ${skins}"/>
    </java>
  </target>

  <target name="html-understanding" depends="prepare-src">
    <java classname="${doc.generator}" fork="yes">
      <classpath refid="libs-build-classpath"/>
      <arg line="targetDirectory=${docs}/design/understanding docs/design/understanding/book.xml ${skins}"/>
    </java>
  </target>

  <target name="pdfdoc" depends="package" description="Generates the documentation in pdf format">
    <copy file="${xdocs}/fop.xml"
          tofile="${xdocs}/book.xml"
          filtering="on"/>
    <style in="${xdocs}/fop.xml" style="${xdocs}/xml2xml.xsl" out="${xdocs}/fop-doc.xml"/>
    <style in="${xdocs}/fop-doc.xml" style="${xdocs}/xml2pdf.xsl" out="${xdocs}/fop.fo"/>

    <java classname="org.apache.fop.apps.Fop" fork="yes">
      <classpath refid="libs-run-classpath"/>
      <arg line="-fo ${xdocs}/fop.fo -pdf ${xdocs}/fop.pdf"/>
    </java>
  </target>

  <!-- =================================================================== -->
  <!-- Creates the distribution                                            -->
  <!-- =================================================================== -->
  <target name="dist" depends="dist-src,dist-bin" description="Generates the distribution package"/>

  <target name="dist-bin" depends="package">
    <echo message="Building the binary distribution files (zip,tar)"/>
    <mkdir dir="${dist.bin.result.dir}"/>
    <copy todir="${dist.bin.result.dir}">
      <fileset refid="dist.bin"/>
      <fileset refid="dist.bin.lib"/>
    </copy>
    <mkdir dir="${dist.bin.result.dir}/build"/>
    <copy todir="${dist.bin.result.dir}/build" file="build/fop.jar"/>
    <chmod file="${dist.bin.result.dir}/fop.sh" perm="ugo+rx" />
      
    <zip zipfile="${Name}-${version}-bin.zip" basedir="${dist.bin.dir}" includes="**"/>
    <tar tarfile="${Name}-${version}-bin.tar" basedir="${dist.bin.dir}" includes="**"/>
    <gzip zipfile="${Name}-${version}-bin.tar.gz" src="${Name}-${version}-bin.tar" />
    <delete file="${Name}-${version}-bin.tar"/>

  </target>

  <target name="dist-src" depends="package, javadocs">
    <echo message="Building the source distribution files (zip,tar)"/>
    <mkdir dir="${dist.src.result.dir}"/>
    <copy todir="${dist.src.result.dir}">
      <fileset refid="dist.src"/>
    </copy>
    <copy todir="${dist.src.result.dir}/javadocs">
      <fileset dir="${build.javadocs}"/>
    </copy>
    <mkdir dir="${dist.src.result.dir}/build"/>
    <copy todir="${dist.src.result.dir}/build" file="build/fop.jar"/>
    <chmod file="${dist.src.result.dir}/build.sh" perm="ugo+rx" />
    <chmod file="${dist.src.result.dir}/fop.sh" perm="ugo+rx" />

    <zip zipfile="${Name}-${version}-src.zip" basedir="${dist.src.dir}" includes="**"/>
    <tar tarfile="${Name}-${version}-src.tar" basedir="${dist.src.dir}" includes="**"/>
    <gzip zipfile="${Name}-${version}-src.tar.gz" src="${Name}-${version}-src.tar" />
    <delete file="${Name}-${version}-src.tar"/>

  </target>

  <!-- =================================================================== -->
  <!-- Clean targets                                                       -->
  <!-- =================================================================== -->
  <target name="clean" depends="init" description="Cleans the build directory">
    <delete dir="${build.dir}"/>
  </target>

  <target name="distclean" depends="clean" description="Cleans the distribution target directories">
    <delete dir="${dist.src.dir}"/>
    <delete dir="${dist.bin.dir}"/>
    <delete>
       <fileset dir="${basedir}" includes="${Name}-*.tar.gz"/>
       <fileset dir="${basedir}" includes="${Name}-*.zip"/>
    </delete>
  </target>

</project>