2010-02-07 06:25:44 +01:00
|
|
|
@echo off
|
|
|
|
rem
|
|
|
|
rem Configuration variables
|
|
|
|
rem
|
|
|
|
rem JAVA_HOME
|
|
|
|
rem Home of Java installation.
|
|
|
|
rem
|
|
|
|
rem JAVA_OPTIONS
|
|
|
|
rem Extra options to pass to the JVM
|
2010-03-30 23:24:04 +02:00
|
|
|
rem
|
2010-03-08 03:34:25 +01:00
|
|
|
|
2010-02-08 00:15:50 +01:00
|
|
|
if "%OS%"=="Windows_NT" @setlocal
|
|
|
|
if "%OS%"=="WINNT" @setlocal
|
2010-02-07 06:25:44 +01:00
|
|
|
|
|
|
|
rem --- First two utilities for exiting --------------------------------------------
|
|
|
|
|
|
|
|
goto endUtils
|
|
|
|
|
|
|
|
:usage
|
2010-02-08 20:28:13 +01:00
|
|
|
echo Usage %0 [options] ^<action^>
|
2010-02-07 06:25:44 +01:00
|
|
|
echo where [options] include:
|
|
|
|
echo.
|
|
|
|
echo /h print this message and exit
|
|
|
|
echo.
|
2010-03-08 03:34:25 +01:00
|
|
|
echo /p <port> the port that Gridworks will listen to
|
|
|
|
echo default: 3333
|
|
|
|
echo.
|
|
|
|
echo /i <interface> the host interface gridworks should bind to
|
|
|
|
echo default: 127.0.0.1
|
|
|
|
echo.
|
|
|
|
echo /w <path> path to the webapp
|
|
|
|
echo default src\main\webapp
|
|
|
|
echo.
|
2010-03-30 23:24:04 +02:00
|
|
|
echo /d enable JVM debugging (on port 8000)
|
|
|
|
echo.
|
|
|
|
echo /m <memory> max memory heap size to use
|
|
|
|
echo default: 1024M
|
2010-02-07 06:25:44 +01:00
|
|
|
echo.
|
|
|
|
echo /x enable JMX monitoring (for jconsole and friends)
|
|
|
|
echo.
|
2010-03-08 03:34:25 +01:00
|
|
|
echo and <action> is one of
|
|
|
|
echo.
|
|
|
|
echo build ..................... Build Gridworks
|
|
|
|
echo run ....................... Run Gridworks
|
2010-03-30 23:24:04 +02:00
|
|
|
echo.
|
2010-03-08 03:34:25 +01:00
|
|
|
echo clean ..................... Clean compiled classes
|
|
|
|
echo distclean ................. Remove all generated files
|
2010-02-07 06:25:44 +01:00
|
|
|
echo.
|
|
|
|
goto end
|
|
|
|
|
|
|
|
:fail
|
2010-02-10 08:30:16 +01:00
|
|
|
echo Type 'gridworks /h' for usage.
|
2010-02-07 06:25:44 +01:00
|
|
|
goto end
|
|
|
|
|
|
|
|
:endUtils
|
|
|
|
|
|
|
|
if not "%JAVA_HOME%" == "" goto gotJavaHome
|
2010-03-30 23:24:04 +02:00
|
|
|
echo You must set JAVA_HOME to point at your Java Development Kit installation
|
|
|
|
echo.
|
|
|
|
echo If you don't know how to do this, follow the instructions at
|
|
|
|
echo.
|
|
|
|
echo http://bit.ly/1c2gkR
|
|
|
|
echo.
|
|
|
|
|
2010-02-07 06:25:44 +01:00
|
|
|
goto fail
|
|
|
|
:gotJavaHome
|
2010-03-30 23:24:04 +02:00
|
|
|
|
|
|
|
rem --- Read ini file --------------------------------------------
|
|
|
|
|
|
|
|
set OPTS=
|
|
|
|
|
|
|
|
for /f "tokens=1,2 delims==" %%a in (gridworks.ini) do (
|
|
|
|
set %%a=%%b
|
|
|
|
)
|
2010-02-07 06:25:44 +01:00
|
|
|
|
|
|
|
rem --- Argument parsing --------------------------------------------
|
|
|
|
|
|
|
|
:loop
|
|
|
|
if ""%1"" == """" goto endArgumentParsing
|
|
|
|
if ""%1"" == ""/h"" goto usage
|
|
|
|
if ""%1"" == ""/p"" goto arg-p
|
2010-02-08 00:15:50 +01:00
|
|
|
if ""%1"" == ""/i"" goto arg-i
|
|
|
|
if ""%1"" == ""/w"" goto arg-w
|
2010-02-07 06:25:44 +01:00
|
|
|
if ""%1"" == ""/d"" goto arg-d
|
2010-03-30 23:24:04 +02:00
|
|
|
if ""%1"" == ""/m"" goto arg-m
|
2010-02-07 06:25:44 +01:00
|
|
|
if ""%1"" == ""/x"" goto arg-x
|
|
|
|
goto endArgumentParsing
|
|
|
|
|
|
|
|
:arg-p
|
|
|
|
set GRIDWORKS_PORT=%2
|
|
|
|
goto shift2loop
|
2010-03-08 03:34:25 +01:00
|
|
|
|
|
|
|
:arg-i
|
|
|
|
set GRIDWORKS_HOST=%2
|
|
|
|
goto shift2loop
|
|
|
|
|
|
|
|
:arg-w
|
|
|
|
set GRIDWORKS_WEBAPP=%2
|
|
|
|
goto shift2loop
|
2010-03-30 23:24:04 +02:00
|
|
|
|
|
|
|
:arg-m
|
|
|
|
set GRIDWORKS_MEMORY=%2
|
|
|
|
goto shift2loop
|
2010-03-08 03:34:25 +01:00
|
|
|
|
|
|
|
:arg-d
|
2010-02-08 00:15:50 +01:00
|
|
|
set OPTS=%OPTS% -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
|
2010-02-07 06:25:44 +01:00
|
|
|
goto shift2loop
|
|
|
|
|
|
|
|
:arg-x
|
2010-02-08 00:15:50 +01:00
|
|
|
set OPTS=%OPTS% -Dcom.sun.management.jmxremote
|
2010-02-07 06:25:44 +01:00
|
|
|
goto shift2loop
|
|
|
|
|
|
|
|
:shift2loop
|
|
|
|
shift
|
|
|
|
shift
|
|
|
|
goto loop
|
|
|
|
|
|
|
|
:endArgumentParsing
|
|
|
|
|
|
|
|
rem --- Fold in Environment Vars --------------------------------------------
|
|
|
|
|
|
|
|
if not "%JAVA_OPTIONS%" == "" goto gotJavaOptions
|
2010-03-30 23:24:04 +02:00
|
|
|
set JAVA_OPTIONS=
|
2010-02-07 06:25:44 +01:00
|
|
|
:gotJavaOptions
|
2010-02-08 00:15:50 +01:00
|
|
|
set OPTS=%OPTS% %JAVA_OPTIONS%
|
2010-03-30 23:24:04 +02:00
|
|
|
|
|
|
|
if not "%GRIDWORKS_MEMORY%" == "" goto gotMemory
|
|
|
|
set GRIDWORKS_MEMORY=1024M
|
|
|
|
:gotMemory
|
|
|
|
set OPTS=%OPTS% -Xms256M -Xmx%GRIDWORKS_MEMORY%
|
2010-02-07 06:25:44 +01:00
|
|
|
|
|
|
|
if not "%GRIDWORKS_PORT%" == "" goto gotPort
|
|
|
|
set GRIDWORKS_PORT=3333
|
|
|
|
:gotPort
|
2010-02-08 00:15:50 +01:00
|
|
|
set OPTS=%OPTS% -Dgridworks.port=%GRIDWORKS_PORT%
|
2010-03-08 03:34:25 +01:00
|
|
|
|
2010-02-08 00:15:50 +01:00
|
|
|
if not "%GRIDWORKS_HOST%" == "" goto gotHost
|
|
|
|
set GRIDWORKS_HOST=127.0.0.1
|
|
|
|
:gotHOST
|
|
|
|
set OPTS=%OPTS% -Dgridworks.host=%GRIDWORKS_HOST%
|
2010-03-08 03:34:25 +01:00
|
|
|
|
2010-02-08 00:15:50 +01:00
|
|
|
if not "%GRIDWORKS_WEBAPP%" == "" goto gotHost
|
|
|
|
set GRIDWORKS_WEBAPP=src\main\webapp
|
|
|
|
:gotHOST
|
|
|
|
set OPTS=%OPTS% -Dgridworks.webapp=%GRIDWORKS_WEBAPP%
|
2010-03-08 03:34:25 +01:00
|
|
|
|
2010-02-08 00:15:50 +01:00
|
|
|
if not "%GRIDWORKS_BUILD_DIR%" == "" goto gotBuildDir
|
|
|
|
set GRIDWORKS_BUILD_DIR=build
|
|
|
|
:gotBuildDir
|
2010-03-08 03:34:25 +01:00
|
|
|
|
2010-02-08 00:15:50 +01:00
|
|
|
if not "%GRIDWORKS_LIB_DIR%" == "" goto gotLibDir
|
|
|
|
set GRIDWORKS_LIB_DIR=lib
|
|
|
|
:gotLibDir
|
2010-02-07 06:25:44 +01:00
|
|
|
|
|
|
|
rem ----- Respond to the action ----------------------------------------------------------
|
2010-03-08 03:34:25 +01:00
|
|
|
|
2010-02-07 06:25:44 +01:00
|
|
|
set ACTION=%1
|
|
|
|
|
2010-02-10 08:30:16 +01:00
|
|
|
if ""%ACTION%"" == ""build"" goto doAnt
|
|
|
|
if ""%ACTION%"" == ""clean"" goto doAnt
|
|
|
|
if ""%ACTION%"" == ""distclean"" goto doAnt
|
2010-02-07 06:25:44 +01:00
|
|
|
if ""%ACTION%"" == ""run"" goto doRun
|
2010-03-08 03:34:25 +01:00
|
|
|
|
2010-02-08 20:28:13 +01:00
|
|
|
:doRun
|
2010-03-30 23:24:04 +02:00
|
|
|
set CLASSPATH="%GRIDWORKS_BUILD_DIR%\classes;%GRIDWORKS_LIB_DIR%\*"
|
2010-03-08 03:34:25 +01:00
|
|
|
"%JAVA_HOME%\bin\java.exe" -cp %CLASSPATH% %OPTS% -Djava.library.path=lib/native/windows com.metaweb.gridworks.Gridworks
|
|
|
|
goto end
|
|
|
|
|
2010-03-30 23:24:04 +02:00
|
|
|
:doAnt
|
|
|
|
if not "%ANT_HOME%" == "" goto gotAntHome
|
|
|
|
echo You must have Apache Ant installed and the ANT_HOME environment variable to point to it
|
|
|
|
echo.
|
|
|
|
echo You can find a copy of ant in the "\thirdparty" folder or download it from
|
|
|
|
echo.
|
|
|
|
echo http://ant.apache.org/
|
|
|
|
echo.
|
|
|
|
echo If you don't know how to set environment variables, follow the instructions at
|
|
|
|
echo.
|
|
|
|
echo http://bit.ly/1c2gkR
|
|
|
|
echo.
|
|
|
|
:gotAntHome
|
|
|
|
"%ANT_HOME%\bin\ant.bat" -f build.xml -Dbuild.dir="%GRIDWORKS_BUILD_DIR%" %ACTION%
|
2010-03-08 03:34:25 +01:00
|
|
|
goto end
|
2010-02-07 06:25:44 +01:00
|
|
|
|
|
|
|
:end
|