- set native eol properties for the startup scripts for unix and win

- add a whitespace normalizing command to the gridworks script


git-svn-id: http://google-refine.googlecode.com/svn/trunk@595 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
Stefano Mazzocchi 2010-05-04 23:41:57 +00:00
parent 92ecc0c0f5
commit 860172f751
3 changed files with 171 additions and 153 deletions

View File

@ -111,4 +111,4 @@ Others
------ ------
Flag icon Flag icon
http://pixel-mixer.com/category/free-icons/ http://pixel-mixer.com/category/free-icons/

View File

@ -66,6 +66,8 @@ and <action> is one of
pmd ....................... Run PMD against Gridworks pmd ....................... Run PMD against Gridworks
cpd ....................... Run Copy/Paste Detection against Gridworks cpd ....................... Run Copy/Paste Detection against Gridworks
jslint .................... Run JSlint against Gridworks jslint .................... Run JSlint against Gridworks
whitespace <extension> .... Normalize whitespace in files with the given extension
mac_dist <version> ........ Make MacOSX binary distribution mac_dist <version> ........ Make MacOSX binary distribution
windows_dist <version> .... Make Windows binary distribution windows_dist <version> .... Make Windows binary distribution
@ -633,6 +635,21 @@ jslint() {
open "$GRIDWORKS_BUILD_DIR/reports/jslint.txt" open "$GRIDWORKS_BUILD_DIR/reports/jslint.txt"
} }
whitespace() {
[ $# -gt 0 ] || usage
for i in `find . -name *.$1`; do
# expand tabs to spaces
expand -t 4 < $i > $i.1
# convert DOS to UNIX newlines
tr -d '\r' < $i.1 > $i.2
rm $i $i.1
mv $i.2 $i
done
}
# -------------------------- script ----------------------------- # -------------------------- script -----------------------------
# ----- Normalize the current directory ------------------------- # ----- Normalize the current directory -------------------------
@ -779,6 +796,7 @@ add_option "-Dpython.path=$JYTHONPATH"
case "$ACTION" in case "$ACTION" in
build) build_prepare; ant build;; build) build_prepare; ant build;;
clean) ant clean;; clean) ant clean;;
whitespace) whitespace $1;;
distclean) ant distclean;; distclean) ant distclean;;
test) test $1;; test) test $1;;
tests) test $1;; tests) test $1;;

View File

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