]> source.dussan.org Git - sonar-scanner-cli.git/commitdiff
SQSCANNER-78 - backtick syntax (#83)
authorMark Rekveld <mark.rekveld@sonarsource.com>
Thu, 24 Sep 2020 06:29:18 +0000 (08:29 +0200)
committerGitHub <noreply@github.com>
Thu, 24 Sep 2020 06:29:18 +0000 (08:29 +0200)
it/pom.xml
it/src/test/java/com/sonarsource/scanner/it/SonarScannerTestSuite.java
misc/symlink-tester.sh
src/main/assembly/bin/sonar-scanner
src/main/assembly/bin/sonar-scanner-debug

index 633f93c8eeea8ccf8b191dd288751032650de863..430a58b6409515a15d214eb5dbcab698c36c33a2 100644 (file)
@@ -36,7 +36,7 @@
     <dependency>
       <groupId>org.sonarsource.orchestrator</groupId>
       <artifactId>sonar-orchestrator</artifactId>
-      <version>3.29.0.2543</version>
+      <version>3.30.0.2630</version>
     </dependency>
     <dependency>
       <groupId>junit</groupId>
index 5d76042ee831395601a1796e524b0f47dc23b93a..bc795b241afabc7c739c1da2bad4dd917b70e236 100644 (file)
@@ -20,6 +20,7 @@
 package com.sonarsource.scanner.it;
 
 import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.OrchestratorBuilder;
 import com.sonar.orchestrator.locator.MavenLocation;
 import org.junit.ClassRule;
 import org.junit.runner.RunWith;
@@ -27,17 +28,32 @@ import org.junit.runners.Suite;
 import org.junit.runners.Suite.SuiteClasses;
 
 @RunWith(Suite.class)
-@SuiteClasses({ScannerTest.class, MultimoduleTest.class, DistributionTest.class})
+@SuiteClasses({ScannerTest.class, MultimoduleTest.class,
+                DistributionTest.class})
 public class SonarScannerTestSuite {
 
   @ClassRule
-  public static final Orchestrator ORCHESTRATOR = Orchestrator.builderEnv()
-    .setSonarVersion(System.getProperty("sonar.runtimeVersion", "LATEST_RELEASE[6.7]"))
+  public static final Orchestrator ORCHESTRATOR = createOrchestrator();
+
+  private static Orchestrator createOrchestrator() {
+    String sonarVersion = System
+      .getProperty("sonar.runtimeVersion", "LATEST_RELEASE[6.7]");
+    OrchestratorBuilder builder = Orchestrator.builderEnv()
+      .setSonarVersion(
+        sonarVersion);
     // The scanner cli should still be compatible with previous LTS 6.7, and not the 7.9
     // at the time of writing, so the installed plugins should be compatible with
     // both 6.7 and 8.x. The latest releases of analysers drop the compatibility with
     // 6.7, that's why versions are hardcoded here.
-    .addPlugin(MavenLocation.of("org.sonarsource.javascript", "sonar-javascript-plugin", "5.2.1.7778"))
-    .build();
+    MavenLocation javascriptPlugin = MavenLocation
+      .of("org.sonarsource.javascript", "sonar-javascript-plugin",
+        "5.2.1.7778");
+    if (sonarVersion.startsWith("DEV")) {
+      builder.addBundledPlugin(javascriptPlugin);
+    } else {
+      builder.addPlugin(javascriptPlugin);
+    }
+    return builder.build();
+  }
 
 }
index bab955e3a83cf2c29b8e93b7727326bcc74d4aba..8ef5791e8f4f2f6a8152187a543a102270ccf5ef 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
 
 usage() {
     echo usage: $0 path/to/sonar-scanner
@@ -10,10 +10,10 @@ test -f "$1" && test -x "$1" || usage
 scanner=$1
 
 if type mktemp &>/dev/null; then
-    tempdir=$(mktemp -d)
-    tempdir=$(cd "$tempdir"; pwd -P)
+    tempdir=`mktemp -d`
+    tempdir=`cd "$tempdir"; pwd -P`
 else
-    tempdir=/tmp/"$(basename "$0")-$$"
+    tempdir=/tmp/"`basename "$0"`-$$"
     mkdir -p "$tempdir"
 fi
 
@@ -25,7 +25,7 @@ trap 'cleanup; exit 1' 1 2 3 15
 trap 'cleanup; exit 0' 0
 
 abspath() {
-    (cd "$(dirname "$1")"; echo $PWD/"$(basename "$1")")
+    (cd "`dirname "$1"`"; echo $PWD/"`basename "$1"`")
 }
 
 verify() {
@@ -46,10 +46,10 @@ relpath_to_root() {
     )
 }
 
-ln -s "$(abspath "$scanner")" "$tempdir"/scanner
+ln -s "`abspath "$scanner"`" "$tempdir"/scanner
 verify 'launch from abs symlink to abs path' "$tempdir"/scanner -h
 
-ln -s "$(relpath_to_root "$tempdir")$(abspath "$scanner")" "$tempdir"/scanner-rel
+ln -s "`relpath_to_root "$tempdir"``abspath "$scanner"`" "$tempdir"/scanner-rel
 verify 'symlink to rel path is valid' test -e "$tempdir"/scanner-rel
 verify 'launch from abs symlink to rel path' "$tempdir"/scanner-rel -h
 
index e0e4c9d3ab7f2f94f9998a6f773901cb030c6572..56f0ce55c39072cf50af96f214e849e048650453 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/env sh
 #
 # SonarScanner Startup Script for Unix
 #
@@ -12,21 +12,21 @@ real_path () {
 
   (
   while true; do
-    cd "$(dirname "$target")"
-    target=$(basename "$target")
+    cd "`dirname "$target"`"
+    target=`basename "$target"`
     test -L "$target" || break
-    target=$(readlink "$target")
+    target=`readlink "$target"`
   done
 
-  echo "$(pwd -P)/$target"
+  echo "`pwd -P`/$target"
   )
 }
 
-script_path=$(real_path "$0")
-sonar_scanner_home=$(dirname "$script_path")/..
+script_path=`real_path "$0"`
+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`
 
 jar_file=$sonar_scanner_home/lib/sonar-scanner-cli-${project.version}.jar
 
@@ -46,7 +46,7 @@ if [ -n "$JAVA_HOME" ]
 then
   java_cmd="$JAVA_HOME/bin/java"
 else
-  java_cmd="$(which java)"
+  java_cmd="`which java`"
 fi
 
 if [ -z "$java_cmd" -o ! -x "$java_cmd" ] ; then
@@ -54,7 +54,7 @@ if [ -z "$java_cmd" -o ! -x "$java_cmd" ] ; then
   exit 1
 fi
 
-project_home=$(pwd)
+project_home=`pwd`
 
 #echo "Info: Using sonar-scanner at $sonar_scanner_home"
 #echo "Info: Using java at $java_cmd"
index 823a1ab1493a51709e33d4d6e14ef390a5a81fec..750f813cf804676b2f825035e7e8d7870bd6bd28 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/env sh
 #
 # SonarScanner Startup Script for Unix
 #
@@ -11,4 +11,4 @@ SONAR_SCANNER_DEBUG_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend
 echo "Executing SonarScanner in Debug Mode"
 echo "SONAR_SCANNER_DEBUG_OPTS=\"-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000\""
 
-env SONAR_SCANNER_OPTS="$SONAR_SCANNER_OPTS" SONAR_SCANNER_DEBUG_OPTS="$SONAR_SCANNER_DEBUG_OPTS" "$(dirname "$0")"/sonar-scanner "$@"
+env SONAR_SCANNER_OPTS="$SONAR_SCANNER_OPTS" SONAR_SCANNER_DEBUG_OPTS="$SONAR_SCANNER_DEBUG_OPTS" "`dirname "$0"`"/sonar-scanner "$@"