diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2016-01-13 10:48:39 +0100 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2016-01-13 10:48:39 +0100 |
commit | 0078dd22d4846868b808d83a2d53dad5676268f7 (patch) | |
tree | d7a367aba816a191a85cb4dd55dfff5116a9aac1 /src/main/java/org/sonarsource/scanner/cli | |
parent | 24948c3f7082eb56e07238b3b4fd7c9681c368a6 (diff) | |
download | sonar-scanner-cli-0078dd22d4846868b808d83a2d53dad5676268f7.tar.gz sonar-scanner-cli-0078dd22d4846868b808d83a2d53dad5676268f7.zip |
SQSCANNER-10 Display correct version in logs and update labels
Diffstat (limited to 'src/main/java/org/sonarsource/scanner/cli')
4 files changed, 50 insertions, 9 deletions
diff --git a/src/main/java/org/sonarsource/scanner/cli/Conf.java b/src/main/java/org/sonarsource/scanner/cli/Conf.java index c1e9487..7746ee8 100644 --- a/src/main/java/org/sonarsource/scanner/cli/Conf.java +++ b/src/main/java/org/sonarsource/scanner/cli/Conf.java @@ -61,10 +61,10 @@ class Conf { private Properties loadGlobalProperties() throws IOException { File settingsFile = locatePropertiesFile(cli.properties(), RUNNER_HOME, "conf/sonar-runner.properties", RUNNER_SETTINGS); if (settingsFile != null && settingsFile.isFile() && settingsFile.exists()) { - logger.info("Runner configuration file: " + settingsFile.getAbsolutePath()); + logger.info("Scanner configuration file: " + settingsFile.getAbsolutePath()); return toProperties(settingsFile); } - logger.info("Runner configuration file: NONE"); + logger.info("Scanner configuration file: NONE"); return new Properties(); } diff --git a/src/main/java/org/sonarsource/scanner/cli/Main.java b/src/main/java/org/sonarsource/scanner/cli/Main.java index 6a617dd..a4b2526 100644 --- a/src/main/java/org/sonarsource/scanner/cli/Main.java +++ b/src/main/java/org/sonarsource/scanner/cli/Main.java @@ -81,7 +81,7 @@ public class Main { } } catch (Exception e) { displayExecutionResult(stats, "FAILURE"); - showError("Error during Sonar runner execution", e, cli.isDisplayStackTrace()); + showError("Error during SonarQube Scanner execution", e, cli.isDisplayStackTrace()); shutdown.exit(Exit.ERROR); } @@ -96,7 +96,7 @@ public class Main { runAnalysis(stats, p); } catch (Exception e) { displayExecutionResult(stats, "FAILURE"); - showError("Error during Sonar runner execution", e, cli.isDisplayStackTrace()); + showError("Error during SonarQube Scanner execution", e, cli.isDisplayStackTrace()); } } while (waitForUser()); } @@ -171,7 +171,7 @@ public class Main { } } logger.error(""); - logger.error("To see the full stack trace of the errors, re-run SonarQube Runner with the -e switch."); + logger.error("To see the full stack trace of the errors, re-run SonarQube Scanner with the -e switch."); if (!cli.isDebugMode()) { suggestDebugMode(); } @@ -179,7 +179,7 @@ public class Main { } private void suggestDebugMode() { - logger.error("Re-run SonarQube Runner using the -X switch to enable full debug logging."); + logger.error("Re-run SonarQube Scanner using the -X switch to enable full debug logging."); } } diff --git a/src/main/java/org/sonarsource/scanner/cli/ScannerVersion.java b/src/main/java/org/sonarsource/scanner/cli/ScannerVersion.java new file mode 100644 index 0000000..18cf7e5 --- /dev/null +++ b/src/main/java/org/sonarsource/scanner/cli/ScannerVersion.java @@ -0,0 +1,43 @@ +/* + * SonarQube Scanner + * Copyright (C) 2011-2016 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonarsource.scanner.cli; + +import java.util.Scanner; + +public enum ScannerVersion { + + INSTANCE; + + private String version; + + private ScannerVersion() { + Scanner scanner = new Scanner(getClass().getResourceAsStream("/version.txt"), "UTF-8"); + try { + this.version = scanner.next(); + } finally { + scanner.close(); + } + } + + public static String version() { + return INSTANCE.version; + } + +} diff --git a/src/main/java/org/sonarsource/scanner/cli/SystemInfo.java b/src/main/java/org/sonarsource/scanner/cli/SystemInfo.java index 382529a..dadde0d 100644 --- a/src/main/java/org/sonarsource/scanner/cli/SystemInfo.java +++ b/src/main/java/org/sonarsource/scanner/cli/SystemInfo.java @@ -19,8 +19,6 @@ */ package org.sonarsource.scanner.cli; -import org.sonar.runner.api.RunnerVersion; - class SystemInfo { private static System2 system = new System2(); @@ -32,7 +30,7 @@ class SystemInfo { } static void print(Logs logger) { - logger.info("SonarQube Runner " + RunnerVersion.version()); + logger.info("SonarQube Scanner " + ScannerVersion.version()); logger.info(java()); logger.info(os()); String runnerOpts = system.getenv("SONAR_RUNNER_OPTS"); |