Browse Source

SQSCANNER-78 - backtick syntax (#83)

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

+ 1
- 1
it/pom.xml View File

<dependency> <dependency>
<groupId>org.sonarsource.orchestrator</groupId> <groupId>org.sonarsource.orchestrator</groupId>
<artifactId>sonar-orchestrator</artifactId> <artifactId>sonar-orchestrator</artifactId>
<version>3.29.0.2543</version>
<version>3.30.0.2630</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>

+ 21
- 5
it/src/test/java/com/sonarsource/scanner/it/SonarScannerTestSuite.java View File

package com.sonarsource.scanner.it; package com.sonarsource.scanner.it;


import com.sonar.orchestrator.Orchestrator; import com.sonar.orchestrator.Orchestrator;
import com.sonar.orchestrator.OrchestratorBuilder;
import com.sonar.orchestrator.locator.MavenLocation; import com.sonar.orchestrator.locator.MavenLocation;
import org.junit.ClassRule; import org.junit.ClassRule;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses; import org.junit.runners.Suite.SuiteClasses;


@RunWith(Suite.class) @RunWith(Suite.class)
@SuiteClasses({ScannerTest.class, MultimoduleTest.class, DistributionTest.class})
@SuiteClasses({ScannerTest.class, MultimoduleTest.class,
DistributionTest.class})
public class SonarScannerTestSuite { public class SonarScannerTestSuite {


@ClassRule @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 // 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 // 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 // both 6.7 and 8.x. The latest releases of analysers drop the compatibility with
// 6.7, that's why versions are hardcoded here. // 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

#!/usr/bin/env bash
#!/usr/bin/env sh


usage() { usage() {
echo usage: $0 path/to/sonar-scanner echo usage: $0 path/to/sonar-scanner
scanner=$1 scanner=$1


if type mktemp &>/dev/null; then if type mktemp &>/dev/null; then
tempdir=$(mktemp -d)
tempdir=$(cd "$tempdir"; pwd -P)
tempdir=`mktemp -d`
tempdir=`cd "$tempdir"; pwd -P`
else else
tempdir=/tmp/"$(basename "$0")-$$"
tempdir=/tmp/"`basename "$0"`-$$"
mkdir -p "$tempdir" mkdir -p "$tempdir"
fi fi


trap 'cleanup; exit 0' 0 trap 'cleanup; exit 0' 0


abspath() { abspath() {
(cd "$(dirname "$1")"; echo $PWD/"$(basename "$1")")
(cd "`dirname "$1"`"; echo $PWD/"`basename "$1"`")
} }


verify() { verify() {
) )
} }


ln -s "$(abspath "$scanner")" "$tempdir"/scanner
ln -s "`abspath "$scanner"`" "$tempdir"/scanner
verify 'launch from abs symlink to abs path' "$tempdir"/scanner -h 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 'symlink to rel path is valid' test -e "$tempdir"/scanner-rel
verify 'launch from abs symlink to rel path' "$tempdir"/scanner-rel -h verify 'launch from abs symlink to rel path' "$tempdir"/scanner-rel -h



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

#!/bin/sh
#!/usr/bin/env sh
# #
# SonarScanner Startup Script for Unix # SonarScanner Startup Script for Unix
# #


( (
while true; do while true; do
cd "$(dirname "$target")"
target=$(basename "$target")
cd "`dirname "$target"`"
target=`basename "$target"`
test -L "$target" || break test -L "$target" || break
target=$(readlink "$target")
target=`readlink "$target"`
done 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 # 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 jar_file=$sonar_scanner_home/lib/sonar-scanner-cli-${project.version}.jar


then then
java_cmd="$JAVA_HOME/bin/java" java_cmd="$JAVA_HOME/bin/java"
else else
java_cmd="$(which java)"
java_cmd="`which java`"
fi fi


if [ -z "$java_cmd" -o ! -x "$java_cmd" ] ; then if [ -z "$java_cmd" -o ! -x "$java_cmd" ] ; then
exit 1 exit 1
fi fi


project_home=$(pwd)
project_home=`pwd`


#echo "Info: Using sonar-scanner at $sonar_scanner_home" #echo "Info: Using sonar-scanner at $sonar_scanner_home"
#echo "Info: Using java at $java_cmd" #echo "Info: Using java at $java_cmd"

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

#!/bin/sh
#!/usr/bin/env sh
# #
# SonarScanner Startup Script for Unix # SonarScanner Startup Script for Unix
# #
echo "Executing SonarScanner in Debug Mode" echo "Executing SonarScanner in Debug Mode"
echo "SONAR_SCANNER_DEBUG_OPTS=\"-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000\"" 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