2018-01-04 18:14:30 +01:00
|
|
|
rem Changing this for debugging on Appveyor
|
2018-01-04 19:26:57 +01:00
|
|
|
rem @echo off
|
2012-10-19 01:40:31 +02:00
|
|
|
rem
|
|
|
|
rem Configuration variables
|
|
|
|
rem
|
2018-09-07 15:14:37 +02:00
|
|
|
rem MAVEN_HOME
|
|
|
|
rem Home of Maven installation; copy is in the source as tools\apache-ant-*
|
2012-10-19 01:40:31 +02:00
|
|
|
rem
|
|
|
|
rem JAVA_HOME
|
|
|
|
rem Home of Java installation.
|
|
|
|
rem
|
|
|
|
rem JAVA_OPTIONS
|
|
|
|
rem Extra options to pass to the JVM
|
|
|
|
rem
|
|
|
|
|
|
|
|
if "%OS%"=="Windows_NT" @setlocal
|
|
|
|
if "%OS%"=="WINNT" @setlocal
|
|
|
|
|
|
|
|
rem --- First two utilities for exiting --------------------------------------------
|
|
|
|
|
|
|
|
goto endUtils
|
|
|
|
|
|
|
|
:usage
|
|
|
|
echo Usage %0 [options] ^<action^>
|
|
|
|
echo where [options] include:
|
|
|
|
echo.
|
2013-04-11 00:54:38 +02:00
|
|
|
echo "/?" print this message and exit
|
2012-10-19 01:40:31 +02:00
|
|
|
echo.
|
2013-04-11 00:54:38 +02:00
|
|
|
echo "/p <port>" the port that OpenRefine will listen to
|
2012-10-19 01:40:31 +02:00
|
|
|
echo default: 3333
|
|
|
|
echo.
|
2013-04-11 00:54:38 +02:00
|
|
|
echo "/i <interface>" the host interface OpenRefine should bind to
|
2012-10-19 01:40:31 +02:00
|
|
|
echo default: 127.0.0.1
|
|
|
|
echo.
|
2013-04-11 00:54:38 +02:00
|
|
|
echo "/w <path>" path to the webapp
|
2012-10-19 01:40:31 +02:00
|
|
|
echo default src\main\webapp
|
|
|
|
echo.
|
2013-04-11 00:54:38 +02:00
|
|
|
echo "/d" enable JVM debugging (on port 8000)
|
2012-10-19 01:40:31 +02:00
|
|
|
echo.
|
2013-04-11 00:54:38 +02:00
|
|
|
echo "/m <memory>" max memory heap size to use
|
2012-10-19 01:40:31 +02:00
|
|
|
echo default: 1024M
|
|
|
|
echo.
|
2013-04-11 00:54:38 +02:00
|
|
|
echo "/x" enable JMX monitoring (for jconsole and friends)
|
2012-10-19 01:40:31 +02:00
|
|
|
echo.
|
2013-04-11 00:54:38 +02:00
|
|
|
echo "and <action> is one of
|
2012-10-19 01:40:31 +02:00
|
|
|
echo.
|
|
|
|
echo build ..................... Build OpenRefine
|
|
|
|
echo run ....................... Run OpenRefine
|
|
|
|
echo.
|
2018-09-10 15:26:14 +02:00
|
|
|
echo test ...................... Run all the tests
|
2014-11-27 19:15:30 +01:00
|
|
|
echo server_test ............... Run the server tests
|
2018-01-03 19:32:22 +01:00
|
|
|
echo extensions_test ........... Run the extensions tests
|
2014-11-27 19:15:30 +01:00
|
|
|
echo.
|
|
|
|
|
2012-10-19 01:40:31 +02:00
|
|
|
echo clean ..................... Clean compiled classes
|
|
|
|
echo distclean ................. Remove all generated files
|
|
|
|
echo.
|
|
|
|
goto end
|
|
|
|
|
|
|
|
:fail
|
|
|
|
echo Type 'refine /h' for usage.
|
|
|
|
goto end
|
|
|
|
|
|
|
|
:endUtils
|
|
|
|
|
|
|
|
rem --- Read ini file -----------------------------------------------
|
|
|
|
|
|
|
|
set OPTS=
|
|
|
|
|
|
|
|
for /f "tokens=1,* delims==" %%a in (refine.ini) do (
|
|
|
|
set %%a=%%b
|
|
|
|
)
|
|
|
|
|
|
|
|
rem --- Check JAVA_HOME ---------------------------------------------
|
|
|
|
|
|
|
|
if not "%JAVA_HOME%" == "" goto gotJavaHome
|
|
|
|
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.
|
|
|
|
|
|
|
|
goto fail
|
|
|
|
:gotJavaHome
|
|
|
|
|
|
|
|
rem --- Argument parsing --------------------------------------------
|
|
|
|
|
|
|
|
:loop
|
|
|
|
if ""%1"" == """" goto endArgumentParsing
|
|
|
|
if ""%1"" == ""/h"" goto usage
|
|
|
|
if ""%1"" == ""/?"" 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 REFINE_PORT=%2
|
|
|
|
goto shift2loop
|
|
|
|
|
|
|
|
:arg-i
|
|
|
|
set REFINE_HOST=%2
|
|
|
|
goto shift2loop
|
|
|
|
|
|
|
|
:arg-w
|
|
|
|
set REFINE_WEBAPP=%2
|
|
|
|
goto shift2loop
|
|
|
|
|
|
|
|
:arg-m
|
|
|
|
set REFINE_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 "%REFINE_MEMORY%" == "" goto gotMemory
|
|
|
|
set REFINE_MEMORY=1024M
|
2017-06-22 12:27:55 +02:00
|
|
|
if not "%REFINE_MIN_MEMORY%" == "" goto gotMemory
|
|
|
|
set REFINE_MIN_MEMORY=256M
|
2017-11-10 21:44:05 +01:00
|
|
|
|
2012-10-19 01:40:31 +02:00
|
|
|
:gotMemory
|
2017-06-22 12:27:55 +02:00
|
|
|
set OPTS=%OPTS% -Xms%REFINE_MIN_MEMORY% -Xmx%REFINE_MEMORY% -Drefine.memory=%REFINE_MEMORY%
|
2012-10-19 01:40:31 +02:00
|
|
|
|
2017-11-10 21:44:05 +01:00
|
|
|
rem --- Check free memory ---------------------------------------------
|
|
|
|
for /f "usebackq skip=1 tokens=*" %%i in (`wmic os get FreePhysicalMemory ^| findstr /r /v "^$"`) do @set /A freeRam=%%i/1024
|
|
|
|
|
|
|
|
echo You have %freeRam%M of free memory.
|
2017-11-17 14:56:30 +01:00
|
|
|
echo Your current configuration is set to use %REFINE_MEMORY% of memory.
|
2017-11-10 21:44:05 +01:00
|
|
|
echo OpenRefine can run better when given more memory. Read our FAQ on how to allocate more memory here:
|
|
|
|
echo https://github.com/OpenRefine/OpenRefine/wiki/FAQ:-Allocate-More-Memory
|
2017-11-11 15:43:21 +01:00
|
|
|
echo.
|
2017-11-10 21:44:05 +01:00
|
|
|
|
2015-04-18 20:09:46 +02:00
|
|
|
if not "%REFINE_MAX_FORM_CONTENT_SIZE%" == "" goto gotMaxFormContentSize
|
|
|
|
set REFINE_MAX_FORM_CONTENT_SIZE=1048576
|
|
|
|
:gotMaxFormContentSize
|
|
|
|
set OPTS=%OPTS% -Drefine.max_form_content_size=%REFINE_MAX_FORM_CONTENT_SIZE%
|
|
|
|
|
2012-10-19 01:40:31 +02:00
|
|
|
if not "%REFINE_PORT%" == "" goto gotPort
|
|
|
|
set REFINE_PORT=3333
|
|
|
|
:gotPort
|
|
|
|
set OPTS=%OPTS% -Drefine.port=%REFINE_PORT%
|
|
|
|
|
|
|
|
if not "%REFINE_HOST%" == "" goto gotHost
|
|
|
|
set REFINE_HOST=127.0.0.1
|
|
|
|
:gotHost
|
|
|
|
set OPTS=%OPTS% -Drefine.host=%REFINE_HOST%
|
|
|
|
|
|
|
|
if not "%REFINE_WEBAPP%" == "" goto gotWebApp
|
|
|
|
set REFINE_WEBAPP=main\webapp
|
|
|
|
:gotWebApp
|
|
|
|
set OPTS=%OPTS% -Drefine.webapp=%REFINE_WEBAPP%
|
|
|
|
|
|
|
|
if not "%REFINE_CLASSES_DIR%" == "" goto gotClassesDir
|
|
|
|
set REFINE_CLASSES_DIR=server\classes
|
|
|
|
:gotClassesDir
|
|
|
|
|
|
|
|
if not "%REFINE_LIB_DIR%" == "" goto gotLibDir
|
|
|
|
set REFINE_LIB_DIR=server\lib
|
|
|
|
:gotLibDir
|
|
|
|
|
|
|
|
rem ----- Respond to the action ----------------------------------------------------------
|
|
|
|
|
|
|
|
set ACTION=%1
|
|
|
|
|
2018-09-07 15:14:37 +02:00
|
|
|
if ""%ACTION%"" == ""build"" goto doMvn
|
|
|
|
if ""%ACTION%"" == ""server_test"" goto doMvn
|
|
|
|
if ""%ACTION%"" == ""extensions_test"" goto doMvn
|
2018-09-10 15:42:02 +02:00
|
|
|
if ""%ACTION%"" == ""test"" goto doMvn
|
2018-09-07 15:14:37 +02:00
|
|
|
if ""%ACTION%"" == ""clean"" goto doMvn
|
|
|
|
if ""%ACTION%"" == ""distclean"" goto doMvn
|
2012-10-19 01:40:31 +02:00
|
|
|
if ""%ACTION%"" == ""run"" goto doRun
|
|
|
|
|
|
|
|
:doRun
|
2018-01-04 21:25:17 +01:00
|
|
|
rem --- Log for troubleshooting ------------------------------------------
|
|
|
|
echo Getting Java Version...
|
|
|
|
java -version 2^>^&1
|
|
|
|
echo.=====================================================
|
|
|
|
for /f "tokens=*" %%a in ('java -version 2^>^&1 ^| find "version"') do (set JVERSION=%%a)
|
|
|
|
echo Getting Free Ram...
|
|
|
|
wmic os get FreePhysicalMemory
|
|
|
|
for /f "usebackq skip=1 tokens=*" %%i in (`wmic os get FreePhysicalMemory ^| findstr /r /v "^$"`) do @set /A freeRam=%%i/1024
|
|
|
|
(
|
|
|
|
echo -----------------------
|
|
|
|
echo PROCESSOR_ARCHITECTURE = %PROCESSOR_ARCHITECTURE%
|
|
|
|
echo JAVA_HOME = %JAVA_HOME%
|
|
|
|
echo java -version = %JVERSION%
|
|
|
|
echo freeRam = %freeRam%M
|
|
|
|
echo REFINE_MEMORY = %REFINE_MEMORY%
|
|
|
|
echo -----------------------
|
|
|
|
) > support.log
|
|
|
|
|
2018-09-10 14:51:00 +02:00
|
|
|
set LIB_CLASSPATH=('type server/target/classpath.txt')
|
|
|
|
set CLASSPATH="%REFINE_CLASSES_DIR%;%LIB_CLASSPATH%\*"
|
2012-10-19 01:40:31 +02:00
|
|
|
"%JAVA_HOME%\bin\java.exe" -cp %CLASSPATH% %OPTS% -Djava.library.path=%REFINE_LIB_DIR%/native/windows com.google.refine.Refine
|
|
|
|
goto end
|
|
|
|
|
2018-09-07 15:14:37 +02:00
|
|
|
:doMvn
|
|
|
|
if not "%MAVEN_HOME%" == "" goto gotMvnHome
|
2018-09-07 15:19:23 +02:00
|
|
|
echo You must have Apache Maven installed and the MAVEN_HOME environment variable to point to it.
|
2012-10-19 01:40:31 +02:00
|
|
|
echo.
|
|
|
|
echo You can download it from
|
|
|
|
echo.
|
2018-09-07 15:14:37 +02:00
|
|
|
echo https://maven.apache.org/
|
2018-09-07 15:19:23 +02:00
|
|
|
echo
|
|
|
|
echo The environment variable MAVEN_HOME should not include the final "bin" directory, such as:
|
|
|
|
echo
|
|
|
|
echo C:\Program Files (x86)\Apache\Maven
|
2012-10-19 01:40:31 +02:00
|
|
|
echo.
|
|
|
|
echo If you don't know how to set environment variables, follow the instructions at
|
|
|
|
echo.
|
|
|
|
echo http://bit.ly/1c2gkR
|
|
|
|
echo.
|
2018-09-07 15:14:37 +02:00
|
|
|
:gotMvnHome
|
|
|
|
set MVN_ACTION=""%ACTION%""
|
2018-09-10 17:06:37 +02:00
|
|
|
if ""%ACTION%"" == ""build"" set MVN_ACTION=process-resources compile dependency:build-classpath
|
|
|
|
if ""%ACTION%"" == ""test"" set MVN_ACTION=process-resources compile test
|
|
|
|
if ""%ACTION%"" == ""server_test"" set MVN_ACTION=process-resources compile test -f main
|
|
|
|
if ""%ACTION%"" == ""extensions_test"" set MVN_ACTION=process-resources compile test -f extensions
|
2018-09-10 16:29:00 +02:00
|
|
|
call "%MAVEN_HOME%\bin\mvn.cmd" %MVN_ACTION%
|
2018-01-04 21:12:58 +01:00
|
|
|
goto end
|
|
|
|
|
2012-10-19 01:40:31 +02:00
|
|
|
:end
|