From: fotis Date: Mon, 6 Mar 2000 21:34:41 +0000 (+0000) Subject: Switching from make to Ant X-Git-Tag: pre-columns~580 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=99aca1e1efffb3e2824ba70454a51f6a9fb83336;p=xmlgraphics-fop.git Switching from make to Ant git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193284 13f79535-47bb-0310-9956-ffa450edef68 --- 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/Xslt.class b/lib/Xslt.class new file mode 100644 index 000000000..2c24a38cd Binary files /dev/null and b/lib/Xslt.class differ 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 + * . + */ + +//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 + * + *

+ * This task can take the following arguments: + *

+ *

+ * Of these arguments, infile, outfile and xsltfile 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. + *

+ * @author Fotis Jannidis fotis@jannidis.de + */ + + +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: + *

+ */ + 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 new file mode 100644 index 000000000..a459c04ab Binary files /dev/null and b/lib/ant.jar differ 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 new file mode 100644 index 000000000..6159dfddf Binary files /dev/null and b/lib/xml.jar differ 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 @@ - + package org.apache.fop.render.pdf; public class CodePointMapping { @@ -18,7 +18,7 @@ public class CodePointMapping { } } - + 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 @@ - + package org.apache.fop.render.pdf.fonts; import org.apache.fop.render.pdf.Font; @@ -55,7 +55,7 @@ public class extends Font { return width[i]; } } - + 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 @@ - + package org.apache.fop.fo.properties; import org.apache.fop.datatypes.*; @@ -74,7 +74,7 @@ public class extends Property { - + package org.apache.fop.fo.properties; import org.apache.fop.datatypes.*; @@ -140,3 +140,4 @@ public class extends Property { +