-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathrun-groovy.sh
executable file
·62 lines (50 loc) · 2.11 KB
/
run-groovy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
# Set the exit status to the first non-zero status in a pipeline, so if any command in the pipe fails, we'll know.
set -o pipefail
if [[ $# -lt 1 ]]; then
echo "Usage:" $_ "<groovy script> <args> ..."
exit 1
fi
PROGRAM=$1
PROGRAM_BASENAME=$(basename ${PROGRAM} .groovy)
shift
TIMESTAMP=`date +'%Y%m%d-%H%M%S'`
if [[ ! -e $PROGRAM ]]; then
echo "Not found:" $PROGRAM
exit 1
fi
OS=$(uname -o)
if [[ ${OS} == "Cygwin" ]] ; then PLATFORM=Cygwin; fi
GROOVY=${HOME}/code/groovy-1.8.9
GREMLIN_JARS=${HOME}'/code/gremlin-groovy-2.4.0/lib/*'
VIZLINCDB_JARS='../vizlincdb/target/*'
VIZLINCDB_LIB_JARS='../vizlincdb/target/lib/*'
if [[ ${OS} == "Cygwin" ]] ;
then
GROOVY=C:/Users/${USER}/Desktop/Java/groovy-1.8.9
GREMLIN_JARS=C:/Users/${USER}'/Desktop/Java/gremlin-groovy-2.4.0/lib/*'
VIZLINCDB_JARS=C:/Users/${USER}'/Documents/NetBeansProjects/vizlincdb/target/*'
VIZLINCDB_LIB_JARS=C:/Users/${USER}'/Documents/NetBeansProjects/vizlincdb/target/lib/*'
fi
LIB_JARS='lib/*'
GROOVY_ALL_JAR=${GROOVY}/embeddable/groovy-all-1.8.9.jar
SRC='src'
# GROOVY_ALL_JAR should be before GREMLIN_JARS. GREMLIN_JARS includes the non-"all" groovy jar
CP=${SRC}:${GROOVY_ALL_JAR}:${GREMLIN_JARS}:${LIB_JARS}:${VIZLINCDB_JARS}:${VIZLINCDB_LIB_JARS}:${CLASSPATH}
# Change path delimiters to ';' on Windows
if [[ ${OS} == "Cygwin" ]] ;
then
# Must quote due to semicolons.
CP="${SRC};${GROOVY_ALL_JAR};${GREMLIN_JARS};${LIB_JARS};${VIZLINCDB_JARS};${VIZLINCDB_LIB_JARS};${CLASSPATH}"
fi
GC_DEBUG=0
if [ "${GC_DEBUG}" = "1" ] ; then
export JAVA_OPTS="-d64 -server -Xmx12g -XX:+UseConcMarkSweepGC -XX:+PrintGCDetails"
else
export JAVA_OPTS="-d64 -server -Xmx12g -XX:+UseConcMarkSweepGC"
fi
mkdir -p logs
# Use pipefail (see above) so failing status will be caught.
# The groovy command uses the groovy jar, not the groovy-all jar, so the other jars it needs (from groovy's lib directory) may conflict.
# Avoid this problem by running the GroovyMain and using the groovy-all jarjar that includes everything groovy depends on.
java -cp ${CP} groovy.ui.GroovyMain ${PROGRAM} "$@" | tee logs/${PROGRAM_BASENAME}.${TIMESTAMP}.txt