neilg 2002/09/27 15:31:04
Modified: java build.sh build.bat build.xml
Added: java/tools/src XJavac.java
java/tools/bin xjavac.jar xjavac.LICENSE.txt
Log:
enable Xerces to be compiled under IBM JDK 1.4.0 without hacking the JDK
installation. This should not affect other JDKs at all.
Revision Changes Path
1.8 +1 -1 xml-xerces/java/build.sh
Index: build.sh
===================================================================
RCS file: /home/cvs/xml-xerces/java/build.sh,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- build.sh 29 Aug 2001 01:40:23 -0000 1.7
+++ build.sh 27 Sep 2002 22:31:03 -0000 1.8
@@ -19,7 +19,7 @@
# Keep this classpath to the minimum required to run ant
# Application dependent classpaths are specified in build.xml
-LOCALCLASSPATH="$JAVA_HOME/lib/tools.jar${CLPATHSEP}${JAVA_HOME}/lib/classes.zip${CLPATHSEP}./tools/ant.jar${CLPATHSEP}./tools/xerces.jar"
+LOCALCLASSPATH="$JAVA_HOME/lib/tools.jar${CLPATHSEP}${JAVA_HOME}/lib/classes.zip${CLPATHSEP}./tools/ant.jar${CLPATHSEP}./tools/xercesImpl.jar${CLPATHSEP}./tools/xml-apis.jar${CLPATHSEP}./tools/bin/xjavac.jar"
ANT_HOME=./tools
echo Building with classpath \"$LOCALCLASSPATH\"
1.7 +1 -1 xml-xerces/java/build.bat
Index: build.bat
===================================================================
RCS file: /home/cvs/xml-xerces/java/build.bat,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- build.bat 29 Aug 2001 01:53:53 -0000 1.6
+++ build.bat 27 Sep 2002 22:31:03 -0000 1.7
@@ -6,7 +6,7 @@
rem Keep this classpath to the minimum required to run ant
rem Application dependent classpaths are specified in build.xml
-set
LOCALCLASSPATH=%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\classes.zip;.\tools\ant.jar;.\tools\xerces.jar
+set
LOCALCLASSPATH=%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\classes.zip;.\tools\ant.jar;.\tools\xercesImpl.jar;.\tools\xml-apis.jar;.\tools\bin\xjavac.jar
echo Building with ant classpath %LOCALCLASSPATH%
echo Starting Ant...
1.102 +14 -15 xml-xerces/java/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/xml-xerces/java/build.xml,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -r1.101 -r1.102
--- build.xml 26 Sep 2002 14:11:37 -0000 1.101
+++ build.xml 27 Sep 2002 22:31:03 -0000 1.102
@@ -17,6 +17,10 @@
==================================================================== -->
<project default="usage" basedir=".">
+
+ <!-- enable compilation under IBM JDK 1.4 -->
+ <taskdef name="xjavac" classname="org.apache.xerces.util.XJavac"/>
+
<!-- Allow properties following these statements to be overridden -->
<!-- Note that all of these don't have to exist. They've just been defined
incase they are used. -->
@@ -196,19 +200,14 @@
</fileset>
</copy>
- <javac srcdir="${build.src}"
+ <xjavac srcdir="${build.src}"
excludes="**/RevalidatingDOMParser.java"
destdir="${build.dest}"
debug="${debug}"
deprecation="${deprecation}"
optimize="${optimize}"
includeAntRuntime="false"
- includeJavaRuntime="false"
- />
- <!--
- bootclasspath="${build.src}"
- extdirs="${build.src}"
- -->
+ includeJavaRuntime="false"/>
</target>
<!-- =================================================================== -->
@@ -267,7 +266,7 @@
excludes="dom/DOMAddLines.java
dom/DOM3.java" />
</copy>
- <javac srcdir="${build.samples}"
+ <xjavac srcdir="${build.samples}"
destdir="${build.dest}"
classpath="${build.dir}/classes"
debug="${debug}"
@@ -284,7 +283,7 @@
<fileset dir="${tests.dir}"
excludes="dom/rename/**, dom/dom3/**, dom/registry/**, dom/mem/**" />
</copy>
- <javac srcdir="${build.tests}"
+ <xjavac srcdir="${build.tests}"
destdir="${build.dest}"
classpath="${build.dir}/classes:./tools/junit.jar"
debug="${debug}"
@@ -743,7 +742,7 @@
</fileset>
</copy>
- <javac srcdir="${build.src}"
+ <xjavac srcdir="${build.src}"
destdir="${build.dest}"
debug="${debug}"
deprecation="${deprecation}"
@@ -865,7 +864,7 @@
</fileset>
</copy>
- <javac srcdir="${build.src}"
+ <xjavac srcdir="${build.src}"
destdir="${build.dest}"
debug="${debug}"
deprecation="${deprecation}"
@@ -1043,7 +1042,7 @@
</fileset>
</copy>
- <javac srcdir="${build.src}"
+ <xjavac srcdir="${build.src}"
excludes="**/RevalidatingDOMParser.java"
destdir="${build.dest}"
debug="${debug}"
@@ -1069,7 +1068,7 @@
token="org.apache.xerces.dom3.DOMErrorHandler"
value="org.w3c.dom.DOMErrorHandler"/>
- <javac srcdir="${build.samples}"
+ <xjavac srcdir="${build.samples}"
destdir="${build.dest}"
classpath="${build.dir}/classes"
debug="${debug}"
@@ -1088,7 +1087,7 @@
<copy todir="${build.tests}">
<fileset dir="${tests.dir}" />
</copy>
- <javac srcdir="${build.tests}"
+ <xjavac srcdir="${build.tests}"
destdir="${build.dest}"
classpath="${build.dir}/classes:./tools/junit.jar"
debug="${debug}"
1.1 xml-xerces/java/tools/src/XJavac.java
Index: XJavac.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001-2002 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", "Ant", 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 [EMAIL PROTECTED]
*
* 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.xerces.util;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.PumpStreamHandler;
import org.apache.tools.ant.taskdefs.Execute;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.util.JavaEnvUtils;
import org.apache.tools.ant.taskdefs.Javac;
import java.io.OutputStream;
import java.io.IOException;
import java.io.ByteArrayOutputStream;
import java.lang.StringBuffer;
/**
* The implementation of the javac compiler for IBM JDK 1.4
*
* The purpose of this task is to diagnose whether we're
* running on an IBM 1.4 JVM; if we are, to
* set up the bootclasspath such that the build will
* succeed; if we aren't, then invoke the Javac12
* task.
*
* @author Neil Graham, IBM
*/
public class XJavac extends Javac {
/**
* Run the compilation.
*
* @exception BuildException if the compilation has problems.
*/
public void execute() throws BuildException {
if(JavaEnvUtils.getJavaVersion().equals(JavaEnvUtils.JAVA_1_4)) {
// maybe the right one; check vendor:
// by running "java -version" in the shell:
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
ByteArrayOutputStream bErr = new ByteArrayOutputStream();
PumpStreamHandler pH = new PumpStreamHandler(bOut, bErr);
Execute exe = new Execute(pH);
String javaExecutablePath = JavaEnvUtils.getJreExecutable("java");
String versionOption = "-version";
exe.setCommandline(new String[] {javaExecutablePath, versionOption});
exe.setVMLauncher(false);
try {
if(exe.execute() != 0) {
throw new BuildException("unable to determine java version!");
}
} catch (IOException e) {
throw new BuildException("Something went wrong while invoking java
while " +
"attempting to determine its version; error: " +
e.getMessage());
}
// safe to say the version string will be in the platform's
// default encoding. Try both stdout and stderr to be safe:
String bOutStr = bOut.toString();
String bErrStr = bErr.toString();
if(bErrStr.indexOf("IBM") > -1 ||
bOutStr.indexOf("IBM") > -1) {
// we're on an IBM 1.4; fiddle with the bootclasspath.
Path bcp = createBootclasspath();
String javaHome = System.getProperty("java.home");
StringBuffer bcpMember = new StringBuffer();
bcpMember.append(javaHome).append("/lib/charsets.jar:");
bcp.createPathElement().setPath(bcpMember.toString());
bcpMember.replace(javaHome.length(), bcpMember.length(),
"/lib/core.jar:");
bcp.createPathElement().setPath(bcpMember.toString());
bcpMember.replace(javaHome.length(), bcpMember.length(),
"/lib/graphics.jar:");
bcp.createPathElement().setPath(bcpMember.toString());
bcpMember.replace(javaHome.length(), bcpMember.length(),
"/lib/javaws.jar:");
bcp.createPathElement().setPath(bcpMember.toString());
bcpMember.replace(javaHome.length(), bcpMember.length(),
"/lib/jaws.jar:");
bcp.createPathElement().setPath(bcpMember.toString());
bcpMember.replace(javaHome.length(), bcpMember.length(),
"/lib/security.jar:");
bcp.createPathElement().setPath(bcpMember.toString());
bcpMember.replace(javaHome.length(), bcpMember.length(),
"/lib/server.jar:");
bcp.createPathElement().setPath(bcpMember.toString());
bcpMember.replace(javaHome.length(), bcpMember.length(),
"/lib/ext/JawBridge.jar:");
bcp.createPathElement().setPath(bcpMember.toString());
bcpMember.replace(javaHome.length(), bcpMember.length(),
"/lib/ext/gskikm.jar:");
bcp.createPathElement().setPath(bcpMember.toString());
bcpMember.replace(javaHome.length(), bcpMember.length(),
"/lib/ext/ibmjceprovider.jar:");
bcp.createPathElement().setPath(bcpMember.toString());
bcpMember.replace(javaHome.length(), bcpMember.length(),
"/lib/ext/indicim.jar:");
bcp.createPathElement().setPath(bcpMember.toString());
bcpMember.replace(javaHome.length(), bcpMember.length(),
"/lib/ext/jaccess.jar:");
bcp.createPathElement().setPath(bcpMember.toString());
bcpMember.replace(javaHome.length(), bcpMember.length(),
"/lib/ext/ldapsec.jar:");
bcp.createPathElement().setPath(bcpMember.toString());
bcpMember.replace(javaHome.length(), bcpMember.length(),
"/lib/ext/oldcertpath.jar");
bcp.createPathElement().setPath(bcpMember.toString());
setBootclasspath(bcp);
}
}
// now just do the normal thing:
super.execute();
}
}
1.1 xml-xerces/java/tools/bin/xjavac.jar
<<Binary file>>
1.1 xml-xerces/java/tools/bin/xjavac.LICENSE.txt
Index: xjavac.LICENSE.txt
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999-2002 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 acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" 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 [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* 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 and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]