When running ant in JShell (http://www.vmeng.com/beard/JShell), it
can use Runtime.exec() directly to execute other program written in
the shell, therefore, I don't need any helper batch files, etc. These
patches reflect that. We might want to have a more selective test,
such as if (myos.equals("Mac OS") &&
System.getProperty("org.jxe.Home", null) != null).
Here are the patches:
Index: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Execute.java
===================================================================
RCS file:
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Execute.java,v
retrieving revision 1.2
diff -u -2 -r1.2 Execute.java
--- jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Execute.java
2000/07/25 12:03:26 1.2
+++ jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Execute.java
2000/07/29 15:14:23
@@ -120,21 +120,23 @@
!antWorkingDirectory.equals(workingDirectory.getAbsolutePath())) {
- if (myos.toLowerCase().indexOf("windows") >= 0 &&
- myos.toLowerCase().indexOf("nt") >= 0) {
-
- commandLine = new String[cmdl.length+5];
- commandLine[0] = "cmd";
- commandLine[1] = "/c";
- commandLine[2] = "cd";
- commandLine[3] = workingDirectory.getAbsolutePath();
- commandLine[4] = "&&";
- System.arraycopy(cmdl, 0, commandLine, 5, cmdl.length);
-
- } else {
- commandLine = new String[cmdl.length+2];
- commandLine[0] = antRun;
- commandLine[1] = workingDirectory.getAbsolutePath();
- System.arraycopy(cmdl, 0, commandLine, 2, cmdl.length);
- }
+ if (!myos.equals("Mac OS")) {
+ if (myos.toLowerCase().indexOf("windows") >= 0 &&
+ myos.toLowerCase().indexOf("nt") >= 0) {
+
+ commandLine = new String[cmdl.length+5];
+ commandLine[0] = "cmd";
+ commandLine[1] = "/c";
+ commandLine[2] = "cd";
+ commandLine[3] = workingDirectory.getAbsolutePath();
+ commandLine[4] = "&&";
+ System.arraycopy(cmdl, 0, commandLine, 5,
cmdl.length);
+
+ } else {
+ commandLine = new String[cmdl.length+2];
+ commandLine[0] = antRun;
+ commandLine[1] = workingDirectory.getAbsolutePath();
+ System.arraycopy(cmdl, 0, commandLine, 2,
cmdl.length);
+ }
+ }
}
@@ -190,14 +192,16 @@
*/
public void setAntRun(Project project) throws BuildException {
- String ant = project.getProperty("ant.home");
- if (ant == null) {
- throw new BuildException("Property 'ant.home' not found");
- }
-
- if (myos.toLowerCase().indexOf("windows") >= 0) {
- antRun = project.resolveFile(ant +
"/bin/antRun.bat").toString();
- } else {
- antRun = project.resolveFile(ant +
"/bin/antRun").toString();
- }
+ if (!myos.equals("Mac OS")) {
+ String ant = project.getProperty("ant.home");
+ if (ant == null) {
+ throw new BuildException("Property 'ant.home' not found");
+ }
+
+ if (myos.toLowerCase().indexOf("windows") >= 0) {
+ antRun = project.resolveFile(ant +
"/bin/antRun.bat").toString();
+ } else {
+ antRun = project.resolveFile(ant +
"/bin/antRun").toString();
+ }
+ }
}
Index: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Exec.java
===================================================================
RCS file:
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Exec.java,v
retrieving revision 1.15
diff -u -2 -r1.15 Exec.java
--- jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Exec.java
2000/07/15 06:31:42 1.15
+++ jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Exec.java
2000/07/29 15:14:21
@@ -94,5 +94,9 @@
if (dir == null) dir = project.getBaseDir();
- if (myos.toLowerCase().indexOf("windows") >= 0) {
+ if (myos.equals("Mac OS")) {
+ // MRJ tracks "user.dir" property for the current working directory.
+ if (!dir.equals(project.resolveFile(".")))
+ System.getProperties().put("user.dir", dir);
+ } else if (myos.toLowerCase().indexOf("windows") >= 0) {
if (!dir.equals(project.resolveFile("."))) {
if (myos.toLowerCase().indexOf("nt") >= 0) {
- Patrick
--
// Patrick C. Beard
// Java Runtime Enthusiast -- "Will invoke interfaces for food."
// mailto:[EMAIL PROTECTED]