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 | |
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')
-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 | ||||
-rw-r--r-- | src/main/assembly/dist-linux.xml | 58 | ||||
-rw-r--r-- | src/main/assembly/dist-macosx.xml | 57 | ||||
-rw-r--r-- | src/main/assembly/dist-windows.xml | 55 | ||||
-rw-r--r-- | src/main/assembly/filter-dist.properties | 1 | ||||
-rw-r--r-- | src/main/assembly/filter-noarch.properties | 1 | ||||
-rw-r--r-- | src/main/assembly/noarch.xml | 48 |
9 files changed, 244 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 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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<assembly> + <id>linux</id> + <formats> + <format>zip</format> + </formats> + <includeBaseDirectory>true</includeBaseDirectory> + <fileSets> + + <!-- jre basic, except bin/ --> + <fileSet> + <directory>${unpack.dir}/linux/${jre.dirname.linux}</directory> + <outputDirectory>lib/jre</outputDirectory> + <excludes> + <exclude>bin/**</exclude> + <exclude>man/**</exclude> + <exclude>plugin/**</exclude> + </excludes> + </fileSet> + + <!-- jre bin/java --> + <fileSet> + <directory>${unpack.dir}/linux/${jre.dirname.linux}/bin</directory> + <outputDirectory>lib/jre/bin</outputDirectory> + <includes> + <include>java</include> + </includes> + <fileMode>0755</fileMode> + </fileSet> + + <!-- scanner files --> + <fileSet> + <directory>${project.build.directory}</directory> + <outputDirectory>lib</outputDirectory> + <fileMode>0644</fileMode> + <includes> + <include>${scanner.jar}</include> + </includes> + </fileSet> + <fileSet> + <directory>src/main/assembly/conf</directory> + <outputDirectory>conf</outputDirectory> + <fileMode>0644</fileMode> + <lineEnding>unix</lineEnding> + </fileSet> + <fileSet> + <directory>src/main/assembly/bin</directory> + <outputDirectory>bin</outputDirectory> + <fileMode>0755</fileMode> + <lineEnding>unix</lineEnding> + <filtered>true</filtered> + <includes> + <include>sonar-scanner</include> + <include>sonar-scanner-debug</include> + </includes> + </fileSet> + </fileSets> +</assembly> 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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<assembly> + <id>macosx</id> + <formats> + <format>zip</format> + </formats> + <includeBaseDirectory>true</includeBaseDirectory> + <fileSets> + + <!-- jre basic, except bin/ --> + <fileSet> + <directory>${unpack.dir}/macosx/${jre.dirname.macosx}</directory> + <outputDirectory>lib/jre</outputDirectory> + <excludes> + <exclude>bin/**</exclude> + <exclude>man/**</exclude> + </excludes> + </fileSet> + + <!-- jre bin/java --> + <fileSet> + <directory>${unpack.dir}/macosx/${jre.dirname.macosx}/bin</directory> + <outputDirectory>lib/jre/bin</outputDirectory> + <includes> + <include>java</include> + </includes> + <fileMode>0755</fileMode> + </fileSet> + + <!-- scanner files --> + <fileSet> + <directory>${project.build.directory}</directory> + <outputDirectory>lib</outputDirectory> + <fileMode>0644</fileMode> + <includes> + <include>${scanner.jar}</include> + </includes> + </fileSet> + <fileSet> + <directory>src/main/assembly/conf</directory> + <outputDirectory>conf</outputDirectory> + <fileMode>0644</fileMode> + <lineEnding>unix</lineEnding> + </fileSet> + <fileSet> + <directory>src/main/assembly/bin</directory> + <outputDirectory>bin</outputDirectory> + <fileMode>0755</fileMode> + <lineEnding>unix</lineEnding> + <filtered>true</filtered> + <includes> + <include>sonar-scanner</include> + <include>sonar-scanner-debug</include> + </includes> + </fileSet> + </fileSets> +</assembly> 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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<assembly> + <id>windows</id> + <formats> + <format>zip</format> + </formats> + <includeBaseDirectory>true</includeBaseDirectory> + <fileSets> + + <!-- jre basic, except bin/ --> + <fileSet> + <directory>${unpack.dir}/windows/${jre.dirname.windows}</directory> + <outputDirectory>lib/jre</outputDirectory> + <excludes> + <exclude>bin/**</exclude> + <exclude>man/**</exclude> + <exclude>plugin/**</exclude> + </excludes> + </fileSet> + + <!-- jre bin --> + <fileSet> + <directory>${unpack.dir}/windows/${jre.dirname.windows}/bin</directory> + <outputDirectory>lib/jre/bin</outputDirectory> + <fileMode>0755</fileMode> + </fileSet> + + <!-- scanner files --> + <fileSet> + <directory>${project.build.directory}</directory> + <outputDirectory>lib</outputDirectory> + <fileMode>0644</fileMode> + <includes> + <include>${scanner.jar}</include> + </includes> + </fileSet> + <fileSet> + <directory>src/main/assembly/conf</directory> + <outputDirectory>conf</outputDirectory> + <fileMode>0644</fileMode> + <lineEnding>unix</lineEnding> + </fileSet> + <fileSet> + <directory>src/main/assembly/bin</directory> + <outputDirectory>bin</outputDirectory> + <fileMode>0755</fileMode> + <lineEnding>dos</lineEnding> + <filtered>true</filtered> + <includes> + <include>sonar-scanner.bat</include> + <include>sonar-scanner-debug.bat</include> + </includes> + </fileSet> + </fileSets> +</assembly> 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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> + <id>bin</id> + <formats> + <format>zip</format> + </formats> + <includeBaseDirectory>true</includeBaseDirectory> + <fileSets> + <fileSet> + <directory>src/main/assembly/bin</directory> + <outputDirectory>bin</outputDirectory> + <includes> + <include>sonar-runner.bat</include> + <include>sonar-scanner.bat</include> + <include>sonar-scanner-debug.bat</include> + </includes> + <lineEnding>dos</lineEnding> + <filtered>true</filtered> + </fileSet> + <fileSet> + <directory>src/main/assembly/bin</directory> + <outputDirectory>bin</outputDirectory> + <includes> + <include>sonar-runner</include> + <include>sonar-scanner</include> + <include>sonar-scanner-debug</include> + </includes> + <lineEnding>unix</lineEnding> + <fileMode>0755</fileMode> + <filtered>true</filtered> + </fileSet> + <fileSet> + <directory>src/main/assembly/conf</directory> + <outputDirectory>conf</outputDirectory> + <fileMode>0644</fileMode> + <lineEnding>dos</lineEnding> + </fileSet> + <fileSet> + <directory>${project.build.directory}</directory> + <outputDirectory>lib</outputDirectory> + <includes> + <include>${project.build.finalName}.jar</include> + </includes> + </fileSet> + </fileSets> +</assembly> |