donaldp 01/11/15 00:02:40
Modified: src/main/org/apache/tools/ant/taskdefs Execute.java
Log:
Added slightly modified version of Execute.
Script adds support for Netware in Execute. In the case of a non JVM
supported execute (ie when changing dirs pre1.3) will call out to a perl script.
Submitted by: "Jeff Tulley" <[EMAIL PROTECTED]>
Revision Changes Path
1.25 +64 -0
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Execute.java
Index: Execute.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Execute.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- Execute.java 2001/11/02 07:56:52 1.24
+++ Execute.java 2001/11/15 08:02:40 1.25
@@ -145,6 +145,20 @@
shellLauncher = new ScriptCommandLauncher("bin/antRun.bat",
baseLauncher);
}
}
+ else if ( (new Os("netware")).eval() ) {
+ // NetWare. Need to determine which JDK we're running in
+ CommandLauncher baseLauncher;
+ if ( System.getProperty("java.version").startsWith("1.1") ) {
+ // JDK 1.1
+ baseLauncher = new Java11CommandLauncher();
+ }
+ else {
+ // JDK 1.2
+ baseLauncher = new CommandLauncher();
+ }
+
+ shellLauncher = new PerlScriptCommandLauncher("bin/antRun.pl",
baseLauncher);
+ }
else {
// Generic
shellLauncher = new ScriptCommandLauncher("bin/antRun", new
CommandLauncher());
@@ -719,6 +733,56 @@
newcmd[0] = antRun;
newcmd[1] = commandDir.getAbsolutePath();
System.arraycopy(cmd, 0, newcmd, 2, cmd.length);
+
+ return exec(project, newcmd, env);
+ }
+
+ private String _script;
+ }
+
+ /**
+ * A command launcher that uses an auxiliary perl script to launch
commands
+ * in directories other than the current working directory.
+ */
+ private static class PerlScriptCommandLauncher extends
CommandLauncherProxy
+ {
+ PerlScriptCommandLauncher(String script, CommandLauncher launcher)
+ {
+ super(launcher);
+ _script = script;
+ }
+
+ /**
+ * Launches the given command in a new process, in the given working
+ * directory
+ */
+ public Process exec(Project project, String[] cmd, String[] env,
File workingDir) throws IOException
+ {
+ if ( project == null ) {
+ if ( workingDir == null ) {
+ return exec(project, cmd, env);
+ }
+ throw new IOException("Cannot locate antRun script: No
project provided");
+ }
+
+ // Locate the auxiliary script
+ String antHome = project.getProperty("ant.home");
+ if ( antHome == null ) {
+ throw new IOException("Cannot locate antRun script: Property
'ant.home' not found");
+ }
+ String antRun = project.resolveFile(antHome + File.separator +
_script).toString();
+
+ // Build the command
+ File commandDir = workingDir;
+ if ( workingDir == null && project != null ) {
+ commandDir = project.getBaseDir();
+ }
+
+ String[] newcmd = new String[cmd.length + 3];
+ newcmd[0] = "perl";
+ newcmd[1] = antRun;
+ newcmd[2] = commandDir.getAbsolutePath();
+ System.arraycopy(cmd, 0, newcmd, 3, cmd.length);
return exec(project, newcmd, env);
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>