diff options
-rwxr-xr-x | build.bat | 28 | ||||
-rwxr-xr-x | build.sh | 25 | ||||
-rw-r--r-- | build.xml | 383 | ||||
-rw-r--r-- | lib/Xslt.class | bin | 0 -> 2614 bytes | |||
-rw-r--r-- | lib/Xslt.java | 211 | ||||
-rw-r--r-- | lib/ant.jar | bin | 0 -> 103481 bytes | |||
-rwxr-xr-x | lib/bin/antRun | 13 | ||||
-rw-r--r-- | lib/xml.jar | bin | 0 -> 132473 bytes | |||
-rw-r--r-- | src/codegen/code-point-mapping.xsl | 4 | ||||
-rw-r--r-- | src/codegen/font-file.xsl | 4 | ||||
-rw-r--r-- | src/codegen/properties.xsl | 5 |
11 files changed, 667 insertions, 6 deletions
diff --git a/build.bat b/build.bat new file mode 100755 index 000000000..9451c94b2 --- /dev/null +++ b/build.bat @@ -0,0 +1,28 @@ +echo on + +echo Fop Build System +echo ---------------- + +if "%JAVA_HOME%" == "" goto error + +set LOCALCLASSPATH=%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\classes.zip;lib\ant.jar;lib\xml.jar;lib +set ANT_HOME=.\lib + +echo Building with classpath %LOCALCLASSPATH% + +echo Starting Ant... + +%JAVA_HOME%\bin\java.exe -Dant.home=%ANT_HOME% -classpath %LOCALCLASSPATH% org.apache.tools.ant.Main %1 %2 %3 %4 %5 + +goto end + +:error + +echo ERROR: JAVA_HOME not found in your environment. +echo Please, set the JAVA_HOME variable in your environment to match the +echo location of the Java Virtual Machine you want to use. + +:end + +rem set LOCALCLASSPATH= + diff --git a/build.sh b/build.sh new file mode 100755 index 000000000..5564b6c73 --- /dev/null +++ b/build.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +echo +echo "Fop Build System" +echo "----------------" +echo + +if [ "$JAVA_HOME" = "" ] ; then + echo "ERROR: JAVA_HOME not found in your environment." + echo + echo "Please, set the JAVA_HOME variable in your environment to match the" + echo "location of the Java Virtual Machine you want to use." + exit 1 +fi + +LOCALCLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/classes.zip:./lib/ant.jar:./lib/xml.jar:./lib +ANT_HOME=./lib + +echo Building with classpath $CLASSPATH:$LOCALCLASSPATH +echo + +echo Starting Ant... +echo + +$JAVA_HOME/bin/java -Dant.home=$ANT_HOME -classpath "$LOCALCLASSPATH:$CLASSPATH" org.apache.tools.ant.Main $* diff --git a/build.xml b/build.xml new file mode 100644 index 000000000..4fff05643 --- /dev/null +++ b/build.xml @@ -0,0 +1,383 @@ +<?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.1 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 XT or Xalan) or can be passed in +memory as a DOM Document or (in the case of XT) 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, xalan.jar and bsf.jar (comes with xalan) 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 + - docs -> generates the HTML documentation in ./build/docs + - javadocs -> generates the API documentation in ./build/javadocs + - 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. + +Here is a list of such modules and what you have to download to build them: + + org.apache.fop.apps.XTCommandLine ===> + James Clark's XT (http://www.jclark.com/) + +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="."> + + <!-- =================================================================== --> + <!-- Initialization target --> + <!-- =================================================================== --> + <target name="init"> + <tstamp/> + <property name="Name" value="Fop"/> + <property name="name" value="fop"/> + <property name="version" value="0.19.2"/> + <property name="year" value="1999-2000"/> + + <echo message="------------------- ${Name} ${version} [${year}] ----------------"/> + + <property name="build.compiler" value="classic"/> + <property name="debug" value="off"/> + <property name="optimize" value="on"/> + <property name="deprecation" value="off"/> + + <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="packages" value="org.apache.fop.*"/> + + <property name="doc.generator" value="org.apache.stylebook.StyleBook"/> + <property name="doc.generator.package" value="${lib.dir}/stylebook-1.0-b2.jar"/> + + <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="dist.dir" value="./dist"/> + + <property name="properties.dir" value="org/apache/fop/fo/properties"/> + <property name="fonts.dir" value="org/apache/fop/render/pdf/fonts"/> + <property name="replacestring" value="org/apache/fop"/> + <property name="ignore_this" value="ignore_this.java"/> + + <property name="xslt" value="org.apache.xalan.xslt.Process"/> + <property name="src.properties.xsl" value="${src.codegen}/properties.xsl"/> + <property name="properties.xml" value="${build.codegen}/properties.xml"/> + <property name="properties.xsl" value="${build.codegen}/properties.xsl"/> + <property name="src.charlist.xsl" value="${src.codegen}/code-point-mapping.xsl"/> + <property name="charlist.xml" value="${build.codegen}/charlist.xml"/> + <property name="charlist.xsl" value="${build.codegen}/code-point-mapping.xsl"/> + <property name="fontfile.xsl" value="${build.codegen}/font-file.xsl"/> + <property name="Courier.xml" value="${build.codegen}/Courier.xml"/> + <property name="Courier-Oblique.xml" value="${build.codegen}/Courier-Oblique.xml"/> + <property name="Courier-Bold.xml" value="${build.codegen}/Courier-Bold.xml"/> + <property name="Courier-BoldOblique.xml" value="${build.codegen}/Courier-BoldOblique.xml"/> + <property name="Helvetica.xml" value="${build.codegen}/Helvetica.xml"/> + <property name="Helvetica-Oblique.xml" value="${build.codegen}/Helvetica-Oblique.xml"/> + <property name="Helvetica-Bold.xml" value="${build.codegen}/Helvetica-Bold.xml"/> + <property name="Helvetica-BoldOblique.xml" value="${build.codegen}/Helvetica-BoldOblique.xml"/> + <property name="Times-Roman.xml" value="${build.codegen}/Times-Roman.xml"/> + <property name="Times-Italic.xml" value="${build.codegen}/Times-Italic.xml"/> + <property name="Times-Bold.xml" value="${build.codegen}/Times-Bold.xml"/> + <property name="Times-BoldItalic.xml" value="${build.codegen}/Times-BoldItalic.xml"/> + + <taskdef name="xslt" classname="Xslt"/> + <available property="xt.present" classname="com.jclark.xsl.sax.XSLProcessor"/> + + <filter token="${replacestring}" value="${build.src}/${replacestring}"/> + </target> + + <!-- =================================================================== --> + <!-- Help on usage --> + <!-- =================================================================== --> + <target name="usage"> + <echo message=""/> + <echo message=""/> + <echo message="${Name} Build file"/> + <echo message="-------------------------------------------------------------"/> + <echo message=""/> + <echo message=" available targets are:"/> + <echo message=""/> + <echo message=" package --> generates the ${name}.jar file (default)"/> + <echo message=" codegen --> generates the java files from the xml resources"/> + <echo message=" compile --> compiles the source code"/> + <echo message=" docs --> generates the HTML documentation"/> + <echo message=" javadocs --> generates the API documentation (java 1.2 only)"/> + <echo message=" dist --> generates the ${Name} distribution as .tar.gz and .zip"/> + <echo message=" clean --> cleans up the directory (except for the dist files)"/> + <echo message=" distclean --> cleans up the directory"/> + <echo message=" site --> generates the ${Name} web site (not yet implemented)"/> + <echo message=""/> + <echo message=" See the comments inside the build.xml file for more details."/> + <echo message="-------------------------------------------------------------"/> + <echo message=""/> + <echo message=""/> + </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}"/> + </target> + + <!-- =================================================================== --> + <!-- Prepares the build directory --> + <!-- =================================================================== --> + <target name="prepare-xt" depends="prepare" if="xt.present"> + <copydir src="${src.dir}" + dest="${build.src}" + includes="**/XT*"/> + </target> + + <!-- =================================================================== --> + <!-- Prepares the source code --> + <!-- =================================================================== --> + <target name="prepare-src" depends="prepare, prepare-xt"> + <!-- copy src files --> + <copydir src="${src.dir}" + dest="${build.src}" + excludes="**/Makefile*, **/package.html, **/XT*"/> + </target> + + <!-- =================================================================== --> + <!-- Generate the source code --> + <!-- =================================================================== --> + <target name="codegen" depends="prepare"> + <!-- resetting codegen directory --> + <echo message="Resetting codegen directory"/> + + <!-- copy codegen directory --> + <copydir src="${src.codegen}" dest="${build.codegen}" filtering="on"/> + + <!-- generate the java files from xml resources --> + <echo message="Generating the java files from xml resources"/> + <xslt infile="${properties.xml}" xsltfile="${properties.xsl}" + outfile="${build.src}/${replacestring}/fo/properties/${ignore_this}" smart="yes"/> + <xslt infile="${charlist.xml}" xsltfile="${charlist.xsl}" + outfile="${build.src}/${replacestring}/render/pdf/CodePointMapping.java" smart="yes"/> + <xslt infile="${Courier.xml}" xsltfile="${fontfile.xsl}" + outfile="${build.src}/${replacestring}/render/pdf/fonts/Courier.java" smart="yes"/> + <xslt infile="${Courier-Oblique.xml}" xsltfile="${fontfile.xsl}" + outfile="${build.src}/${replacestring}/render/pdf/fonts/CourierOblique.java" smart="yes"/> + <xslt infile="${Courier-Bold.xml}" xsltfile="${fontfile.xsl}" + outfile="${build.src}/${replacestring}/render/pdf/fonts/CourierBold.java" smart="yes"/> + <xslt infile="${Courier-BoldOblique.xml}" xsltfile="${fontfile.xsl}" + outfile="${build.src}/${replacestring}/render/pdf/fonts/CourierBoldOblique.java" smart="yes"/> + <xslt infile="${Helvetica.xml}" xsltfile="${fontfile.xsl}" + outfile="${build.src}/${replacestring}/render/pdf/fonts/Helvetica.java" smart="yes"/> + <xslt infile="${Helvetica-Oblique.xml}" xsltfile="${fontfile.xsl}" + outfile="${build.src}/${replacestring}/render/pdf/fonts/HelveticaOblique.java" smart="yes"/> + <xslt infile="${Helvetica-Bold.xml}" xsltfile="${fontfile.xsl}" + outfile="${build.src}/${replacestring}/render/pdf/fonts/HelveticaBold.java" smart="yes"/> + <xslt infile="${Helvetica-BoldOblique.xml}" xsltfile="${fontfile.xsl}" + outfile="${build.src}/${replacestring}/render/pdf/fonts/HelveticaBoldOblique.java" smart="yes"/> + <xslt infile="${Times-Roman.xml}" xsltfile="${fontfile.xsl}" + outfile="${build.src}/${replacestring}/render/pdf/fonts/TimesRoman.java" smart="yes"/> + <xslt infile="${Times-Italic.xml}" xsltfile="${fontfile.xsl}" + outfile="${build.src}/${replacestring}/render/pdf/fonts/TimesItalic.java" smart="yes"/> + <xslt infile="${Times-Bold.xml}" xsltfile="${fontfile.xsl}" + outfile="${build.src}/${replacestring}/render/pdf/fonts/TimesBold.java" smart="yes"/> + <xslt infile="${Times-BoldItalic.xml}" xsltfile="${fontfile.xsl}" + outfile="${build.src}/${replacestring}/render/pdf/fonts/TimesBoldItalic.java" smart="yes"/> + + </target> + + <!-- =================================================================== --> + <!-- Compiles the source directory --> + <!-- =================================================================== --> + <target name="compile" depends="codegen, prepare-src"> + <echo message="Compiling the sources "/> + <!-- create directories --> + <mkdir dir="${build.dest}"/> + + <javac srcdir="${build.src}" + destdir="${build.dest}" + debug="${debug}" + deprecation="${deprecation}" + optimize="${optimize}" + excludes="**/${ignore_this}"/> + </target> + + <!-- =================================================================== --> + <!-- Creates the class package --> + <!-- =================================================================== --> + <target name="package" depends="compile"> + <echo message="Creating the jar file ${build.dir}/${name}.jar"/> + <jar jarfile="${build.dir}/${name}.jar" + basedir="${build.dest}" + includes="org/**"/> + </target> + + <!-- =================================================================== --> + <!-- Prepares the docs --> + <!-- =================================================================== --> + <target name="prepare-docs" depends="init"> + <mkdir dir="${build.docs}"/> + </target> + + <!-- =================================================================== --> + <!-- Copying the documentation files --> + <!-- =================================================================== --> + <target name="docs" depends="prepare-docs"> + <echo message="Copying doc files "/> + <copydir src="${docs.dir}" dest="${build.docs}" /> + <copydir src="${lib.dir}" dest="${build.dir}/${lib.dir}" /> + <copyfile src="build.xml" dest="${build.dir}/build.xml" /> --> + <copyfile src="${basedir}/README" dest="${build.dir}/README" /> + <copyfile src="${basedir}/STATUS" dest="${build.dir}/STATUS" /> + <copyfile src="${basedir}/LICENSE" dest="${build.dir}/LICENSE" /> + <copyfile src="${basedir}/FAQ" dest="${build.dir}/FAQ" /> + </target> + + <!-- =================================================================== --> + <!-- Creates the API documentation --> + <!-- =================================================================== --> + <target name="javadocs" depends="prepare-src"> + <echo message="Producing the javadoc files "/> + <mkdir dir="${build.javadocs}"/> + <javadoc packagenames="${packages}" + sourcepath="${build.src}" + destdir="${build.javadocs}" + author="true" + version="true" + windowtitle="${Name} API" + doctitle="${Name}" + bottom="Copyright © ${year} Apache Software Foundation. All Rights Reserved." + /> + </target> + + <!-- =================================================================== --> + <!-- Creates the distribution --> + <!-- =================================================================== --> + <target name="dist" depends="package, docs, javadocs"> + <echo message="Building the distribution files (zip,tar)"/> + <mkdir dir="${dist.dir}"/> + <copyfile src="${basedir}/build.sh" dest="${dist.dir}/build.sh" /> + <chmod src="${dist.dir}/build.sh" perm="ugo+rx" /> + <copyfile src="${basedir}/build.bat" dest="${dist.dir}/build.bat" /> + <copydir src="${build.dir}" dest="${dist.dir}" + excludes="**/classes/**, **/${ignore_this}"/> + <zip zipfile="${Name}-${version}.zip" basedir="${dist.dir}" includes="**"/> + <tar tarfile="${Name}-${version}.tar" basedir="${dist.dir}" includes="**"/> + <gzip zipfile="${Name}-${version}.tar.gz" src="${Name}-${version}.tar" /> + <delete file="${Name}-${version}.tar"/> + <deltree dir="${dist.dir}"/> + </target> + + <!-- =================================================================== --> + <!-- Clean targets --> + <!-- =================================================================== --> + <target name="clean" depends="init"> + <deltree dir="${build.dir}"/> + </target> + + <target name="distclean" depends="clean"> + <deltree dir="${dist.dir}"/> + <delete file="${Name}-${version}.tar.gz"/> + <delete file="${Name}-${version}.tar"/> + <delete file="${Name}-${version}.zip"/> + </target> + +</project> + +<!-- End of file --> diff --git a/lib/Xslt.class b/lib/Xslt.class Binary files differnew file mode 100644 index 000000000..2c24a38cd --- /dev/null +++ b/lib/Xslt.class diff --git a/lib/Xslt.java b/lib/Xslt.java new file mode 100644 index 000000000..c24c1b132 --- /dev/null +++ b/lib/Xslt.java @@ -0,0 +1,211 @@ +/* + * The Apache Software License, Version 1.1 + * + * Copyright (c) 1999 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + */ + +//package org.apache.tools.ant.taskdefs; + +import org.apache.tools.ant.Task; +import java.net.*; +import java.io.*; +import org.apache.xalan.xslt.*; + +/** + * Task to call the XSLT processor Xalan (part of xml.apache.org), which converts xml files + * from a source to an output using a stylesheet file + * + * <p> + * This task can take the following arguments: + * <ul> + * <li>infile + * <li>xsltfile + * <li>outfile + * <li>smart + * </ul> + * <p> + * Of these arguments, <b>infile, outfile</b> and <b>xsltfile</b> are required. + * smart defaults to 'no'. The other allowed value is 'yes'. If smart is set to 'yes' + * xalan is only called if either the outfile is older than the infile or the stylesheet + * or the outfile doesn't exist. + * <p> + * @author Fotis Jannidis <a href="mailto:fotis@jannidis.de">fotis@jannidis.de</a> + */ + + +public class Xslt extends Task { + private String infile, outfile, xsltfile; + private String smart = "no"; //defaults to do conversion everytime task is called + + + /** + * Calls Xalan and does the transformation + * + */ + + private void transform(String xmlSourceURL, String xslURL, String outputURL) + throws java.io.IOException, + java.net.MalformedURLException, + org.xml.sax.SAXException { + + // Use XSLTProcessor to instantiate an XSLTProcessor. + org.apache.xalan.xslt.XSLTProcessor processor = + org.apache.xalan.xslt.XSLTProcessorFactory.getProcessor(); + + // Create the 3 objects the XSLTProcessor needs to perform the transformation. + org.apache.xalan.xslt.XSLTInputSource xmlSource = + new org.apache.xalan.xslt.XSLTInputSource (infile); + org.apache.xalan.xslt.XSLTInputSource xslSheet = + new org.apache.xalan.xslt.XSLTInputSource (xsltfile); + org.apache.xalan.xslt.XSLTResultTarget xmlResult = + new org.apache.xalan.xslt.XSLTResultTarget (outfile); + + // Perform the transformation. + System.out.println("============================"); + System.out.println("xslt \nin: " + infile + "\nstyle: " + xsltfile + "\nout: " + outfile); + System.out.println("============================"); + processor.process(xmlSource, xslSheet, xmlResult); + + } + + /** + * Sets the input file + * + */ + public void setInfile (String infile) { + this.infile = infile; + } + + /** + * Sets the stylesheet file + * + */ + public void setXsltfile (String xsltfile) { + this.xsltfile = xsltfile; + } + + /** + * Sets the output file + * + */ + public void setOutfile (String outfile) { + this.outfile = outfile; + } + + /** + * Sets the value for smart + * + * @param option valid values: + * <ul> + * <li>yes: check whether output file is older than input or stylesheet + * <li>no: (default) do conversion everytime task is called + * </ul> + */ + public void setSmart (String smart) { + this.smart = smart; + } + + + /** + * Catches the errors transform() can throw and + * returns meaningfull error messages + */ + private void startTransform () { + try { + transform (infile,xsltfile,outfile); + } catch (org.xml.sax.SAXException saxerror) { + System.out.println("SAX Error: " + saxerror); + } catch (MalformedURLException urlerror) { + System.out.println("URL Error: " + urlerror); + } catch (IOException ioerror) { + System.out.println("IO Error: " + ioerror); + } + } + + /** + * Main method, which is called by ant. + * Checks for the value of smart and calls startTransform accordingly + */ + public void execute () throws org.apache.tools.ant.BuildException { + if (smart.equals("no")) { + startTransform(); + } else if (smart.equals("yes")) { + File outfileF = new File (outfile); + //checks for existence of output file + if (outfileF.exists()) { + //checks whether output file is older than input file or xslt stylesheet file + if ((outfileF.lastModified() < new File(infile).lastModified()) | (outfileF.lastModified() < new +File(xsltfile).lastModified())) { + startTransform(); + } + } else { + startTransform(); + } + //returns error message, if smart has another value as 'yes' or 'no' + } else { + System.err.println("Error: Allowed values for the attribute smart are 'yes' or 'no'"); + } + + } + //quick access for debugging + //usage XSLT infile xsltfile outfile (smart is 'yes') + /* + public static void main (String args[]) { + Xslt xslt = new Xslt(); + xslt.setInfile(args[0]); + xslt.setXsltfile(args[1]); + xslt.setOutfile(args[2]); + xslt.setSmart("yes"); + xslt.execute(); + } + */ + +} diff --git a/lib/ant.jar b/lib/ant.jar Binary files differnew file mode 100644 index 000000000..a459c04ab --- /dev/null +++ b/lib/ant.jar diff --git a/lib/bin/antRun b/lib/bin/antRun new file mode 100755 index 000000000..4c38b1803 --- /dev/null +++ b/lib/bin/antRun @@ -0,0 +1,13 @@ +#! /bin/sh + +# Args: DIR command +cd $1 +CMD=$2 +shift +shift + +if test -f $CMD.sh; then + CMD="sh $CMD.sh" +fi + +echo $CMD $@ | sh diff --git a/lib/xml.jar b/lib/xml.jar Binary files differnew file mode 100644 index 000000000..6159dfddf --- /dev/null +++ b/lib/xml.jar diff --git a/src/codegen/code-point-mapping.xsl b/src/codegen/code-point-mapping.xsl index c972aed2e..a3e235cbc 100644 --- a/src/codegen/code-point-mapping.xsl +++ b/src/codegen/code-point-mapping.xsl @@ -6,7 +6,7 @@ <xsl:output method="text" /> <xsl:template match="font-mappings"> -<redirect:write file="org/apache/fop/render/pdf/CodePointMapping.java"> +<!-- <redirect:write file="org/apache/fop/render/pdf/CodePointMapping.java"> --> package org.apache.fop.render.pdf; public class CodePointMapping { @@ -18,7 +18,7 @@ public class CodePointMapping { </xsl:for-each> } } -</redirect:write> +<!-- </redirect:write>--> </xsl:template> </xsl:stylesheet> diff --git a/src/codegen/font-file.xsl b/src/codegen/font-file.xsl index 4bba5933f..284ea968b 100644 --- a/src/codegen/font-file.xsl +++ b/src/codegen/font-file.xsl @@ -7,7 +7,7 @@ <xsl:template match="font-metrics"> <xsl:variable name="class-name" select="class-name"/> -<redirect:write select="concat('org/apache/fop/render/pdf/fonts/', $class-name, '.java')"> +<!--<redirect:write select="concat('org/apache/fop/render/pdf/fonts/', $class-name, '.java')">--> package org.apache.fop.render.pdf.fonts; import org.apache.fop.render.pdf.Font; @@ -55,7 +55,7 @@ public class <xsl:value-of select="class-name"/> extends Font { return width[i]; } } -</redirect:write> +<!--</redirect:write>--> </xsl:template> </xsl:stylesheet> diff --git a/src/codegen/properties.xsl b/src/codegen/properties.xsl index 6bb33db5c..2f85784dc 100644 --- a/src/codegen/properties.xsl +++ b/src/codegen/properties.xsl @@ -7,7 +7,7 @@ <xsl:template match="property" priority="-1"> <xsl:variable name="classname" select="class-name"/> -<redirect:write select="concat('org/apache/fop/fo/properties/', $classname, '.java')"> +<redirect:write select="concat('@org/apache/fop@/fo/properties/', $classname, '.java')"> package org.apache.fop.fo.properties; import org.apache.fop.datatypes.*; @@ -74,7 +74,7 @@ public class <xsl:value-of select="class-name"/> extends Property { <xsl:template match="property[datatype/enumeration]"> <xsl:variable name="classname" select="class-name"/> -<redirect:write select="concat('org/apache/fop/fo/properties/', $classname, '.java')"> +<redirect:write select="concat('@org/apache/fop@/fo/properties/', $classname, '.java')"> package org.apache.fop.fo.properties; import org.apache.fop.datatypes.*; @@ -140,3 +140,4 @@ public class <xsl:value-of select="class-name"/> extends Property { </xsl:template> </xsl:stylesheet> + |