Sorry, a typo in Shell.java (args, instead of arg) causes the previously posted patch not to pass any arguments to the build. This one should be a bit better...

Bojan
diff -u --recursive --new-file jakarta-ant-1.4.1/build.xml 
jakarta-ant-1.4.1-patched/build.xml
--- jakarta-ant-1.4.1/build.xml Thu Oct 11 23:58:31 2001
+++ jakarta-ant-1.4.1-patched/build.xml Mon Nov  5 09:19:21 2001
@@ -333,6 +333,7 @@
     <chmod perm="ugo+x" type="file">
        <fileset dir="${dist.bin}">
          <include name="**/ant" />
+         <include name="**/antshell" />
          <include name="**/antRun" />
          <include name="**/runant.pl" />
        </fileset>
diff -u --recursive --new-file 
jakarta-ant-1.4.1/src/main/org/apache/tools/ant/Main.java 
jakarta-ant-1.4.1-patched/src/main/org/apache/tools/ant/Main.java
--- jakarta-ant-1.4.1/src/main/org/apache/tools/ant/Main.java   Thu Oct 11 
23:58:30 2001
+++ jakarta-ant-1.4.1-patched/src/main/org/apache/tools/ant/Main.java   Mon Nov 
 5 09:15:51 2001
@@ -389,7 +389,7 @@
     /**
      * Executes the build.
      */
