aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/assembly/bin
diff options
context:
space:
mode:
authorJanos Gyerik <janos.gyerik@sonarsource.com>2017-03-13 17:22:57 +0100
committerGitHub <noreply@github.com>2017-03-13 17:22:57 +0100
commitf1361e89bb0e09cdd0c9186154dbb3b8680f556b (patch)
treea186b236bc417f49b81f7348cfc320b56165bcc4 /src/main/assembly/bin
parentc0f61ea4f455e6d039117eb2934c872863e6446e (diff)
downloadsonar-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-xsrc/main/assembly/bin/sonar-runner10
-rwxr-xr-xsrc/main/assembly/bin/sonar-scanner13
-rw-r--r--src/main/assembly/bin/sonar-scanner.bat9
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