aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/assembly/bin/sonar-runner
blob: 21c120a46285ee171a975bf9ef227f4a856a175d (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
39
40
41
42
43
#!/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"

  # try to resolve symlinks
  if [ `command -v readlink >/dev/null 2>&1; echo $?` -eq 0 ] ; then
    PRG=`readlink -f "$PRG"`
  fi

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

  # make it fully qualified
  SONAR_RUNNER_HOME=`cd "$SONAR_RUNNER_HOME" && pwd`
fi

# check that the SONAR_RUNNER_HOME has been correctly set
if [ ! -e "$SONAR_RUNNER_HOME/lib/sonar-runner-${project.version}.jar" ] ; then
  echo '$SONAR_RUNNER_HOME' does not point to a valid installation directory: $SONAR_RUNNER_HOME
  exit 1
fi

JAVA_CMD="`which java`"
JAVA_CLASSPATH="${SONAR_RUNNER_HOME}"/lib/sonar-runner-${project.version}.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 "$@"