diff --git a/docs/manual/platform.html b/docs/manual/platform.html
index 4091a0fd4..264b8187f 100644
--- a/docs/manual/platform.html
+++ b/docs/manual/platform.html
@@ -47,6 +47,32 @@ it is treated like any other Unix.
Novell Netware
+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).
+
+One important item of note is that you need to set up the following to run ant:
+CLASSPATH
- put ant.jar, crimson.jar, optional.jar, and any other needed jars on the system classpath.
+ ANT_OPTS
- On NetWare, ANT_OPTS
needs to include a parameter of the form, "-envCWD=ANT_HOME
", with ANT_HOME
being the fully expanded location of Ant, not an environment variable. This is due to the fact that the NetWare System Console has no notion of a current working directory.
+
+It is suggested that you create up an ant.ncf that sets up these parameters, and calls perl ANT_HOME/dist/bin/runant.pl
+The following is an example of such an NCF file(assuming ant is installed in 'sys:/jakarta-ant/'):
+
+ envset CLASSPATH=SYS:/jakarta-ant/bootstrap/lib/ant.jar
+ envset CLASSPATH=$CLASSPATH;SYS:/jakarta-ant/lib/crimson.jar
+ envset CLASSPATH=$CLASSPATH;SYS:/jakarta-ant/lib/optional/junit.jar
+ envset CLASSPATH=$CLASSPATH;SYS:/jakarta-ant/bootstrap/lib/optional.jar
+
+ setenv ANT_OPTS=-envCWD=sys:/jakarta-ant
+ envset ANT_OPTS=-envCWD=sys:/jakarta-ant
+ setenv ANT_HOME=sys:/jakarta-ant/dist/lib
+ envset ANT_HOME=sys:/jakarta-ant/dist/lib
+
+ perl sys:/jakarta-ant/dist/bin/runant.pl
+
+
+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.
+JVM 1.3 is supported on Novell NetWare versions 5.1 and higher.
+
+
Other platforms
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
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/Xalan2Executor.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/Xalan2Executor.java
index 476dd8994..537378bf5 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/Xalan2Executor.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/Xalan2Executor.java
@@ -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
diff --git a/src/main/org/apache/tools/ant/types/Description.java b/src/main/org/apache/tools/ant/types/Description.java
index bff872703..edcb5a520 100644
--- a/src/main/org/apache/tools/ant/types/Description.java
+++ b/src/main/org/apache/tools/ant/types/Description.java
@@ -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
diff --git a/src/main/org/apache/tools/ant/util/FileUtils.java b/src/main/org/apache/tools/ant/util/FileUtils.java
index 9febac2b4..e903b405f 100644
--- a/src/main/org/apache/tools/ant/util/FileUtils.java
+++ b/src/main/org/apache/tools/ant/util/FileUtils.java
@@ -79,6 +79,7 @@ import org.apache.tools.ant.BuildException;
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
@@ -99,6 +100,8 @@ public class FileUtils {
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 @@ public class FileUtils {
.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 @@ public class FileUtils {
.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) {
diff --git a/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java b/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java
index 6fc815c66..32987b5c9 100644
--- a/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java
+++ b/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java
@@ -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 java.io.*;
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 @@ public class FileUtilsTest extends TestCase {
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 @@ public class FileUtilsTest extends TestCase {
* throw in drive letters
*/
String driveSpec = "C:";
+ assertEquals(driveSpec,
+ fu.normalize(driveSpec).getPath());
assertEquals(driveSpec + "\\",
fu.normalize(driveSpec + "/").getPath());
assertEquals(driveSpec + "\\",
@@ -223,6 +249,35 @@ public class FileUtilsTest extends TestCase {
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.
*/