diff options
author | Janos Gyerik <janos.gyerik@sonarsource.com> | 2017-03-13 17:22:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-13 17:22:57 +0100 |
commit | f1361e89bb0e09cdd0c9186154dbb3b8680f556b (patch) | |
tree | a186b236bc417f49b81f7348cfc320b56165bcc4 /src/main/assembly/bin | |
parent | c0f61ea4f455e6d039117eb2934c872863e6446e (diff) | |
download | sonar-scanner-cli-f1361e89bb0e09cdd0c9186154dbb3b8680f556b.tar.gz sonar-scanner-cli-f1361e89bb0e09cdd0c9186154dbb3b8680f556b.zip |
SQSCANNER-38 self-contained distributions for Linux, Windows and Mac OS X (#26)
Diffstat (limited to 'src/main/assembly/bin')
-rwxr-xr-x | src/main/assembly/bin/sonar-runner | 10 | ||||
-rwxr-xr-x | src/main/assembly/bin/sonar-scanner | 13 | ||||
-rw-r--r-- | src/main/assembly/bin/sonar-scanner.bat | 9 |
3 files changed, 24 insertions, 8 deletions
diff --git a/src/main/assembly/bin/sonar-runner b/src/main/assembly/bin/sonar-runner index 14e3a58..a116ea4 100755 --- a/src/main/assembly/bin/sonar-runner +++ b/src/main/assembly/bin/sonar-runner @@ -36,9 +36,12 @@ sonar_runner_home=$(dirname "$script_path")/.. # make it fully qualified sonar_runner_home=$(cd "$sonar_runner_home" && pwd) -# check that the sonar_runner_home has been correctly set -if [ ! -f "$sonar_runner_home/lib/sonar-scanner-cli-${project.version}.jar" ] ; then - echo '$sonar_runner_home' does not point to a valid installation directory: $sonar_runner_home +jar_file=$sonar_runner_home/lib/sonar-scanner-cli-${project.version}.jar + +# check that sonar_runner_home has been correctly set +if [ ! -f "$jar_file" ] ; then + echo "File does not exist: $jar_file" + echo "'$sonar_runner_home' does not point to a valid installation directory: $sonar_runner_home" exit 1 fi @@ -57,7 +60,6 @@ then fi fi -jar_file=${sonar_runner_home}/lib/sonar-scanner-cli-${project.version}.jar project_home=$(pwd) #echo "Info: Using sonar-runner at $sonar_runner_home" diff --git a/src/main/assembly/bin/sonar-scanner b/src/main/assembly/bin/sonar-scanner index 38f0095..b0c19f3 100755 --- a/src/main/assembly/bin/sonar-scanner +++ b/src/main/assembly/bin/sonar-scanner @@ -35,12 +35,20 @@ sonar_scanner_home=$(dirname "$script_path")/.. # make it fully qualified sonar_scanner_home=$(cd "$sonar_scanner_home" && pwd -P) +jar_file=$sonar_scanner_home/lib/sonar-scanner-cli-${project.version}.jar + # check that sonar_scanner_home has been correctly set -if [ ! -f "$sonar_scanner_home/lib/sonar-scanner-cli-${project.version}.jar" ] ; then - echo '$sonar_scanner_home' does not point to a valid installation directory: $sonar_scanner_home +if [ ! -f "$jar_file" ] ; then + echo "File does not exist: $jar_file" + echo "'$sonar_scanner_home' does not point to a valid installation directory: $sonar_scanner_home" exit 1 fi +use_embedded_jre=${use_embedded_jre} +if [ "$use_embedded_jre" = true ]; then + export JAVA_HOME=$sonar_scanner_home/lib/jre +fi + if [ -n "$JAVA_HOME" ] then java_cmd="$JAVA_HOME/bin/java" @@ -48,7 +56,6 @@ else java_cmd="$(which java)" fi -jar_file=${sonar_scanner_home}/lib/sonar-scanner-cli-${project.version}.jar project_home=$(pwd) #echo "Info: Using sonar-scanner at $sonar_scanner_home" diff --git a/src/main/assembly/bin/sonar-scanner.bat b/src/main/assembly/bin/sonar-scanner.bat index bd4c920..833dcbb 100644 --- a/src/main/assembly/bin/sonar-scanner.bat +++ b/src/main/assembly/bin/sonar-scanner.bat @@ -13,8 +13,16 @@ set ERROR_CODE=0 @REM set local scope for the variables with windows NT shell @setlocal +set SONAR_SCANNER_HOME=%~dp0.. + @REM ==== START VALIDATION ==== @REM *** JAVA EXEC VALIDATION *** + +set use_embedded_jre=${use_embedded_jre} +if "%use_embedded_jre%" == "true" ( + set JAVA_HOME=%SONAR_SCANNER_HOME%\lib\jre +) + if not "%JAVA_HOME%" == "" goto foundJavaHome for %%i in (java.exe) do set JAVA_EXEC=%%~$PATH:i @@ -47,7 +55,6 @@ goto error set JAVA_EXEC="%JAVA_HOME%\bin\java.exe" :OkJava -set SONAR_SCANNER_HOME=%~dp0.. goto run |