You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by me...@locus.apache.org on 2000/11/14 18:21:23 UTC

cvs commit: jakarta-ant/src/antidote/bin antidote antidote.bat

metasim     00/11/14 09:21:23

  Added:       src/antidote/bin antidote antidote.bat
  Log:
  Added scripts for launching Antidote, and updated the build file to make better
  use of the Ant build directory for libraries, etc.
  
  Revision  Changes    Path
  1.1                  jakarta-ant/src/antidote/bin/antidote
  
  Index: antidote
  ===================================================================
  #! /bin/sh
  
  if [ -f $HOME/.antrc ] ; then 
    . $HOME/.antrc
  fi
  
  if [ "$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
  
  # Allow .antrc to specifiy flags to java cmd
  if [ "$JAVACMD" = "" ] ; then 
    JAVACMD=java
  fi
  
  LOCALCLASSPATH=`echo $ANT_HOME/lib/*.jar | tr ' ' ':'`
  
  if [ "$CLASSPATH" != "" ] ; then
    LOCALCLASSPATH=$CLASSPATH:$LOCALCLASSPATH
  fi
  
  if [ "$JAVA_HOME" != "" ] ; then
    if test -f $JAVA_HOME/lib/tools.jar ; then
      LOCALCLASSPATH=$LOCALCLASSPATH:$JAVA_HOME/lib/tools.jar
    fi
  
    if test -f $JAVA_HOME/lib/classes.zip ; then
      LOCALCLASSPATH=$LOCALCLASSPATH:$JAVA_HOME/lib/classes.zip
    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 [ "$JIKESPATH" != "" ] ; then
    if [ "$ANT_OPTS" != "" ] ; then
      ANT_OPTS="$ANT_OPTS -Djikes.class.path=$JIKESPATH"
    else
      ANT_OPTS=-Djikes.class.path=$JIKESPATH
    fi
  fi
  
  $JAVACMD -classpath $LOCALCLASSPATH -Dant.home=${ANT_HOME} $ANT_OPTS org.apache.tools.ant.gui.Main $@
  
  
  
  
  1.1                  jakarta-ant/src/antidote/bin/antidote.bat
  
  Index: antidote.bat
  ===================================================================
  @echo off
  
  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 doneArgs
  set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1
  shift
  goto setupArgs
  
  :doneArgs
  rem The doneArgs label is here just to provide a place for the argument list loop
  rem to break out 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" goto noAntHome
  set ANT_HOME=%SystemDrive%\ant
  goto checkJava
  
  :noAntHome
  echo ANT_HOME is not set and ant could not be located. Please set ANT_HOME.
  goto end
  
  :checkJava
  if "%JAVACMD%" == "" set JAVACMD=java
  
  set LOCALCLASSPATH="%CLASSPATH%"
  for %%i in ("%ANT_HOME%\lib\*.jar") do call "%ANT_HOME%\bin\lcp.bat" "%%i"
  
  if "%JAVA_HOME%" == "" goto noJavaHome
  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
  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.Main %ANT_CMD_LINE_ARGS%
  goto end
  
  :runAntWithJikes
  %JAVACMD% -classpath %LOCALCLASSPATH% -Dant.home="%ANT_HOME%" -Djikes.class.path=%JIKESPATH% %ANT_OPTS% org.apache.tools.ant.gui.Main %ANT_CMD_LINE_ARGS%
  
  :end
  set LOCALCLASSPATH=
  set ANT_CMD_LINE_ARGS=