diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2017-02-22 13:53:49 +0100 |
---|---|---|
committer | Duarte Meneses <duarte.meneses@sonarsource.com> | 2017-02-22 15:48:05 +0100 |
commit | 39be5c0b9d7c1c0fcc36ad4f9e5d89ff8606357b (patch) | |
tree | d2ce9f79b8fcf51d074432167e86b830fc56c752 /src | |
parent | 4bdd6afe5f47aa29d7a6fbd09f45dadb5c42fef7 (diff) | |
download | sonar-scanner-cli-39be5c0b9d7c1c0fcc36ad4f9e5d89ff8606357b.tar.gz sonar-scanner-cli-39be5c0b9d7c1c0fcc36ad4f9e5d89ff8606357b.zip |
Improve scripts
Diffstat (limited to 'src')
-rwxr-xr-x | src/main/assembly/bin/sonar-runner | 26 | ||||
-rwxr-xr-x | src/main/assembly/bin/sonar-scanner | 26 |
2 files changed, 26 insertions, 26 deletions
diff --git a/src/main/assembly/bin/sonar-runner b/src/main/assembly/bin/sonar-runner index d80dcf7..313a745 100755 --- a/src/main/assembly/bin/sonar-runner +++ b/src/main/assembly/bin/sonar-runner @@ -67,21 +67,21 @@ real_path () { echo WARN: 'sonar-runner' script is deprecated. Please use 'sonar-scanner' instead. -PRG="$0" +script_path="$0" -if [ -h "$PRG" ] ; then +if [ -h "$script_path" ] ; then # resolve recursively symlinks - R_PRG=`real_path "$PRG"` - until [ "$R_PRG" = "$PRG" ]; do - PRG="$R_PRG" - R_PRG=`real_path "$PRG"` + r_script_path=$(real_path "$script_path") + until [ "$R_script_path" = "$script_path" ]; do + script_path="$R_script_path" + r_script_path=$(real_path "$script_path") done fi -sonar_runner_home=`dirname "$PRG"`/.. +sonar_runner_home=$(dirname "$script_path")/.. # make it fully qualified -sonar_runner_home=`cd "$sonar_runner_home" && pwd` +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 @@ -93,7 +93,7 @@ if [ -n "$JAVA_HOME" ] then java_cmd="$JAVA_HOME/bin/java" else - java_cmd="`which java`" + java_cmd="$(which java)" fi if [ -n "$SONAR_RUNNER_OPTS" ] ; @@ -104,8 +104,8 @@ then fi fi -jar_file="${sonar_runner_home}"/lib/sonar-scanner-cli-${project.version}.jar -project_home=`pwd` +jar_file=${sonar_runner_home}/lib/sonar-scanner-cli-${project.version}.jar +project_home=$(pwd) #echo "Info: Using sonar-runner at $sonar_runner_home" #echo "Info: Using java at $java_cmd" @@ -116,7 +116,7 @@ exec "$java_cmd" \ -Djava.awt.headless=true \ $SONAR_SCANNER_OPTS \ -classpath $jar_file \ - "-Dscanner.home=\${sonar_runner_home}" \ - "-Dproject.home=\${project_home}" \ + -Dscanner.home=\$sonar_runner_home \ + -Dproject.home=\$project_home \ org.sonarsource.scanner.cli.Main "$@" diff --git a/src/main/assembly/bin/sonar-scanner b/src/main/assembly/bin/sonar-scanner index b24be61..6b54cc9 100755 --- a/src/main/assembly/bin/sonar-scanner +++ b/src/main/assembly/bin/sonar-scanner @@ -66,21 +66,21 @@ real_path () { echo "$FOO" } -PRG="$0" +script_path="$0" -if [ -h "$PRG" ] ; then +if [ -h "$script_path" ] ; then # resolve recursively symlinks - R_PRG=`real_path "$PRG"` - until [ "$R_PRG" = "$PRG" ]; do - PRG="$R_PRG" - R_PRG=`real_path "$PRG"` + r_script_path=$(real_path "$script_path") + until [ "$r_script_path" = "$script_path" ]; do + script_path="$r_script_path" + r_script_path=`real_path "$script_path"` done fi -sonar_scanner_home=`dirname "$PRG"`/.. +sonar_scanner_home=$(dirname "$script_path")/.. # make it fully qualified -sonar_scanner_home=`cd "$sonar_scanner_home" && pwd -P` +sonar_scanner_home=$(cd "$sonar_scanner_home" && pwd -P) # check that sonar_scanner_home has been correctly set if [ ! -f "$sonar_scanner_home/lib/sonar-scanner-cli-${project.version}.jar" ] ; then @@ -92,11 +92,11 @@ if [ -n "$JAVA_HOME" ] then java_cmd="$JAVA_HOME/bin/java" else - java_cmd="`which java`" + java_cmd="$(which java)" fi -jar_file="${sonar_scanner_home}"/lib/sonar-scanner-cli-${project.version}.jar -project_home=`pwd` +jar_file=${sonar_scanner_home}/lib/sonar-scanner-cli-${project.version}.jar +project_home=$(pwd) #echo "Info: Using sonar-scanner at $sonar_scanner_home" #echo "Info: Using java at $java_cmd" @@ -108,7 +108,7 @@ exec "$java_cmd" \ $SONAR_SCANNER_OPTS \ $SONAR_SCANNER_DEBUG_OPTS \ -classpath $jar_file \ - "-Dscanner.home=\${sonar_scanner_home}" \ - "-Dproject.home=\${project_home}" \ + -Dscanner.home=\$sonar_scanner_home \ + -Dproject.home=\$project_home \ org.sonarsource.scanner.cli.Main "$@" |