Blame SOURCES/groovy-script

426a5a
#!/bin/sh
426a5a
# 
426a5a
# Groovy script
426a5a
# Lubomir Rintel <lkundrak@v3.sk>
426a5a
426a5a
# Packagers: When updating the package be sure to check
426a5a
# all this against against the upstream binary package
426a5a
426a5a
# Source functions library
426a5a
if [ -f /opt/rh/rh-java-common/root/usr/share/java-utils/java-functions ] ; then
426a5a
  . /opt/rh/rh-java-common/root/usr/share/java-utils/java-functions
426a5a
else
426a5a
  echo "Can't find functions library, aborting"
426a5a
  exit 1
426a5a
fi
426a5a
426a5a
# Configuration
426a5a
SCRIPT_PATH=$0
426a5a
PROGNAME=$(basename $SCRIPT_PATH)
426a5a
GROOVY_CONF=/opt/rh/rh-maven33/root/etc/groovy-starter.conf
426a5a
TOOLS_JAR=$(build-classpath ../../jvm/java/lib/tools)
426a5a
STARTER_MAIN_CLASS=org.codehaus.groovy.tools.GroovyStarter
426a5a
MAIN_CLASS=$STARTER_MAIN_CLASS
426a5a
426a5a
# Wrappers
426a5a
[ $PROGNAME = grape ]		&& CLASS=org.codehaus.groovy.tools.GrapeMain
426a5a
[ $PROGNAME = groovy ]		&& CLASS=groovy.ui.GroovyMain
426a5a
[ $PROGNAME = groovyc ]		&& CLASS=org.codehaus.groovy.tools.FileSystemCompiler
426a5a
[ $PROGNAME = groovyConsole ]	&& CLASS=groovy.ui.Console
426a5a
[ $PROGNAME = java2groovy ]	&& CLASS=org.codehaus.groovy.antlr.java.Java2GroovyMain
426a5a
[ $PROGNAME = groovysh ]	&& CLASS=org.codehaus.groovy.tools.shell.Main
426a5a
[ $PROGNAME = groovysh ]	&& [ "$OLDSHELL" ] && CLASS=groovy.ui.InteractiveShell
426a5a
426a5a
# Load system-wide configuration
426a5a
if [ -f /opt/rh/rh-maven33/root/etc/groovy.conf ]; then
426a5a
  . /opt/rh/rh-maven33/root/etc/groovy.conf
426a5a
fi
426a5a
426a5a
# Load user configuration
426a5a
[ -f "$HOME/.groovyrc" ] && . "$HOME/.groovyrc"
426a5a
[ -f "$HOME/.groovy/startup" ] && . "$HOME/.groovy/startup"
426a5a
426a5a
# Bail out if there's nothing to run
426a5a
if [ -z "$CLASS" ]
426a5a
then
426a5a
	echo "Can not determine main class for '$PROGNAME'" >&2
426a5a
	exit 1
426a5a
fi
426a5a
426a5a
# JVM options
426a5a
GROOVY_OPTS="$GROOVY_OPTS -Dscript.name=$SCRIPT_PATH"
426a5a
GROOVY_OPTS="$GROOVY_OPTS -Dprogram.name=$PROGNAME"
426a5a
GROOVY_OPTS="$GROOVY_OPTS -Dgroovy.starter.conf=$GROOVY_CONF"
426a5a
GROOVY_OPTS="$GROOVY_OPTS -Dgroovy.home=$GROOVY_HOME"
426a5a
GROOVY_OPTS="$GROOVY_OPTS -Dtools.jar=$TOOLS_JAR"
426a5a
426a5a
# Do not forget about RPM dependencies!
426a5a
BASE_JARS="$BASE_JARS ant"
426a5a
BASE_JARS="$BASE_JARS ant/ant-junit"
426a5a
BASE_JARS="$BASE_JARS ant-launcher"
426a5a
BASE_JARS="$BASE_JARS antlr"
426a5a
BASE_JARS="$BASE_JARS objectweb-asm/asm"
426a5a
BASE_JARS="$BASE_JARS objectweb-asm/asm-analysis"
426a5a
BASE_JARS="$BASE_JARS objectweb-asm/asm-tree"
426a5a
BASE_JARS="$BASE_JARS objectweb-asm/asm-util"
426a5a
BASE_JARS="$BASE_JARS bsf"
426a5a
BASE_JARS="$BASE_JARS commons-cli"
426a5a
BASE_JARS="$BASE_JARS commons-logging"
426a5a
BASE_JARS="$BASE_JARS groovy"
426a5a
BASE_JARS="$BASE_JARS ivy"
426a5a
BASE_JARS="$BASE_JARS jline"
426a5a
BASE_JARS="$BASE_JARS tomcat-jsp-api"
426a5a
BASE_JARS="$BASE_JARS junit"
426a5a
BASE_JARS="$BASE_JARS tomcat-servlet-api"
426a5a
BASE_JARS="$BASE_JARS xstream"
426a5a
BASE_JARS="$BASE_JARS jansi"
426a5a
426a5a
if [ "$1" = "-cp" -o "$1" = "-classpath" -o "$1" = "--classpath" ] ; then
426a5a
    ADDITIONAL_JARS="$(echo $2 | tr ':' ' ')"
426a5a
    shift 2
426a5a
fi
426a5a
426a5a
# Set parameters
426a5a
set_jvm
426a5a
set_classpath $BASE_JARS
426a5a
set_flags $BASE_FLAGS
426a5a
set_options $BASE_OPTIONS $GROOVY_OPTS
426a5a
426a5a
# Let's start
426a5a
run --conf "$GROOVY_CONF" --main "$CLASS" "$@"