Browse Source

Restore antRun.bat for Win9x users.

This should allow the exec task to execute on Win9x. I have changed Glen's
patch to test for platfrom != NT rather than == 98 so it will
support 95.

NOTE: There is an important limitation. Only 9 arguments can be
passed to the command being exec'ed when the antRun.bat file is used. This
should only occur when the directory is not . and the platform is not NT.
This was the original reason this was changed (and antRun.bat) deleted.


Submitted by:	Glen Stampoultzis <trinexus@one.net.au>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@267789 13f79535-47bb-0310-9956-ffa450edef68
master
Conor MacNeill 25 years ago
parent
commit
5fc021b758
3 changed files with 26 additions and 6 deletions
  1. +3
    -3
      build.bat
  2. +9
    -0
      src/bin/antRun.bat
  3. +14
    -3
      src/main/org/apache/tools/ant/taskdefs/Exec.java

+ 3
- 3
build.bat View File

@@ -2,10 +2,10 @@


set REALANTHOME=%ANT_HOME% set REALANTHOME=%ANT_HOME%
set ANT_HOME=. set ANT_HOME=.
if not exist lib\ant.jar call bootstrap.bat
if not exist bin\ant.bat call bootstrap.bat
if not exist bin\lcp.bat call bootstrap.bat
if exist lib\ant.jar if exist bin\ant.bat if exist bin\lcp.bat if exist bin\antRun.bat goto runAnt
call bootstrap.bat


:runAnt
set ANT_INSTALL= set ANT_INSTALL=
if not "%REALANTHOME%" == "" set ANT_INSTALL=-Dant.install %REALANTHOME% if not "%REALANTHOME%" == "" set ANT_INSTALL=-Dant.install %REALANTHOME%
call .\bin\ant.bat %ANT_INSTALL% %1 %2 %3 %4 %5 %6 %7 %8 %9 call .\bin\ant.bat %ANT_INSTALL% %1 %2 %3 %4 %5 %6 %7 %8 %9


+ 9
- 0
src/bin/antRun.bat View File

@@ -0,0 +1,9 @@
@echo off

cd %1
set ANT_RUN_CMD=%2
shift
shift

%ANT_RUN_CMD% %1 %2 %3 %4 %5 %6 %7 %8 %9


+ 14
- 3
src/main/org/apache/tools/ant/taskdefs/Exec.java View File

@@ -63,7 +63,6 @@ import java.io.*;
* @author duncan@x180.com * @author duncan@x180.com
* @author rubys@us.ibm.com * @author rubys@us.ibm.com
*/ */

public class Exec extends Task { public class Exec extends Task {
private String os; private String os;
private String out; private String out;
@@ -95,8 +94,20 @@ public class Exec extends Task {
if (dir == null) dir = project.getBaseDir(); if (dir == null) dir = project.getBaseDir();


if (myos.toLowerCase().indexOf("windows") >= 0) { if (myos.toLowerCase().indexOf("windows") >= 0) {
if (!dir.equals(project.resolveFile(".")))
command = "cmd /c cd " + dir + " && " + command;
if (!dir.equals(project.resolveFile("."))) {
if (myos.toLowerCase().indexOf("nt") >= 0) {
command = "cmd /c cd " + dir + " && " + command;
}
else {
String ant = project.getProperty("ant.home");
if (ant == null) {
throw new BuildException("Property 'ant.home' not found", location);
}
String antRun = project.resolveFile(ant + "/bin/antRun.bat").toString();
command = antRun + " " + dir + " " + command;
}
}
} else { } else {
String ant = project.getProperty("ant.home"); String ant = project.getProperty("ant.home");
if (ant == null) throw new BuildException("Property 'ant.home' not found", location); if (ant == null) throw new BuildException("Property 'ant.home' not found", location);


Loading…
Cancel
Save