bodewig 02/03/07 08:10:40
Modified: docs/manual platform.html
src/main/org/apache/tools/ant/taskdefs/optional/junit
Xalan2Executor.java
src/main/org/apache/tools/ant/types Description.java
src/main/org/apache/tools/ant/util FileUtils.java
src/testcases/org/apache/tools/ant/util FileUtilsTest.java
Log:
commit the rest of Jeff Tulley's patches for Novell NetWare.
Submitted by: Jeff Tulley <[EMAIL PROTECTED]>
Revision Changes Path
1.3 +26 -0 jakarta-ant/docs/manual/platform.html
Index: platform.html
===================================================================
RCS file: /home/cvs/jakarta-ant/docs/manual/platform.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- platform.html 1 Mar 2002 08:45:53 -0000 1.2
+++ platform.html 7 Mar 2002 16:10:39 -0000 1.3
@@ -47,6 +47,32 @@
<h2>Novell Netware</h2>
+<p>To give the same level of sophisticated control as Ant's startup scripts
on other platforms, it was decided to make the main ant startup on NetWare be
via a Perl Script, "runant.pl". This is found in the bin directory (for
instance - bootstrap\bin or dist\bin).</p>
+
+<p>One important item of note is that you need to set up the following to
run ant:</p>
+<ul><li><code>CLASSPATH</code> - put ant.jar, crimson.jar, optional.jar, and
any other needed jars on the system classpath.</li>
+ <li><code>ANT_OPTS</code> - On NetWare, <code>ANT_OPTS</code> needs to
include a parameter of the form, <nobr>"-envCWD=<code>ANT_HOME</code>"</nobr>,
with <code>ANT_HOME</code> being the fully expanded location of Ant, <b>not</b>
an environment variable. This is due to the fact that the NetWare System
Console has no notion of a current working directory.</li>
+</ul>
+<p>It is suggested that you create up an ant.ncf that sets up these
parameters, and calls <code>perl ANT_HOME/dist/bin/runant.pl</code></p>
+<p>The following is an example of such an NCF file(assuming ant is installed
in <nobr>'sys:/jakarta-ant/'):</nobr></p>
+<code>
+ envset
CLASSPATH=SYS:/jakarta-ant/bootstrap/lib/ant.jar<br />
+ envset
CLASSPATH=$CLASSPATH;SYS:/jakarta-ant/lib/crimson.jar <br />
+ envset
CLASSPATH=$CLASSPATH;SYS:/jakarta-ant/lib/optional/junit.jar <br />
+ envset
CLASSPATH=$CLASSPATH;SYS:/jakarta-ant/bootstrap/lib/optional.jar <br />
+<br />
+ setenv ANT_OPTS=-envCWD=sys:/jakarta-ant <br />
+ envset ANT_OPTS=-envCWD=sys:/jakarta-ant <br />
+ setenv ANT_HOME=sys:/jakarta-ant/dist/lib <br />
+ envset ANT_HOME=sys:/jakarta-ant/dist/lib <br />
+<br />
+ perl sys:/jakarta-ant/dist/bin/runant.pl <br />
+</code>
+
+<p>Ant works on JVM version 1.3 or higher. You may have some luck running
it on JVM 1.2, but serious problems have been found running Ant on JVM 1.1.7B.
These problems are caused by JVM bugs that will not be fixed.</p>
+<p>JVM 1.3 is supported on Novell NetWare versions 5.1 and higher.</p>
+
+
<h2>Other platforms</h2>
Support for other platforms is not guaranteed to be complete, as certain
techniques to hide platform details from build files need to be written and
1.4 +1 -1
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/Xalan2Executor.java
Index: Xalan2Executor.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/Xalan2Executor.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Xalan2Executor.java 5 Mar 2002 03:28:31 -0000 1.3
+++ Xalan2Executor.java 7 Mar 2002 16:10:39 -0000 1.4
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
1.7 +2 -2
jakarta-ant/src/main/org/apache/tools/ant/types/Description.java
Index: Description.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/types/Description.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Description.java 5 Mar 2002 03:28:31 -0000 1.6
+++ Description.java 7 Mar 2002 16:10:39 -0000 1.7
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -67,7 +67,7 @@
* overwrite the first.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Craeg Strong</a>
- * @version $Revision: 1.6 $ $Date: 2002/03/05 03:28:31 $
+ * @version $Revision: 1.7 $ $Date: 2002/03/07 16:10:39 $
*
* @ant.datatype ignore="true"
*/
1.16 +62 -32
jakarta-ant/src/main/org/apache/tools/ant/util/FileUtils.java
Index: FileUtils.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/util/FileUtils.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- FileUtils.java 6 Mar 2002 03:25:51 -0000 1.15
+++ FileUtils.java 7 Mar 2002 16:10:40 -0000 1.16
@@ -79,6 +79,7 @@
import org.apache.tools.ant.Project;
import org.apache.tools.ant.filters.util.ChainReaderHelper;
import org.apache.tools.ant.types.FilterSetCollection;
+import org.apache.tools.ant.taskdefs.condition.Os;
/**
* This class also encapsulates methods which allow Files to be
@@ -91,7 +92,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Stefan Bodewig</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Magesh Umasankar</a>
*
- * @version $Revision: 1.15 $
+ * @version $Revision: 1.16 $
*/
public class FileUtils {
@@ -99,6 +100,8 @@
private static Object lockReflection = new Object();
private static java.lang.reflect.Method setLastModified = null;
+ private boolean onNetWare = Os.isFamily("netware");
+
/**
* Factory method.
*/
@@ -445,14 +448,26 @@
.replace('\\', File.separatorChar);
// deal with absolute files
- if (filename.startsWith(File.separator) ||
-
- (filename.length() >= 2 &&
- Character.isLetter(filename.charAt(0)) &&
- filename.charAt(1) == ':')
-
- ) {
- return normalize(filename);
+ if (!onNetWare) {
+ if (filename.startsWith(File.separator) ||
+
+ (filename.length() >= 2 &&
+ Character.isLetter(filename.charAt(0)) &&
+ filename.charAt(1) == ':')
+
+ ) {
+ return normalize(filename);
+ }
+ } else {
+ // the assumption that the : will appear as the second character
in
+ // the path name breaks down when NetWare is a supported
platform.
+ // Netware volumes are of the pattern: "data:\"
+ int colon = filename.indexOf(":");
+ if (filename.startsWith(File.separator) ||
+ (colon > -1)
+ ) {
+ return normalize(filename);
+ }
}
if (file == null) {
@@ -503,44 +518,59 @@
.replace('\\', File.separatorChar);
// make sure we are dealing with an absolute path
- if (!path.startsWith(File.separator) &&
- ! (path.length() >= 2 &&
- Character.isLetter(path.charAt(0)) &&
- path.charAt(1) == ':')
- ) {
- String msg = path + " is not an absolute path";
- throw new BuildException(msg);
+ int colon = path.indexOf(":");
+
+ if (!onNetWare) {
+ if (!path.startsWith(File.separator) &&
+ ! (path.length() >= 2 &&
+ Character.isLetter(path.charAt(0)) &&
+ colon == 1)
+ ) {
+ String msg = path + " is not an absolute path";
+ throw new BuildException(msg);
+ }
+ } else {
+ if (!path.startsWith(File.separator) &&
+ (colon == -1)
+ ) {
+ String msg = path + " is not an absolute path";
+ throw new BuildException(msg);
+ }
}
boolean dosWithDrive = false;
String root = null;
// Eliminate consecutive slashes after the drive spec
- if (path.length() >= 2 &&
- Character.isLetter(path.charAt(0)) &&
- path.charAt(1) == ':') {
+ if ((!onNetWare &&
+ path.length() >= 2 &&
+ Character.isLetter(path.charAt(0)) &&
+ path.charAt(1) == ':') ||
+ (onNetWare && colon > -1)
+ ) {
dosWithDrive = true;
char[] ca = path.replace('/', '\\').toCharArray();
- StringBuffer sb = new StringBuffer();
- sb.append(Character.toUpperCase(ca[0])).append(':');
+ StringBuffer sbRoot = new StringBuffer();
+ for (int i = 0; i < colon; i++) {
+ sbRoot.append(Character.toUpperCase(ca[i]));
+ }
+ sbRoot.append(':');
+ if (colon + 1 < path.length()) {
+ sbRoot.append(File.separatorChar);
+ }
+ root = sbRoot.toString();
- for (int i = 2; i < ca.length; i++) {
+ // Eliminate consecutive slashes after the drive spec
+ StringBuffer sbPath = new StringBuffer();
+ for (int i = colon+1; i < ca.length; i++) {
if ((ca[i] != '\\') ||
(ca[i] == '\\' && ca[i - 1] != '\\')
) {
- sb.append(ca[i]);
+ sbPath.append(ca[i]);
}
}
-
- path = sb.toString().replace('\\', File.separatorChar);
- if (path.length() == 2) {
- root = path;
- path = "";
- } else {
- root = path.substring(0, 3);
- path = path.substring(3);
- }
+ path = sbPath.toString().replace('\\', File.separatorChar);
} else {
if (path.length() == 1) {
1.7 +56 -1
jakarta-ant/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java
Index: FileUtilsTest.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- FileUtilsTest.java 19 Nov 2001 13:58:52 -0000 1.6
+++ FileUtilsTest.java 7 Mar 2002 16:10:40 -0000 1.7
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -59,6 +59,7 @@
import junit.framework.TestCase;
import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.condition.Os;
/**
* Tests for org.apache.tools.ant.util.FileUtils.
@@ -164,6 +165,29 @@
assertEquals(driveSpec + "\\",
fu.resolveFile(null, driveSpec +
"\\\\\\\\\\\\").getPath());
+ if (Os.isFamily("netware")) {
+ /*
+ * throw in NetWare volume names
+ */
+ driveSpec = "SYS:";
+ assertEquals(driveSpec,
+ fu.resolveFile(null, driveSpec + "/").getPath());
+ assertEquals(driveSpec,
+ fu.resolveFile(null, driveSpec + "\\").getPath());
+ driveSpecLower = "sys:";
+ assertEquals(driveSpec,
+ fu.resolveFile(null, driveSpecLower +
"/").getPath());
+ assertEquals(driveSpec,
+ fu.resolveFile(null, driveSpecLower +
"\\").getPath());
+ /*
+ * promised to eliminate consecutive slashes after drive letter.
+ */
+ assertEquals(driveSpec,
+ fu.resolveFile(null, driveSpec +
"/////").getPath());
+ assertEquals(driveSpec,
+ fu.resolveFile(null, driveSpec +
"\\\\\\\\\\\\").getPath());
+ }
+
/*
* Now test some relative file name magic.
*/
@@ -206,6 +230,8 @@
* throw in drive letters
*/
String driveSpec = "C:";
+ assertEquals(driveSpec,
+ fu.normalize(driveSpec).getPath());
assertEquals(driveSpec + "\\",
fu.normalize(driveSpec + "/").getPath());
assertEquals(driveSpec + "\\",
@@ -222,6 +248,35 @@
fu.normalize(driveSpec + "/////").getPath());
assertEquals(driveSpec + "\\",
fu.normalize(driveSpec + "\\\\\\\\\\\\").getPath());
+
+ if (Os.isFamily("netware")) {
+ /*
+ * throw in NetWare volume names
+ */
+ driveSpec = "SYS:";
+ assertEquals(driveSpec,
+ fu.normalize(driveSpec).getPath());
+ assertEquals(driveSpec,
+ fu.normalize(driveSpec + "/").getPath());
+ assertEquals(driveSpec,
+ fu.normalize(driveSpec + "\\").getPath());
+ driveSpecLower = "sys:";
+ assertEquals(driveSpec,
+ fu.normalize(driveSpecLower).getPath());
+ assertEquals(driveSpec,
+ fu.normalize(driveSpecLower + "/").getPath());
+ assertEquals(driveSpec,
+ fu.normalize(driveSpecLower + "\\").getPath());
+ assertEquals(driveSpec + "\\junk",
+ fu.normalize(driveSpecLower + "\\junk").getPath());
+ /*
+ * promised to eliminate consecutive slashes after drive letter.
+ */
+ assertEquals(driveSpec,
+ fu.normalize(driveSpec + "/////").getPath());
+ assertEquals(driveSpec,
+ fu.normalize(driveSpec + "\\\\\\\\\\\\").getPath());
+ }
/*
* Now test some relative file name magic.
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>