]> source.dussan.org Git - sonar-scanner-cli.git/commitdiff
SQSCANNER-26 Support SONARQUBE_SCANNER_PARAMS and sonar.scanner.skip
authorDuarte Meneses <duarte.meneses@sonarsource.com>
Mon, 15 Aug 2016 12:20:49 +0000 (14:20 +0200)
committerDuarte Meneses <duarte.meneses@sonarsource.com>
Mon, 15 Aug 2016 12:20:49 +0000 (14:20 +0200)
pom.xml
src/main/java/org/sonarsource/scanner/cli/Conf.java

diff --git a/pom.xml b/pom.xml
index 5efc7ad799fab58c272cec0108a7cb1e4ffe503b..b1683755f8419ab26c059e1c3883148d5887ef6a 100644 (file)
--- a/pom.xml
+++ b/pom.xml
     <dependency>
       <groupId>org.sonarsource.scanner.api</groupId>
       <artifactId>sonar-scanner-api</artifactId>
-      <version>2.7-build634</version>
-    </dependency>
-    <dependency>
-      <groupId>com.eclipsesource.minimal-json</groupId>
-      <artifactId>minimal-json</artifactId>
-      <version>0.9.4</version>
+      <version>2.7-build645</version>
     </dependency>
     <dependency>
       <groupId>com.google.code.findbugs</groupId>
index 790703035d5822b7935004e1239f327f9100c120..c224204049be2d3d879708674ac9f8dbdb55f27a 100644 (file)
@@ -27,15 +27,11 @@ import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.text.MessageFormat;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 
-import com.eclipsesource.json.Json;
-import com.eclipsesource.json.JsonObject;
-import com.eclipsesource.json.JsonObject.Member;
-import com.eclipsesource.json.JsonValue;
+import org.sonarsource.scanner.api.Utils;
 
 class Conf {
   private static final String SCANNER_HOME = "scanner.home";
@@ -46,7 +42,6 @@ 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 SONARQUBE_SCANNER_PARAMS = "SONARQUBE_SCANNER_PARAMS";
 
   private final Cli cli;
   private final Logs logger;
@@ -72,27 +67,7 @@ class Conf {
   }
 
   private Properties loadEnvironmentProperties() {
-    Properties props = new Properties();
-
-    String scannerParams = env.get(SONARQUBE_SCANNER_PARAMS);
-    if (scannerParams != null) {
-      try {
-
-        JsonValue jsonValue = Json.parse(scannerParams);
-        JsonObject jsonObject = jsonValue.asObject();
-        Iterator<Member> it = jsonObject.iterator();
-
-        while (it.hasNext()) {
-          Member member = it.next();
-          String key = member.getName();
-          String value = member.getValue().asString();
-          props.put(key, value);
-        }
-      } catch (Exception e) {
-        throw new IllegalStateException("Failed to parse JSON in SONARQUBE_SCANNER_PARAMS environment variable", e);
-      }
-    }
-    return props;
+    return Utils.loadEnvironmentProperties(env);
   }
 
   private Properties loadGlobalProperties() throws IOException {