antlets/scripts/src/resources lcp.bat,NONE,1.1 main.sh.template,NONE,1.1 main.bat.template,NONE,1.1

[email protected]
Newsgroups gmane.comp.krysalis.metamorphosis.cvs
Message-ID <[email protected]>
Update of /cvsroot/metamorphosis/antlets/scripts/src/resources
In directory sc8-pr-cvs1:/tmp/cvs-serv3722/scripts/src/resources

Added Files:
	lcp.bat main.sh.template main.bat.template 
Log Message:
Scripts generation now works.

--- NEW FILE: lcp.bat ---
REM   Copyright (c) 2001-2002 The Apache Software Foundation.  All rights
REM   reserved.

set _CLASSPATHCOMPONENT=%1
if ""%1""=="""" goto gotAllArgs
shift

:argCheck
if ""%1""=="""" goto gotAllArgs
set _CLASSPATHCOMPONENT=%_CLASSPATHCOMPONENT% %1
shift
goto argCheck

:gotAllArgs
set LOCALCLASSPATH=%_CLASSPATHCOMPONENT%;%LOCALCLASSPATH%


--- NEW FILE: main.sh.template ---
#! /bin/sh

# Autogenerated script to execute the java class
# @MAIN@

# load system-wide @project@ configuration
if [ -f "/etc/@[email protected]" ] ; then 
  . /etc/@[email protected]
fi

# provide default values for people who don't use RPMs
if [ -z "$rpm_mode" ] ; then
  rpm_mode=false;
fi
if [ -z "$usejikes" ] ; then
  usejikes=false;
fi

# load user @project@ configuration
if [ -f "$HOME/.@project@rc" ] ; then 
  . $HOME/.@project@rc
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
           if [ -z "$JAVA_HOME" ] ; then
             JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home   
           fi
           ;;
esac

if [ -z "${@PROJECT@_HOME}" ] ; then
  # try to find @PROJECT@
  if [ -d /opt/@project@ ] ; then 
    @PROJECT@_HOME=/opt/@project@
  fi

  if [ -d "${HOME}/opt/@project@" ] ; then 
    @PROJECT@_HOME="${HOME}/opt/@project@"
  fi

  ## resolve links - $0 may be a link to @project@'s home
  PRG="$0"
  progname=`basename "$0"`

  # need this for relative symlinks
  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
  
  @PROJECT@_HOME=`dirname "$PRG"`/..

  # make it fully qualified
  @PROJECT@_HOME=`cd "${@PROJECT@_HOME}" && pwd`

fi

# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
  [ -n "${@PROJECT@_HOME}" ] &&
    @PROJECT@_HOME=`cygpath --unix "${@PROJECT@_HOME}"`
  [ -n "$JAVA_HOME" ] &&
    JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
  [ -n "$CLASSPATH" ] &&
    CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi

# set @PROJECT@_LIB location
@PROJECT@_LIB="${@PROJECT@_HOME}/lib"

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 1
fi

if [ -n "$CLASSPATH" ] ; then
  LOCALCLASSPATH="$CLASSPATH"
fi

# in rpm_mode get @project@/optional/xml parser&api from JAVALIBDIR 
if $rpm_mode; then
  JAVALIBDIR="/usr/share/java"
  for i in @project@ @project@-optional jaxp_parser xml_apis 
  do
    if [ -z "$LOCALCLASSPATH" ] ; then
      LOCALCLASSPATH="$JAVALIBDIR/$i.jar"
    else
      LOCALCLASSPATH="$JAVALIBDIR/$i.jar:$LOCALCLASSPATH"
    fi
  done

# in rpm mode @project@/lib is in /usr/share/java/@project@
@PROJECT@_LIB="${JAVALIBDIR}/@project@"

fi

