aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/sonarsource/scanner
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2017-07-28 11:56:24 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2017-07-31 08:55:41 +0200
commit265b9abd6d508d5ae83495958c27363fdd7d6740 (patch)
tree167aba33d4d5b139b9a668cee39070c9a4dd62d6 /src/main/java/org/sonarsource/scanner
parent4cdf9a6086f020160772337af5622d21a8e9c861 (diff)
downloadsonar-scanner-cli-265b9abd6d508d5ae83495958c27363fdd7d6740.tar.gz
sonar-scanner-cli-265b9abd6d508d5ae83495958c27363fdd7d6740.zip
SQSCANNER-42 Stop support of SQ < 5.2
Diffstat (limited to 'src/main/java/org/sonarsource/scanner')
-rw-r--r--src/main/java/org/sonarsource/scanner/cli/Main.java21
-rw-r--r--src/main/java/org/sonarsource/scanner/cli/ScannerFactory.java6
2 files changed, 8 insertions, 19 deletions
diff --git a/src/main/java/org/sonarsource/scanner/cli/Main.java b/src/main/java/org/sonarsource/scanner/cli/Main.java
index d93116b..7144ec8 100644
--- a/src/main/java/org/sonarsource/scanner/cli/Main.java
+++ b/src/main/java/org/sonarsource/scanner/cli/Main.java
@@ -19,6 +19,7 @@
*/
package org.sonarsource.scanner.cli;
+import java.util.Map;
import java.util.Properties;
import org.sonarsource.scanner.api.EmbeddedScanner;
import org.sonarsource.scanner.api.ScanProperties;
@@ -64,32 +65,20 @@ public class Main {
Stats stats = new Stats(logger).start();
int status = Exit.ERROR;
- boolean started = false;
try {
Properties p = conf.properties();
checkSkip(p);
configureLogging(p);
init(p);
runner.start();
- started = true;
logger.info("SonarQube server " + runner.serverVersion());
- runAnalysis(stats, p);
+ execute(stats, p);
status = Exit.SUCCESS;
} catch (Throwable e) {
- status = Exit.ERROR;
displayExecutionResult(stats, "FAILURE");
showError("Error during SonarQube Scanner execution", e, cli.isDebugEnabled());
} finally {
- try {
- if (started) {
- runner.stop();
- }
- } catch (Throwable e) {
- status = Exit.ERROR;
- logger.error("Unable to properly stop the scanner", e);
- } finally {
- exit.exit(status);
- }
+ exit.exit(status);
}
}
@@ -118,8 +107,8 @@ public class Main {
}
}
- private void runAnalysis(Stats stats, Properties p) {
- runner.runAnalysis(p);
+ private void execute(Stats stats, Properties p) {
+ runner.execute((Map) p);
displayExecutionResult(stats, "SUCCESS");
}
diff --git a/src/main/java/org/sonarsource/scanner/cli/ScannerFactory.java b/src/main/java/org/sonarsource/scanner/cli/ScannerFactory.java
index 04a6684..7fe4d9f 100644
--- a/src/main/java/org/sonarsource/scanner/cli/ScannerFactory.java
+++ b/src/main/java/org/sonarsource/scanner/cli/ScannerFactory.java
@@ -19,6 +19,7 @@
*/
package org.sonarsource.scanner.cli;
+import java.util.Map;
import java.util.Properties;
import org.sonarsource.scanner.api.EmbeddedScanner;
import org.sonarsource.scanner.api.LogOutput;
@@ -32,9 +33,8 @@ class ScannerFactory {
}
EmbeddedScanner create(Properties props) {
- return EmbeddedScanner.create(new DefaultLogOutput())
- .addGlobalProperties(props)
- .setApp("ScannerCli", ScannerVersion.version());
+ return EmbeddedScanner.create("ScannerCli", ScannerVersion.version(), new DefaultLogOutput())
+ .addGlobalProperties((Map) props);
}
class DefaultLogOutput implements LogOutput {