From f1361e89bb0e09cdd0c9186154dbb3b8680f556b Mon Sep 17 00:00:00 2001 From: Janos Gyerik Date: Mon, 13 Mar 2017 17:22:57 +0100 Subject: SQSCANNER-38 self-contained distributions for Linux, Windows and Mac OS X (#26) --- src/main/assembly/bin/sonar-runner | 10 +++--- src/main/assembly/bin/sonar-scanner | 13 +++++-- src/main/assembly/bin/sonar-scanner.bat | 9 ++++- src/main/assembly/dist-linux.xml | 58 ++++++++++++++++++++++++++++++ src/main/assembly/dist-macosx.xml | 57 +++++++++++++++++++++++++++++ src/main/assembly/dist-windows.xml | 55 ++++++++++++++++++++++++++++ src/main/assembly/filter-dist.properties | 1 + src/main/assembly/filter-noarch.properties | 1 + src/main/assembly/noarch.xml | 48 +++++++++++++++++++++++++ 9 files changed, 244 insertions(+), 8 deletions(-) create mode 100644 src/main/assembly/dist-linux.xml create mode 100644 src/main/assembly/dist-macosx.xml create mode 100644 src/main/assembly/dist-windows.xml create mode 100644 src/main/assembly/filter-dist.properties create mode 100644 src/main/assembly/filter-noarch.properties create mode 100644 src/main/assembly/noarch.xml (limited to 'src/main/assembly') 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 diff --git a/src/main/assembly/dist-linux.xml b/src/main/assembly/dist-linux.xml new file mode 100644 index 0000000..d4d1923 --- /dev/null +++ b/src/main/assembly/dist-linux.xml @@ -0,0 +1,58 @@ + + + linux + + zip + + true + + + + + ${unpack.dir}/linux/${jre.dirname.linux} + lib/jre + + bin/** + man/** + plugin/** + + + + + + ${unpack.dir}/linux/${jre.dirname.linux}/bin + lib/jre/bin + + java + + 0755 + + + + + ${project.build.directory} + lib + 0644 + + ${scanner.jar} + + + + src/main/assembly/conf + conf + 0644 + unix + + + src/main/assembly/bin + bin + 0755 + unix + true + + sonar-scanner + sonar-scanner-debug + + + + diff --git a/src/main/assembly/dist-macosx.xml b/src/main/assembly/dist-macosx.xml new file mode 100644 index 0000000..65ad78e --- /dev/null +++ b/src/main/assembly/dist-macosx.xml @@ -0,0 +1,57 @@ + + + macosx + + zip + + true + + + + + ${unpack.dir}/macosx/${jre.dirname.macosx} + lib/jre + + bin/** + man/** + + + + + + ${unpack.dir}/macosx/${jre.dirname.macosx}/bin + lib/jre/bin + + java + + 0755 + + + + + ${project.build.directory} + lib + 0644 + + ${scanner.jar} + + + + src/main/assembly/conf + conf + 0644 + unix + + + src/main/assembly/bin + bin + 0755 + unix + true + + sonar-scanner + sonar-scanner-debug + + + + diff --git a/src/main/assembly/dist-windows.xml b/src/main/assembly/dist-windows.xml new file mode 100644 index 0000000..132859b --- /dev/null +++ b/src/main/assembly/dist-windows.xml @@ -0,0 +1,55 @@ + + + windows + + zip + + true + + + + + ${unpack.dir}/windows/${jre.dirname.windows} + lib/jre + + bin/** + man/** + plugin/** + + + + + + ${unpack.dir}/windows/${jre.dirname.windows}/bin + lib/jre/bin + 0755 + + + + + ${project.build.directory} + lib + 0644 + + ${scanner.jar} + + + + src/main/assembly/conf + conf + 0644 + unix + + + src/main/assembly/bin + bin + 0755 + dos + true + + sonar-scanner.bat + sonar-scanner-debug.bat + + + + diff --git a/src/main/assembly/filter-dist.properties b/src/main/assembly/filter-dist.properties new file mode 100644 index 0000000..b7bbc34 --- /dev/null +++ b/src/main/assembly/filter-dist.properties @@ -0,0 +1 @@ +use_embedded_jre=true diff --git a/src/main/assembly/filter-noarch.properties b/src/main/assembly/filter-noarch.properties new file mode 100644 index 0000000..b1c9e92 --- /dev/null +++ b/src/main/assembly/filter-noarch.properties @@ -0,0 +1 @@ +use_embedded_jre=false diff --git a/src/main/assembly/noarch.xml b/src/main/assembly/noarch.xml new file mode 100644 index 0000000..cce6955 --- /dev/null +++ b/src/main/assembly/noarch.xml @@ -0,0 +1,48 @@ + + + bin + + zip + + true + + + src/main/assembly/bin + bin + + sonar-runner.bat + sonar-scanner.bat + sonar-scanner-debug.bat + + dos + true + + + src/main/assembly/bin + bin + + sonar-runner + sonar-scanner + sonar-scanner-debug + + unix + 0755 + true + + + src/main/assembly/conf + conf + 0644 + dos + + + ${project.build.directory} + lib + + ${project.build.finalName}.jar + + + + -- cgit v1.2.3