# add in the dependency .jar files in non-RPM mode (the default)
for i in "${@PROJECT@_LIB}"/*.jar
do
  # if the directory is empty, then it will return the input string
  # this is stupid, so case for it
  if [ -f "$i" ] ; 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 @project@ 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
#add the Project Jar
LOCALCLASSPATH=$LOCALCLASSPATH:${@PROJECT@_HOME}/@PROJECT_JAR@
# add the extra classpath
LOCALCLASSPATH=$LOCALCLASSPATH:@EXTCLASSPATH@

# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
  @PROJECT@_HOME=`cygpath --path --windows "${@PROJECT@_HOME}"`
  JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
  CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
  LOCALCLASSPATH=`cygpath --path --windows "$LOCALCLASSPATH"`
  CYGHOME=`cygpath --path --windows "$HOME"`
fi

if [ -n "$CYGHOME" ]; then
    exec "$JAVACMD" -classpath "$LOCALCLASSPATH" -D@[email protected]="${@PROJECT@_HOME}" -Dcygwin.user.home="$CYGHOME" ${@PROJECT@_OPTS} @MAIN@  ${@PROJECT@_ARGS} "$@"

else
    exec "$JAVACMD" -classpath "$LOCALCLASSPATH" -D@[email protected]="${@PROJECT@_HOME}" ${@PROJECT@_OPTS} @MAIN@  ${@PROJECT@_ARGS} "$@"

fi

--- NEW FILE: main.bat.template ---
@echo off

REM   Copyright (c) 2001-2002 The Apache Software Foundation.  All rights
REM   reserved.

if exist "%HOME%\@project@rc_pre.bat" call "%HOME%\@project@rc_pre.bat"

if "%OS%"=="Windows_NT" @setlocal

rem %~dp0 is expanded pathname of the current script under NT
set DEFAULT_@PROJECT@_HOME=%~dp0..

if "%@PROJECT@_HOME%"=="" set @PROJECT@_HOME=%DEFAULT_@PROJECT@_HOME%
set DEFAULT_@PROJECT@_HOME=

rem Slurp the command line arguments. This loop allows for an unlimited number
rem of arguments (up to the command line limit, anyway).
set @PROJECT@_CMD_LINE_ARGS=%1
if ""%1""=="""" goto doneStart
shift
:setupArgs
if ""%1""=="""" goto doneStart
set @PROJECT@_CMD_LINE_ARGS=%@PROJECT@_CMD_LINE_ARGS% %1
shift
goto setupArgs
rem This label provides a place for the argument list loop to break out 
rem and for NT handling to skip to.
:doneStart

rem find @PROJECT@_HOME if it does not exist due to either an invalid value passed
rem by the user or the %0 problem on Windows 9x
if exist "%@PROJECT@_HOME%" goto checkJava

rem check for @project@ in Program Files on system drive
if not exist "%SystemDrive%\Program Files\@project@" goto checkSystemDrive
set @PROJECT@_HOME=%SystemDrive%\Program Files\@project@
goto checkJava

:checkSystemDrive
rem check for @project@ in root directory of system drive
if not exist %SystemDrive%\@project@\nul goto checkCDrive
set @PROJECT@_HOME=%SystemDrive%\@project@
goto checkJava

:checkCDrive
rem check for @project@ in C:\@project@ for Win9X users
if not exist C:\@project@\nul goto no@project@Home
set @PROJECT@_HOME=C:\@project@
goto checkJava

:no@project@Home
echo @PROJECT@_HOME is set incorrectly or @project@ could not be located. Please set @PROJECT@_HOME.
goto end

:checkJava
set LOCALCLASSPATH=%CLASSPATH%
for %%i in ("%@PROJECT@_HOME%\lib\*.jar") do call "%@PROJECT@_HOME%\bin\lcp.bat" %%i

if "%JAVA_HOME%" == "" goto noJavaHome
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
set _JAVACMD=%JAVA_HOME%\bin\java.exe
if exist "%JAVA_HOME%\lib\tools.jar" call "%@PROJECT@_HOME%\bin\lcp.bat" %JAVA_HOME%\lib\tools.jar
if exist "%JAVA_HOME%\lib\classes.zip" call "%@PROJECT@_HOME%\bin\lcp.bat" %JAVA_HOME%\lib\classes.zip
set LOCALCLASSPATH=@EXTCLASSPATH@;%@PROJECT@_HOME%\@PROJECT_JAR@;%LOCALCLASSPATH%
goto runproject

:noJavaHome
set _JAVACMD=java.exe
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.


:runproject
"%_JAVACMD%" -classpath "%LOCALCLASSPATH%" "-D@[email protected]=%@PROJECT@_HOME%" %@PROJECT@_OPTS% @MAIN@ 


:end
set LOCALCLASSPATH=
set _JAVACMD=
set @PROJECT@_CMD_LINE_ARGS=

if "%OS%"=="Windows_NT" @endlocal

:mainEnd
if exist "%HOME%\@project@rc_post.bat" call "%HOME%\@project@rc_post.bat"





-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.