You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

sonar-runner 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #!/bin/sh
  2. #
  3. # Sonar Runner Startup Script for Unix
  4. #
  5. # Optional ENV vars:
  6. # SONAR_RUNNER_HOME - location of runner's installed home dir
  7. # SONAR_RUNNER_OPTS - parameters passed to the Java VM when running Sonar
  8. # The following notice only apply to real_path function copied from
  9. # https://sites.google.com/site/jdisnard/realpath
  10. # Copyright 2010 Jon Disnard. All rights reserved.
  11. #
  12. # Redistribution and use in source and binary forms, with or without modification, are
  13. # permitted provided that the following conditions are met:
  14. #
  15. # 1. Redistributions of source code must retain the above copyright notice, this list of
  16. # conditions and the following disclaimer.
  17. #
  18. # 2. Redistributions in binary form must reproduce the above copyright notice, this list
  19. # of conditions and the following disclaimer in the documentation and/or other materials
  20. # provided with the distribution.
  21. #
  22. # THIS SOFTWARE IS PROVIDED BY Jon Disnard ``AS IS'' AND ANY EXPRESS OR IMPLIED
  23. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  24. # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> OR
  25. # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  26. # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  27. # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  28. # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  29. # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  30. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. #
  32. # The views and conclusions contained in the software and documentation are those of the
  33. # authors and should not be interpreted as representing official policies, either expressed
  34. # or implied, of Jon Disnard.
  35. real_path () {
  36. OIFS=$IFS
  37. IFS='/'
  38. for I in $1
  39. do
  40. # Resolve relative path punctuation.
  41. if [ "$I" = "." ] || [ -z "$I" ]
  42. then continue
  43. elif [ "$I" = ".." ]
  44. then FOO="${FOO%%/${FOO##*/}}"
  45. continue
  46. else FOO="${FOO}/${I}"
  47. fi
  48. # Dereference symbolic links.
  49. if [ -h "$FOO" ] && [ -x "/bin/ls" ]
  50. then IFS=$OIFS
  51. set `/bin/ls -l "$FOO"`
  52. while shift ;
  53. do
  54. if [ "$1" = "->" ]
  55. then FOO=$2
  56. shift $#
  57. break
  58. fi
  59. done
  60. fi
  61. done
  62. IFS=$OIFS
  63. echo "$FOO"
  64. }
  65. if [ -z "$SONAR_RUNNER_HOME" ] ; then
  66. PRG="$0"
  67. # resolve symlinks
  68. PRG=`real_path "$PRG"`
  69. SONAR_RUNNER_HOME=`dirname "$PRG"`/..
  70. # make it fully qualified
  71. SONAR_RUNNER_HOME=`cd "$SONAR_RUNNER_HOME" && pwd`
  72. fi
  73. # check that the SONAR_RUNNER_HOME has been correctly set
  74. if [ ! -e "$SONAR_RUNNER_HOME/lib/sonar-runner-impl-${project.version}.jar" ] ; then
  75. echo '$SONAR_RUNNER_HOME' does not point to a valid installation directory: $SONAR_RUNNER_HOME
  76. exit 1
  77. fi
  78. JAVA_CMD="`which java`"
  79. JAVA_CLASSPATH="${SONAR_RUNNER_HOME}"/lib/sonar-runner-impl-${project.version}.jar
  80. PROJECT_HOME=`pwd`
  81. #echo "Info: Using sonar-runner at $SONAR_RUNNER_HOME"
  82. #echo "Info: Using java at $JAVA_CMD"
  83. #echo "Info: Using classpath $JAVA_CLASSPATH"
  84. #echo "Info: Using project $PROJECT_HOME"
  85. exec "$JAVA_CMD" \
  86. $SONAR_RUNNER_OPTS \
  87. -classpath $JAVA_CLASSPATH \
  88. "-Drunner.home=\${SONAR_RUNNER_HOME}" \
  89. "-Dproject.home=\${PROJECT_HOME}" \
  90. org.sonar.runner.Main "$@"