aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authormickael-caro-sonarsource <mickael.caro@sonarsource.com>2020-01-03 15:58:43 +0100
committerGitHub <noreply@github.com>2020-01-03 15:58:43 +0100
commitb526146d2a7af21e6f7feb02e35f1a63a33d09c1 (patch)
tree1715205ad68d293868141e19e113646b0a2ef244 /src/main
parent460cee11506ca9a7cb919d6cbb66e50029ed9b66 (diff)
downloadsonar-scanner-cli-b526146d2a7af21e6f7feb02e35f1a63a33d09c1.tar.gz
sonar-scanner-cli-b526146d2a7af21e6f7feb02e35f1a63a33d09c1.zip
SQSCANNER-57 - Rename scanner SonarScanner (#78)
* SQSCANNER-57 - Rename scanner SonarScanner
Diffstat (limited to 'src/main')
-rwxr-xr-xsrc/main/assembly/bin/sonar-scanner4
-rwxr-xr-xsrc/main/assembly/bin/sonar-scanner-debug6
-rw-r--r--src/main/assembly/bin/sonar-scanner-debug.bat6
-rw-r--r--src/main/assembly/bin/sonar-scanner.bat4
-rw-r--r--src/main/java/org/sonarsource/scanner/cli/Conf.java11
-rw-r--r--src/main/java/org/sonarsource/scanner/cli/Main.java8
-rw-r--r--src/main/java/org/sonarsource/scanner/cli/SystemInfo.java2
7 files changed, 26 insertions, 15 deletions
diff --git a/src/main/assembly/bin/sonar-scanner b/src/main/assembly/bin/sonar-scanner
index fefac84..e73cf23 100755
--- a/src/main/assembly/bin/sonar-scanner
+++ b/src/main/assembly/bin/sonar-scanner
@@ -1,9 +1,9 @@
#!/bin/sh
#
-# SonarQube Scanner Startup Script for Unix
+# SonarScanner Startup Script for Unix
#
# Optional ENV vars:
-# SONAR_SCANNER_OPTS - Parameters passed to the Java VM when running the SonarQube Scanner
+# SONAR_SCANNER_OPTS - Parameters passed to the Java VM when running the SonarScanner
# SONAR_SCANNER_DEBUG_OPTS - Extra parameters passed to the Java VM for debugging
# JAVA_HOME - Location of Java's installation
diff --git a/src/main/assembly/bin/sonar-scanner-debug b/src/main/assembly/bin/sonar-scanner-debug
index d43b036..823a1ab 100755
--- a/src/main/assembly/bin/sonar-scanner-debug
+++ b/src/main/assembly/bin/sonar-scanner-debug
@@ -1,14 +1,14 @@
#!/bin/sh
#
-# SonarQube Scanner Startup Script for Unix
+# SonarScanner Startup Script for Unix
#
# Optional ENV vars:
-# SONAR_SCANNER_OPTS - parameters passed to the Java VM when running the SonarQube Scanner
+# SONAR_SCANNER_OPTS - parameters passed to the Java VM when running the SonarScanner
# JAVA_HOME - Location of Java's installation
SONAR_SCANNER_DEBUG_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"
-echo "Executing SonarQube Scanner 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\""
env SONAR_SCANNER_OPTS="$SONAR_SCANNER_OPTS" SONAR_SCANNER_DEBUG_OPTS="$SONAR_SCANNER_DEBUG_OPTS" "$(dirname "$0")"/sonar-scanner "$@"
diff --git a/src/main/assembly/bin/sonar-scanner-debug.bat b/src/main/assembly/bin/sonar-scanner-debug.bat
index 1ebc42c..aea4d97 100644
--- a/src/main/assembly/bin/sonar-scanner-debug.bat
+++ b/src/main/assembly/bin/sonar-scanner-debug.bat
@@ -1,13 +1,13 @@
-@REM SonarQube Scanner Startup Script for Windows
+@REM SonarScanner Startup Script for Windows
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars:
-@REM SONAR_SCANNER_OPTS - parameters passed to the Java VM when running the SonarQube Scanner
+@REM SONAR_SCANNER_OPTS - parameters passed to the Java VM when running the SonarScanner
@setlocal
@set SONAR_SCANNER_DEBUG_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
-echo "Executing SonarQube Scanner 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"
@call "%~dp0"sonar-scanner.bat %*
diff --git a/src/main/assembly/bin/sonar-scanner.bat b/src/main/assembly/bin/sonar-scanner.bat
index e71f518..4ee9e55 100644
--- a/src/main/assembly/bin/sonar-scanner.bat
+++ b/src/main/assembly/bin/sonar-scanner.bat
@@ -1,10 +1,10 @@
-@REM SonarQube Scanner Startup Script for Windows
+@REM SonarScanner Startup Script for Windows
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars:
-@REM SONAR_SCANNER_OPTS - parameters passed to the Java VM when running the SonarQube Scanner
+@REM SONAR_SCANNER_OPTS - parameters passed to the Java VM when running the SonarScanner
@echo off
diff --git a/src/main/java/org/sonarsource/scanner/cli/Conf.java b/src/main/java/org/sonarsource/scanner/cli/Conf.java
index b914516..e6a84a8 100644
--- a/src/main/java/org/sonarsource/scanner/cli/Conf.java
+++ b/src/main/java/org/sonarsource/scanner/cli/Conf.java
@@ -28,6 +28,7 @@ import java.nio.file.Paths;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Properties;
import javax.annotation.Nullable;
@@ -42,6 +43,7 @@ class Conf {
private static final String PROPERTY_PROJECT_BASEDIR = "sonar.projectBaseDir";
private static final String PROPERTY_PROJECT_CONFIG_FILE = "sonar.projectConfigFile";
private static final String SONAR_PROJECT_PROPERTIES_FILENAME = "sonar-project.properties";
+ private static final String PROPERTY_SONAR_HOST_URL = "sonar.host.url";
private final Cli cli;
private final Logs logger;
@@ -68,6 +70,15 @@ class Conf {
return result;
}
+ boolean isSonarCloud(@Nullable Properties testProperties) {
+ String hostUrl = testProperties != null ? testProperties.getProperty(PROPERTY_SONAR_HOST_URL) : properties().getProperty(PROPERTY_SONAR_HOST_URL);
+ if (hostUrl != null) {
+ return hostUrl.toLowerCase(Locale.getDefault()).contains("sonarcloud");
+ }
+
+ return false;
+ }
+
private Properties resolve(Properties props) {
PropertyResolver resolver = new PropertyResolver(props, env);
return resolver.resolve();
diff --git a/src/main/java/org/sonarsource/scanner/cli/Main.java b/src/main/java/org/sonarsource/scanner/cli/Main.java
index 5764423..229a9d2 100644
--- a/src/main/java/org/sonarsource/scanner/cli/Main.java
+++ b/src/main/java/org/sonarsource/scanner/cli/Main.java
@@ -71,12 +71,12 @@ public class Main {
configureLogging(p);
init(p);
runner.start();
- logger.info("SonarQube server " + runner.serverVersion());
+ logger.info(String.format("Analyzing on %s", conf.isSonarCloud(null) ? "SonarCloud" : ("SonarQube server " + runner.serverVersion())));
execute(stats, p);
status = Exit.SUCCESS;
} catch (Throwable e) {
displayExecutionResult(stats, "FAILURE");
- showError("Error during SonarQube Scanner execution", e, cli.isDebugEnabled());
+ showError("Error during SonarScanner execution", e, cli.isDebugEnabled());
status = isUserError(e) ? Exit.USER_ERROR : Exit.INTERNAL_ERROR;
} finally {
exit.exit(status);
@@ -86,7 +86,7 @@ public class Main {
private void checkSkip(Properties properties) {
if ("true".equalsIgnoreCase(properties.getProperty(ScanProperties.SKIP))) {
- logger.info("SonarQube Scanner analysis skipped");
+ logger.info("SonarScanner analysis skipped");
exit.exit(Exit.SUCCESS);
}
}
@@ -149,7 +149,7 @@ public class Main {
private void suggestDebugMode() {
if (!cli.isEmbedded()) {
- logger.error("Re-run SonarQube Scanner using the -X switch to enable full debug logging.");
+ logger.error("Re-run SonarScanner using the -X switch to enable full debug logging.");
}
}
diff --git a/src/main/java/org/sonarsource/scanner/cli/SystemInfo.java b/src/main/java/org/sonarsource/scanner/cli/SystemInfo.java
index 2ee3468..09ad1f5 100644
--- a/src/main/java/org/sonarsource/scanner/cli/SystemInfo.java
+++ b/src/main/java/org/sonarsource/scanner/cli/SystemInfo.java
@@ -30,7 +30,7 @@ class SystemInfo {
}
static void print(Logs logger) {
- logger.info("SonarQube Scanner " + ScannerVersion.version());
+ logger.info("SonarScanner " + ScannerVersion.version());
logger.info(java());
logger.info(os());
String scannerOpts = system.getenv("SONAR_SCANNER_OPTS");