Browse Source

SQSCANNER-78 - backtick syntax (#83)

tags/4.5.0.2216
Mark Rekveld 2 years ago
parent
commit
4a8d1e3fda
No account linked to committer's email address

+ 1
- 1
it/pom.xml View 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>

+ 21
- 5
it/src/test/java/com/sonarsource/scanner/it/SonarScannerTestSuite.java View 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();
}

}

+ 7
- 7
misc/symlink-tester.sh View File

@@ -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


+ 10
- 10
src/main/assembly/bin/sonar-scanner View File

@@ -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"

+ 2
- 2
src/main/assembly/bin/sonar-scanner-debug View File

@@ -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 "$@"

Loading…
Cancel
Save