patrickl 2002/08/04 11:21:08 Modified: jasper2 build.xml jasper2/src/bin jspc.bat jspc.sh Added: jasper2/src/bin jasper.bat jasper.sh jspc-using-launcher.bat jspc-using-launcher.sh Log: Make use of commons-launcher optional by restoring the old scripts and renaming the commons-launcher scripts to *-using-launcher.*. The commons-launcher scripts and supporting class and jar files will only be added to the build if commons-launcher.jar is detected by the build. If commons-launcher.jar is not detected by the build, only the old scripts will be included in the build. Revision Changes Path 1.14 +24 -6 jakarta-tomcat-jasper/jasper2/build.xml Index: build.xml =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/build.xml,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- build.xml 1 Aug 2002 17:57:25 -0000 1.13 +++ build.xml 4 Aug 2002 18:21:08 -0000 1.14 @@ -56,6 +56,18 @@ <target name="build-prepare"> <available classname="junit.framework.TestCase" property="junit.present" /> + <available property="launcher.present" + classname="org.apache.commons.launcher.Launcher" + classpath="${commons-daemon-launcher.jar}"/> + <available property="launcher.bootstrap.present" + file="${commons-daemon-launcher-bootstrap.class}"/> + + <condition property="copy.launcher.jars"> + <and> + <equals arg1="${launcher.present}" arg2="true" /> + <equals arg1="${launcher.bootstrap.present}" arg2="true" /> + </and> + </condition> <mkdir dir="${jasper.build}"/> <mkdir dir="${jasper.build}/bin"/> @@ -67,21 +79,27 @@ </target> - <!-- =================== BUILD: Copy Static Files ======================= --> - <target name="build-static" depends="build-prepare"> - - <!-- Copy the launcher classes --> + <!-- =================== BUILD: Copy Launcher Files ===================== --> + <target name="copy-launcher.jars" if="copy.launcher.jars"> <copy todir="${jasper.build}/common/lib" file="${ant.jar}"/> <copy todir="${jasper.build}/bin" file="${commons-daemon-launcher.jar}"/> <copy todir="${jasper.build}/bin" file="${commons-daemon-launcher-bootstrap.class}"/> + <copy todir="${jasper.build}/bin"> + <fileset dir="src/bin" includes="*-using-launcher.*,launcher.properties,jasper.xml" /> + </copy> + </target> + + + <!-- =================== BUILD: Copy Static Files ======================= --> + <target name="build-static" depends="build-prepare,copy-launcher.jars"> <!-- Executable Commands --> <copy todir="${jasper.build}/bin"> - <fileset dir="src/bin" /> + <fileset dir="src/bin" excludes="*-using-launcher.*,launcher.properties,jasper.xml" /> </copy> <fixcrlf srcdir="${jasper.build}/bin" includes="*.sh" eol="lf"/> <fixcrlf srcdir="${jasper.build}/bin" includes="*.bat" eol="crlf"/> - <chmod perm="+x" file="${jasper.build}/bin/jspc.sh"/> + <chmod perm="+x" dir="${jasper.build}/bin" includes="*.sh"/> </target> 1.3 +22 -21 jakarta-tomcat-jasper/jasper2/src/bin/jspc.bat Index: jspc.bat =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/bin/jspc.bat,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- jspc.bat 1 Aug 2002 17:55:51 -0000 1.2 +++ jspc.bat 4 Aug 2002 18:21:08 -0000 1.3 @@ -1,31 +1,33 @@ @echo off if "%OS%" == "Windows_NT" setlocal - rem --------------------------------------------------------------------------- +rem Script to run the Jasper "offline JSP compiler" rem -rem Script for running JSPC compiler using the Launcher -rem +rem $Id$ rem --------------------------------------------------------------------------- -rem Get standard environment variables -set PRG=%0 -if exist %PRG%\..\setenv.bat goto gotCmdPath -rem %0 must have been found by DOS using the %PATH% so we assume that -rem setenv.bat will also be found in the %PATH% -call setenv.bat -goto doneSetenv -:gotCmdPath -call %PRG%\..\setenv.bat -:doneSetenv - -rem Make sure prerequisite environment variables are set -if not "%JAVA_HOME%" == "" goto gotJavaHome -echo The JAVA_HOME environment variable is not defined +rem Guess JASPER_HOME if not defined +if not "%JASPER_HOME%" == "" goto gotHome +set JASPER_HOME=. +if exist "%JASPER_HOME%\bin\jspc.bat" goto okHome +set JASPER_HOME=.. +:gotHome +if exist "%JASPER_HOME%\bin\jspc.bat" goto okHome +echo The JASPER_HOME environment variable is not defined correctly echo This environment variable is needed to run this program goto end -:gotJavaHome +:okHome + +set EXECUTABLE=%JASPER_HOME%\bin\jasper.bat + +rem Check that target executable exists +if exist "%EXECUTABLE%" goto okExec +echo Cannot find %EXECUTABLE% +echo This file is needed to run this program +goto end +:okExec -rem Get command line arguments and save them with the proper quoting +rem Get remaining unshifted command line arguments and save them in the set CMD_LINE_ARGS= :setArgs if ""%1""=="""" goto doneSetArgs @@ -34,7 +36,6 @@ goto setArgs :doneSetArgs -rem Execute the Launcher using the "jspc" target -"%JAVA_HOME%\bin\java.exe" -classpath %PRG%\..;"%PATH%" LauncherBootstrap -launchfile jasper.xml -verbose jspc %CMD_LINE_ARGS% +call "%EXECUTABLE%" jspc %CMD_LINE_ARGS% :end 1.3 +13 -11 jakarta-tomcat-jasper/jasper2/src/bin/jspc.sh Index: jspc.sh =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/bin/jspc.sh,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- jspc.sh 1 Aug 2002 17:55:51 -0000 1.2 +++ jspc.sh 4 Aug 2002 18:21:08 -0000 1.3 @@ -1,15 +1,14 @@ #!/bin/sh - # ----------------------------------------------------------------------------- +# Script to run the Jasper "offline JSP compiler" # -# Script for running JSPC compiler using the Launcher -# +# $Id$ # ----------------------------------------------------------------------------- -# Resolve links - $0 may be a softlink +# resolve links - $0 may be a softlink PRG="$0" -while [ -h "$PRG" ]; do +while [ -h "$PRG" ] ; do ls=`ls -ld "$PRG"` link=`expr "$ls" : '.*-> \(.*\)$'` if expr "$link" : '.*/.*' > /dev/null; then @@ -18,12 +17,15 @@ PRG=`dirname "$PRG"`/"$link" fi done - -# Get standard environment variables + PRGDIR=`dirname "$PRG"` -if [ -r "$PRGDIR"/setenv.sh ]; then - . "$PRGDIR"/setenv.sh +EXECUTABLE=jasper.sh + +# Check that target executable exists +if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then + echo "Cannot find $PRGDIR/$EXECUTABLE" + echo "This file is needed to run this program" + exit 1 fi -# Execute the Launcher using the "jspc" target -exec "$JAVA_HOME"/bin/java -classpath "$PRGDIR" LauncherBootstrap -launchfile jasper.xml -verbose jspc "$@" +exec "$PRGDIR"/"$EXECUTABLE" jspc "$@" 1.4 +0 -0 jakarta-tomcat-jasper/jasper2/src/bin/jasper.bat 1.4 +0 -0 jakarta-tomcat-jasper/jasper2/src/bin/jasper.sh 1.1 jakarta-tomcat-jasper/jasper2/src/bin/jspc-using-launcher.bat Index: jspc-using-launcher.bat =================================================================== @echo off if "%OS%" == "Windows_NT" setlocal rem --------------------------------------------------------------------------- rem rem Script for running JSPC compiler using the Launcher rem rem --------------------------------------------------------------------------- rem Get standard environment variables set PRG=%0 if exist %PRG%\..\setenv.bat goto gotCmdPath rem %0 must have been found by DOS using the %PATH% so we assume that rem setenv.bat will also be found in the %PATH% call setenv.bat goto doneSetenv :gotCmdPath call %PRG%\..\setenv.bat :doneSetenv rem Make sure prerequisite environment variables are set if not "%JAVA_HOME%" == "" goto gotJavaHome echo The JAVA_HOME environment variable is not defined echo This environment variable is needed to run this program goto end :gotJavaHome rem Get command line arguments and save them with the proper quoting set CMD_LINE_ARGS= :setArgs if ""%1""=="""" goto doneSetArgs set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1 shift goto setArgs :doneSetArgs rem Execute the Launcher using the "jspc" target "%JAVA_HOME%\bin\java.exe" -classpath %PRG%\..;"%PATH%" LauncherBootstrap -launchfile jasper.xml -verbose jspc %CMD_LINE_ARGS% :end 1.1 jakarta-tomcat-jasper/jasper2/src/bin/jspc-using-launcher.sh Index: jspc-using-launcher.sh =================================================================== #!/bin/sh # ----------------------------------------------------------------------------- # # Script for running JSPC compiler using the Launcher # # ----------------------------------------------------------------------------- # Resolve links - $0 may be a softlink PRG="$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 # Get standard environment variables PRGDIR=`dirname "$PRG"` if [ -r "$PRGDIR"/setenv.sh ]; then . "$PRGDIR"/setenv.sh fi # Execute the Launcher using the "jspc" target exec "$JAVA_HOME"/bin/java -classpath "$PRGDIR" LauncherBootstrap -launchfile jasper.xml -verbose jspc "$@"
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>