aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/assembly/bin/sonar-runner
blob: 0aaf46b7f2bbe2d0062ce3b15929f9df1cb630d4 (plain)
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
#!/bin/sh
#
# Sonar Runner Startup Script for Unix
#
# Optional ENV vars:
#   SONAR_RUNNER_HOME - location of runner's installed home dir
#   SONAR_RUNNER_OPTS - parameters passed to the Java VM when running Sonar

if [ -z "$SONAR_RUNNER_HOME" ] ; then
  PRG="$0"

  SONAR_RUNNER_HOME=`dirname "$PRG"`/..

  # make it fully qualified
  SONAR_RUNNER_HOME=`cd "$SONAR_RUNNER_HOME" && pwd`
else
  # check that the SONAR_RUNNER_HOME has been correctly set
  if [ ! -e "$SONAR_RUNNER_HOME/lib/sonar-runner.jar" ] ; then
    echo '$SONAR_RUNNER_HOME' does not point to a valid installation directory: $SONAR_RUNNER_HOME
    exit 0
  fi
fi

JAVA_CMD="`which java`"
JAVA_CLASSPATH="${SONAR_RUNNER_HOME}"/lib/sonar-runner.jar
PROJECT_HOME=`pwd`

#echo "Info: Using sonar-runner at $SONAR_RUNNER_HOME"
#echo "Info: Using java at $JAVA_CMD"
#echo "Info: Using classpath $JAVA_CLASSPATH"
#echo "Info: Using project $PROJECT_HOME"

exec "$JAVA_CMD" \
  $SONAR_RUNNER_OPTS \
  -classpath $JAVA_CLASSPATH \
  "-Drunner.home=${SONAR_RUNNER_HOME}" \
  "-Dproject.home=${PROJECT_HOME}" \
  org.sonar.runner.Main "$@"