-    private void runBuild(ClassLoader coreLoader) throws BuildException {
+    protected void runBuild(ClassLoader coreLoader) throws BuildException {
 
         if (!readyToRun) {
             return;
diff -u --recursive --new-file 
jakarta-ant-1.4.1/src/main/org/apache/tools/ant/Shell.java 
jakarta-ant-1.4.1-patched/src/main/org/apache/tools/ant/Shell.java
--- jakarta-ant-1.4.1/src/main/org/apache/tools/ant/Shell.java  Thu Jan  1 
10:00:00 1970
+++ jakarta-ant-1.4.1-patched/src/main/org/apache/tools/ant/Shell.java  Mon Nov 
 5 09:14:50 2001
@@ -0,0 +1,108 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999, 2000 The Apache Software Foundation.  All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ *    any, must include the following acknowlegement:
+ *       "This product includes software developed by the
+ *        Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowlegement may appear in the software itself,
+ *    if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Ant", and "Apache Software
+ *    Foundation" must not be used to endorse or promote products derived
+ *    from this software without prior written permission. For written
+ *    permission, please contact [EMAIL PROTECTED]
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ *    nor may "Apache" appear in their names without prior written
+ *    permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+package org.apache.tools.ant;
+
+import java.io.InputStreamReader;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.util.StringTokenizer;
+
+/**
+ * Command line utility for Ant. Removes the need to start JVM
+ * every time your run a new build in the same directory.
+ * <p>
+ * The Shell accepts all arguments that Ant would normally accept,
+ * in most cases they are target names.
+ * <p>
+ * Type <b>'\q'</b> to exit.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Bojan Smojver</a>
+ */
+
+public class Shell extends Main{
+  private static final String prompt="ant> ",exit="\\q";
+
+  protected Shell(String[] args) throws BuildException{
+    super(args);
+  }
+
+  public static void main(String args[]){
+    BufferedReader inp=new BufferedReader(new InputStreamReader(System.in));
+    String li="";
+    Shell sh=null;
+
+    try{
+      System.out.println("Ant Shell. Type options, targets or '\\q' to exit.");
+      System.out.print(prompt);
+
+      while((li=inp.readLine()) != null && !li.trim().equals(exit)){
+        StringTokenizer st=new StringTokenizer(li);
+        String[] arg=new String[st.countTokens()];
+
+        for(int i=0;i<arg.length;i++) arg[i]=st.nextToken();
+
+        try{
+          sh=new Shell(arg);
+          sh.runBuild(null);
+        } catch(BuildException e){
+          System.err.println("OOPS! BuildException occured.");
+        }
+        System.out.print(prompt);
+      }
+    } catch(IOException e){
+      System.err.println("AIEE! IOException occured. Have to quit.");
+    }
+  }
+}
diff -u --recursive --new-file jakarta-ant-1.4.1/src/script/antshell 
jakarta-ant-1.4.1-patched/src/script/antshell
--- jakarta-ant-1.4.1/src/script/antshell       Thu Jan  1 10:00:00 1970
+++ jakarta-ant-1.4.1-patched/src/script/antshell       Mon Nov  5 08:56:11 2001
@@ -0,0 +1,134 @@
+#! /bin/sh
+
+if [ -f $HOME/.antrc ] ; then 
+  . $HOME/.antrc
+fi
+
+# OS specific support.  $var _must_ be set to either true or false.
+cygwin=false;
+darwin=false;
+case "`uname`" in
+  CYGWIN*) cygwin=true ;;
+  Darwin*) darwin=true ;;
+esac
+
+if [ -z "$ANT_HOME" ] ; then
+  # try to find ANT
+  if [ -d /opt/ant ] ; then 
+    ANT_HOME=/opt/ant
+  fi
+
+  if [ -d ${HOME}/opt/ant ] ; then 
+    ANT_HOME=${HOME}/opt/ant
+  fi
+
+  ## resolve links - $0 may be a link to ant's home
+  PRG=$0
+  progname=`basename $0`
+  
+  while [ -h "$PRG" ] ; do
+    ls=`ls -ld "$PRG"`
+    link=`expr "$ls" : '.*-> \(.*\)$'`
+    if expr "$link" : '.*/.*' > /dev/null; then
+       PRG="$link"
+    else
+       PRG="`dirname $PRG`/$link"
+    fi
+  done
+  
+  ANT_HOME=`dirname "$PRG"`/..
+
+fi
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin ; then
+  [ -n "$ANT_HOME" ] &&
+    ANT_HOME=`cygpath --unix "$ANT_HOME"`
+  [ -n "$JAVA_HOME" ] &&
+    JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+  [ -n "$CLASSPATH" ] &&
+    CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
+fi
+
+if [ -z "$JAVACMD" ] ; then 
+  if [ -n "$JAVA_HOME"  ] ; then
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 
+      # IBM's JDK on AIX uses strange locations for the executables
+      JAVACMD=$JAVA_HOME/jre/sh/java
+    else
+      JAVACMD=$JAVA_HOME/bin/java
+    fi
+  else
+    JAVACMD=java
+  fi
+fi
+ 
+if [ ! -x "$JAVACMD" ] ; then
+  echo "Error: JAVA_HOME is not defined correctly."
+  echo "  We cannot execute $JAVACMD"
+  exit
+fi
+
+if [ -n "$CLASSPATH" ] ; then
+  LOCALCLASSPATH=$CLASSPATH
+fi
+
+# add in the dependency .jar files
+DIRLIBS=${ANT_HOME}/lib/*.jar
+for i in ${DIRLIBS}
+do
+    # if the directory is empty, then it will return the input string
+    # this is stupid, so case for it
+    if [ "$i" != "${DIRLIBS}" ] ; then
+      if [ -z "$LOCALCLASSPATH" ] ; then
+        LOCALCLASSPATH=$i
+      else
+        LOCALCLASSPATH="$i":$LOCALCLASSPATH
+      fi
+    fi
+done
+
+if [ -n "$JAVA_HOME" ] ; then
+  if [ -f "$JAVA_HOME/lib/tools.jar" ] ; then
+    LOCALCLASSPATH=$LOCALCLASSPATH:$JAVA_HOME/lib/tools.jar
+  fi
+
+  if [ -f "$JAVA_HOME/lib/classes.zip" ] ; then
+    LOCALCLASSPATH=$LOCALCLASSPATH:$JAVA_HOME/lib/classes.zip
+  fi
+
+  # OSX hack to make Ant work with jikes
+  if $darwin ; then
+    
OSXHACK="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Classes"
+    if [ -d ${OSXHACK} ] ; then
+      for i in ${OSXHACK}/*.jar
+      do
+        JIKESPATH=$JIKESPATH:$i
+      done
+    fi
+  fi
+
+else
+  echo "Warning: JAVA_HOME environment variable is not set."
+  echo "  If build fails because sun.* classes could not be found"
+  echo "  you will need to set the JAVA_HOME environment variable"
+  echo "  to the installation directory of java."
+fi
+
+# supply JIKESPATH to Ant as jikes.class.path
+if [ -n "$JIKESPATH" ] ; then
+  if [ -n "$ANT_OPTS" ] ; then
+    ANT_OPTS="$ANT_OPTS -Djikes.class.path=$JIKESPATH"
+  else
+    ANT_OPTS=-Djikes.class.path=$JIKESPATH
+  fi
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+  ANT_HOME=`cygpath --path --windows "$ANT_HOME"`
+  JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
+  LOCALCLASSPATH=`cygpath --path --windows "$LOCALCLASSPATH"`
+fi
+
+$JAVACMD -classpath "$LOCALCLASSPATH" -Dant.home="${ANT_HOME}" $ANT_OPTS 
org.apache.tools.ant.Shell "$@"
diff -u --recursive --new-file jakarta-ant-1.4.1/src/script/antshell.bat 
jakarta-ant-1.4.1-patched/src/script/antshell.bat
--- jakarta-ant-1.4.1/src/script/antshell.bat   Thu Jan  1 10:00:00 1970
+++ jakarta-ant-1.4.1-patched/src/script/antshell.bat   Mon Nov  5 08:56:11 2001
@@ -0,0 +1,110 @@
[EMAIL PROTECTED] off
+
+if exist "%HOME%\antrc_pre.bat" call "%HOME%\antrc_pre.bat"
+
+if not "%OS%"=="Windows_NT" goto win9xStart
+:winNTStart
[EMAIL PROTECTED]
+
+rem %~dp0 is name of current script under NT
+set DEFAULT_ANT_HOME=%~dp0
+
+rem : operator works similar to make : operator
+set DEFAULT_ANT_HOME=%DEFAULT_ANT_HOME%\..
+
+if "%ANT_HOME%"=="" set ANT_HOME=%DEFAULT_ANT_HOME%
+set DEFAULT_ANT_HOME=
+
+rem Need to check if we are using the 4NT shell...
+if "%eval[2+2]" == "4" goto setup4NT
+
+rem On NT/2K grab all arguments at once
+set ANT_CMD_LINE_ARGS=%*
+goto doneStart
+
+:setup4NT
+set ANT_CMD_LINE_ARGS=%$
+goto doneStart
+
+:win9xStart
+rem Slurp the command line arguments.  This loop allows for an unlimited 
number of 
+rem agruments (up to the command line limit, anyway).
+
+set ANT_CMD_LINE_ARGS=
+
+:setupArgs
+if %1a==a goto doneStart
+set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1
+shift
+goto setupArgs
+
+:doneStart
+rem This label provides a place for the argument list loop to break out 
+rem and for NT handling to skip to.
+
+rem find ANT_HOME
+if not "%ANT_HOME%"=="" goto checkJava
+
+rem check for ant in Program Files on system drive
+if not exist "%SystemDrive%\Program Files\ant" goto checkSystemDrive
+set ANT_HOME=%SystemDrive%\Program Files\ant
+goto checkJava
+
+:checkSystemDrive
+rem check for ant in root directory of system drive
+if not exist %SystemDrive%\ant\nul goto checkCDrive
+set ANT_HOME=%SystemDrive%\ant
+goto checkJava
+
+:checkCDrive
+rem check for ant in C:\ant for Win9X users
+if not exist C:\ant\nul goto noAntHome
+set ANT_HOME=C:\ant
+goto checkJava
+
+:noAntHome
+echo ANT_HOME is not set and ant could not be located. Please set ANT_HOME.
+goto end
+
+:checkJava
+set _JAVACMD=%JAVACMD%
+set LOCALCLASSPATH=%CLASSPATH%
+for %%i in ("%ANT_HOME%\lib\*.jar") do call "%ANT_HOME%\bin\lcp.bat" %%i
+
+if "%JAVA_HOME%" == "" goto noJavaHome
+if "%_JAVACMD%" == "" set _JAVACMD=%JAVA_HOME%\bin\java
+if exist "%JAVA_HOME%\lib\tools.jar" call "%ANT_HOME%\bin\lcp.bat" 
%JAVA_HOME%\lib\tools.jar
+if exist "%JAVA_HOME%\lib\classes.zip" call "%ANT_HOME%\bin\lcp.bat" 
%JAVA_HOME%\lib\classes.zip
+goto checkJikes
+
+:noJavaHome
+if "%_JAVACMD%" == "" set _JAVACMD=java
+echo.
+echo Warning: JAVA_HOME environment variable is not set.
+echo   If build fails because sun.* classes could not be found
+echo   you will need to set the JAVA_HOME environment variable
+echo   to the installation directory of java.
+echo.
+
+:checkJikes
+if not "%JIKESPATH%" == "" goto runAntWithJikes
+
+:runAnt
+"%_JAVACMD%" -classpath "%LOCALCLASSPATH%" -Dant.home="%ANT_HOME%" %ANT_OPTS% 
org.apache.tools.ant.Shell %ANT_CMD_LINE_ARGS%
+goto end
+
+:runAntWithJikes
+"%_JAVACMD%" -classpath "%LOCALCLASSPATH%" -Dant.home="%ANT_HOME%" 
-Djikes.class.path="%JIKESPATH%" %ANT_OPTS% org.apache.tools.ant.Shell 
%ANT_CMD_LINE_ARGS%
+
+:end
+set LOCALCLASSPATH=
+set _JAVACMD=
+set ANT_CMD_LINE_ARGS=
+
+if not "%OS%"=="Windows_NT" goto mainEnd
+:winNTend
[EMAIL PROTECTED]
+
+:mainEnd
+if exist "%HOME%\antrc_post.bat" call "%HOME%\antrc_post.bat"
+

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to