]> source.dussan.org Git - sonarqube.git/commitdiff
Clean some scanner component names
authorJulien HENRY <julien.henry@sonarsource.com>
Tue, 13 Nov 2018 15:27:39 +0000 (16:27 +0100)
committersonartech <sonartech@sonarsource.com>
Wed, 16 Jan 2019 08:42:59 +0000 (09:42 +0100)
20 files changed:
sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/pattern/AbstractPatternInitializer.java
sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/pattern/IssueExclusionPatternInitializer.java
sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/pattern/IssueInclusionPatternInitializer.java
sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleConfiguration.java [new file with mode: 0644]
sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleConfigurationProvider.java [new file with mode: 0644]
sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleScanContainer.java
sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleSettings.java [deleted file]
sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleSettingsProvider.java [deleted file]
sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/MutableModuleSettings.java
sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/MutableProjectSettings.java
sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectConfiguration.java [new file with mode: 0644]
sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectConfigurationProvider.java [new file with mode: 0644]
sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectScanContainer.java
sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectSettings.java [deleted file]
sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectSettingsProvider.java [deleted file]
sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/BranchConfigurationProvider.java
sonar-scanner-engine/src/test/java/org/sonar/scanner/genericcoverage/GenericCoverageSensorTest.java
sonar-scanner-engine/src/test/java/org/sonar/scanner/genericcoverage/GenericTestExecutionSensorTest.java
sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/MutableModuleSettingsTest.java
sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectScanContainerTest.java

index d206f91156eb86e6b30d6d637b7b719822bdb2e6..8d26bed1a9ae895ad0bb29fde75d70aa8d650aba 100644 (file)
@@ -34,8 +34,8 @@ public abstract class AbstractPatternInitializer {
   private Configuration settings;
   private List<IssuePattern> multicriteriaPatterns;
 
-  protected AbstractPatternInitializer(Configuration settings) {
-    this.settings = settings;
+  protected AbstractPatternInitializer(Configuration config) {
+    this.settings = config;
     initPatterns();
   }
 
index b4018c829c3e3ce5a9fcd6dc794d88ae25f23653..01e0ab76b06535ce60e68dfede87405fb40a9228 100644 (file)
@@ -40,7 +40,7 @@ public class IssueExclusionPatternInitializer extends AbstractPatternInitializer
 
   @Override
   protected String getMulticriteriaConfigurationKey() {
-    return "sonar.issue.ignore" + ".multicriteria";
+    return IssueExclusionProperties.EXCLUSION_KEY_PREFIX + ".multicriteria";
   }
 
   @Override
index 164c90a317b1a20ccf1486ec744748b2089f3988..0fa72da96db7b49691315d716d386ae4633a03fc 100644 (file)
@@ -20,6 +20,7 @@
 package org.sonar.scanner.issue.ignore.pattern;
 
 import org.sonar.api.config.Configuration;
+import org.sonar.core.config.IssueExclusionProperties;
 
 public class IssueInclusionPatternInitializer extends AbstractPatternInitializer {
 
@@ -29,6 +30,6 @@ public class IssueInclusionPatternInitializer extends AbstractPatternInitializer
 
   @Override
   protected String getMulticriteriaConfigurationKey() {
-    return "sonar.issue.enforce" + ".multicriteria";
+    return IssueExclusionProperties.INCLUSION_KEY_PREFIX + ".multicriteria";
   }
 }
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleConfiguration.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleConfiguration.java
new file mode 100644 (file)
index 0000000..2dbcc57
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2019 SonarSource SA
+ * mailto:info 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.sonar.scanner.scan;
+
+import java.util.Map;
+import org.sonar.api.config.Encryption;
+import org.sonar.api.config.PropertyDefinitions;
+import org.sonar.scanner.bootstrap.GlobalAnalysisMode;
+import org.sonar.scanner.config.DefaultConfiguration;
+
+public class ModuleConfiguration extends DefaultConfiguration {
+
+  public ModuleConfiguration(PropertyDefinitions propertyDefinitions, Encryption encryption, GlobalAnalysisMode mode, Map<String, String> props) {
+    super(propertyDefinitions, encryption, mode, props);
+  }
+
+}
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleConfigurationProvider.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleConfigurationProvider.java
new file mode 100644 (file)
index 0000000..f078a0d
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2019 SonarSource SA
+ * mailto:info 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.sonar.scanner.scan;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import org.picocontainer.injectors.ProviderAdapter;
+import org.sonar.api.batch.bootstrap.ProjectDefinition;
+import org.sonar.api.batch.fs.internal.DefaultInputModule;
+import org.sonar.scanner.bootstrap.GlobalAnalysisMode;
+import org.sonar.scanner.bootstrap.GlobalConfiguration;
+import org.sonar.scanner.report.AnalysisContextReportPublisher;
+import org.sonar.scanner.repository.ProjectRepositories;
+
+public class ModuleConfigurationProvider extends ProviderAdapter {
+
+  private ModuleConfiguration moduleConfiguration;
+
+  public ModuleConfiguration provide(GlobalConfiguration globalConfig, DefaultInputModule module, ProjectRepositories projectRepos,
+                                     GlobalAnalysisMode analysisMode, AnalysisContextReportPublisher contextReportPublisher) {
+    if (moduleConfiguration == null) {
+
+      Map<String, String> settings = new LinkedHashMap<>();
+      settings.putAll(globalConfig.getProperties());
+      settings.putAll(addServerSidePropertiesIfModuleExists(projectRepos, module.definition()));
+      addScannerSideProperties(settings, module.definition());
+      contextReportPublisher.dumpModuleSettings(module);
+
+      moduleConfiguration = new ModuleConfiguration(globalConfig.getDefinitions(), globalConfig.getEncryption(), analysisMode, settings);
+    }
+    return moduleConfiguration;
+  }
+
+  private static Map<String, String> addServerSidePropertiesIfModuleExists(ProjectRepositories projectRepos, ProjectDefinition def) {
+    if (projectRepos.moduleExists(def.getKeyWithBranch())) {
+      return projectRepos.settings(def.getKeyWithBranch());
+    } else {
+      // Module doesn't exist on server. Try to add parent server settings as inheritance.
+      ProjectDefinition parentDef = def.getParent();
+      if (parentDef != null) {
+        return addServerSidePropertiesIfModuleExists(projectRepos, parentDef);
+      }
+      return Collections.emptyMap();
+    }
+  }
+
+  private static void addScannerSideProperties(Map<String, String> settings, ProjectDefinition project) {
+    List<ProjectDefinition> orderedProjects = getTopDownParentProjects(project);
+    for (ProjectDefinition p : orderedProjects) {
+      settings.putAll(p.properties());
+    }
+  }
+
+  /**
+   * From root to given project
+   */
+  static List<ProjectDefinition> getTopDownParentProjects(ProjectDefinition project) {
+    List<ProjectDefinition> result = new ArrayList<>();
+    ProjectDefinition p = project;
+    while (p != null) {
+      result.add(0, p);
+      p = p.getParent();
+    }
+    return result;
+  }
+}
index 68bd4a0ffdf66ea33cd628769e4099b5e81b0433..aa12cc96b7ff967cd8aeabc86ec57bf04b64b7bf 100644 (file)
@@ -89,7 +89,7 @@ public class ModuleScanContainer extends ComponentContainer {
       module.definition(),
       module,
       MutableModuleSettings.class,
-      new ModuleSettingsProvider());
+      new ModuleConfigurationProvider());
 
     if (analysisMode.isIssues()) {
       add(
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleSettings.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleSettings.java
deleted file mode 100644 (file)
index 3382fdf..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info 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.sonar.scanner.scan;
-
-import java.util.Map;
-import org.sonar.api.config.Encryption;
-import org.sonar.api.config.PropertyDefinitions;
-import org.sonar.scanner.bootstrap.GlobalAnalysisMode;
-import org.sonar.scanner.config.DefaultConfiguration;
-
-public class ModuleSettings extends DefaultConfiguration {
-
-  public ModuleSettings(PropertyDefinitions propertyDefinitions, Encryption encryption, GlobalAnalysisMode mode, Map<String, String> props) {
-    super(propertyDefinitions, encryption, mode, props);
-  }
-
-}
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleSettingsProvider.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleSettingsProvider.java
deleted file mode 100644 (file)
index a5ce21f..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info 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.sonar.scanner.scan;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import org.picocontainer.injectors.ProviderAdapter;
-import org.sonar.api.batch.bootstrap.ProjectDefinition;
-import org.sonar.api.batch.fs.internal.DefaultInputModule;
-import org.sonar.scanner.bootstrap.GlobalAnalysisMode;
-import org.sonar.scanner.bootstrap.GlobalConfiguration;
-import org.sonar.scanner.report.AnalysisContextReportPublisher;
-import org.sonar.scanner.repository.ProjectRepositories;
-
-public class ModuleSettingsProvider extends ProviderAdapter {
-
-  private ModuleSettings projectSettings;
-
-  public ModuleSettings provide(GlobalConfiguration globalSettings, DefaultInputModule module, ProjectRepositories projectRepos,
-    GlobalAnalysisMode analysisMode, AnalysisContextReportPublisher contextReportPublisher) {
-    if (projectSettings == null) {
-
-      Map<String, String> settings = new LinkedHashMap<>();
-      settings.putAll(globalSettings.getProperties());
-      settings.putAll(addServerSidePropertiesIfModuleExists(projectRepos, module.definition()));
-      addScannerSideProperties(settings, module.definition());
-      contextReportPublisher.dumpModuleSettings(module);
-
-      projectSettings = new ModuleSettings(globalSettings.getDefinitions(), globalSettings.getEncryption(), analysisMode, settings);
-    }
-    return projectSettings;
-  }
-
-  private static Map<String, String> addServerSidePropertiesIfModuleExists(ProjectRepositories projectRepos, ProjectDefinition def) {
-    if (projectRepos.moduleExists(def.getKeyWithBranch())) {
-      return projectRepos.settings(def.getKeyWithBranch());
-    } else {
-      // Module doesn't exist on server. Try to add parent server settings as inheritance.
-      ProjectDefinition parentDef = def.getParent();
-      if (parentDef != null) {
-        return addServerSidePropertiesIfModuleExists(projectRepos, parentDef);
-      }
-      return Collections.emptyMap();
-    }
-  }
-
-  private static void addScannerSideProperties(Map<String, String> settings, ProjectDefinition project) {
-    List<ProjectDefinition> orderedProjects = getTopDownParentProjects(project);
-    for (ProjectDefinition p : orderedProjects) {
-      settings.putAll(p.properties());
-    }
-  }
-
-  /**
-   * From root to given project
-   */
-  static List<ProjectDefinition> getTopDownParentProjects(ProjectDefinition project) {
-    List<ProjectDefinition> result = new ArrayList<>();
-    ProjectDefinition p = project;
-    while (p != null) {
-      result.add(0, p);
-      p = p.getParent();
-    }
-    return result;
-  }
-}
index b8daf815dba428073d88e137189d18a7660c2906..d4a87b31e40c211a27de00da6806a3275871cc71 100644 (file)
@@ -33,7 +33,7 @@ import org.sonar.scanner.repository.ProjectRepositories;
 import static java.util.Objects.requireNonNull;
 
 /**
- * @deprecated since 6.5 {@link ModuleSettings} used to be mutable, so keep a mutable copy for backward compatibility.
+ * @deprecated since 6.5 {@link ModuleConfiguration} used to be mutable, so keep a mutable copy for backward compatibility.
  */
 @Deprecated
 public class MutableModuleSettings extends Settings {
@@ -69,7 +69,7 @@ public class MutableModuleSettings extends Settings {
   }
 
   private void addBuildProperties(ProjectDefinition project) {
-    List<ProjectDefinition> orderedProjects = ModuleSettingsProvider.getTopDownParentProjects(project);
+    List<ProjectDefinition> orderedProjects = ModuleConfigurationProvider.getTopDownParentProjects(project);
     for (ProjectDefinition p : orderedProjects) {
       addProperties(p.properties());
     }
index 3b17bd91f29aff8cbe0e6bf67469ac239a6a4b3f..c09c844a09544f5f17c14ab27cb9595895cec484 100644 (file)
@@ -32,7 +32,7 @@ import org.sonar.scanner.repository.ProjectRepositories;
 import static java.util.Objects.requireNonNull;
 
 /**
- * @deprecated since 6.5 {@link ProjectSettings} used to be mutable, so keep a mutable copy for backward compatibility.
+ * @deprecated since 6.5 {@link ProjectConfiguration} used to be mutable, so keep a mutable copy for backward compatibility.
  */
 @Deprecated
 public class MutableProjectSettings extends Settings {
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectConfiguration.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectConfiguration.java
new file mode 100644 (file)
index 0000000..53a727b
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2019 SonarSource SA
+ * mailto:info 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.sonar.scanner.scan;
+
+import java.util.Map;
+import org.sonar.api.config.Encryption;
+import org.sonar.api.config.PropertyDefinitions;
+import org.sonar.scanner.bootstrap.GlobalAnalysisMode;
+import org.sonar.scanner.config.DefaultConfiguration;
+
+public class ProjectConfiguration extends DefaultConfiguration {
+
+  public ProjectConfiguration(PropertyDefinitions propertyDefinitions, Encryption encryption, GlobalAnalysisMode mode, Map<String, String> props) {
+    super(propertyDefinitions, encryption, mode, props);
+  }
+
+}
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectConfigurationProvider.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectConfigurationProvider.java
new file mode 100644 (file)
index 0000000..5104162
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2019 SonarSource SA
+ * mailto:info 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.sonar.scanner.scan;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+import org.picocontainer.injectors.ProviderAdapter;
+import org.sonar.api.batch.bootstrap.ProjectReactor;
+import org.sonar.scanner.bootstrap.GlobalAnalysisMode;
+import org.sonar.scanner.bootstrap.GlobalConfiguration;
+import org.sonar.scanner.repository.ProjectRepositories;
+
+public class ProjectConfigurationProvider extends ProviderAdapter {
+
+  private ProjectConfiguration projectConfig;
+
+  public ProjectConfiguration provide(ProjectReactor reactor, GlobalConfiguration globalSettings, ProjectRepositories projectRepositories, GlobalAnalysisMode mode) {
+    if (projectConfig == null) {
+
+      Map<String, String> settings = new LinkedHashMap<>();
+      settings.putAll(globalSettings.getProperties());
+      settings.putAll(projectRepositories.settings(reactor.getRoot().getKeyWithBranch()));
+      settings.putAll(reactor.getRoot().properties());
+
+      projectConfig = new ProjectConfiguration(globalSettings.getDefinitions(), globalSettings.getEncryption(), mode, settings);
+    }
+    return projectConfig;
+  }
+}
index 0171e117e5f959b71a2f433d81f609d56fe10bd7..5b9f43f363882872b3556ae44037a6bf742602a8 100644 (file)
@@ -119,8 +119,8 @@ public class ProjectScanContainer extends ComponentContainer {
 
   @Override
   protected void doBeforeStart() {
-    addBatchComponents();
-    addBatchExtensions();
+    addScannerComponents();
+    addScannerExtensions();
     ProjectLock lock = getComponentByType(ProjectLock.class);
     lock.tryLock();
     getComponentByType(WorkDirectoriesInitializer.class).execute();
@@ -133,7 +133,7 @@ public class ProjectScanContainer extends ComponentContainer {
 
   }
 
-  private void addBatchComponents() {
+  private void addScannerComponents() {
     add(
       props,
       ProjectReactorBuilder.class,
@@ -202,7 +202,7 @@ public class ProjectScanContainer extends ComponentContainer {
 
       MutableProjectSettings.class,
       ScannerProperties.class,
-      new ProjectSettingsProvider(),
+      new ProjectConfigurationProvider(),
 
       // Report
       ScannerMetrics.class,
@@ -252,15 +252,15 @@ public class ProjectScanContainer extends ComponentContainer {
     return getComponentByType(GlobalAnalysisMode.class).isIssues();
   }
 
-  private void addBatchExtensions() {
+  private void addScannerExtensions() {
     getComponentByType(CoreExtensionsInstaller.class)
-      .install(this, noExtensionFilter(), extension -> isInstantiationStrategy(extension, PER_BATCH));
+      .install(this, noExtensionFilter(), extension -> getScannerProjectExtensionsFilter().accept(extension));
     getComponentByType(ExtensionInstaller.class)
-      .install(this, getBatchPluginExtensionsFilter());
+      .install(this, getScannerProjectExtensionsFilter());
   }
 
   @VisibleForTesting
-  static ExtensionMatcher getBatchPluginExtensionsFilter() {
+  static ExtensionMatcher getScannerProjectExtensionsFilter() {
     return extension -> isScannerSide(extension) || (isDeprecatedScannerSide(extension) && isInstantiationStrategy(extension, PER_BATCH));
   }
 
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectSettings.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectSettings.java
deleted file mode 100644 (file)
index 6c60803..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info 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.sonar.scanner.scan;
-
-import java.util.Map;
-import org.sonar.api.config.Encryption;
-import org.sonar.api.config.PropertyDefinitions;
-import org.sonar.scanner.bootstrap.GlobalAnalysisMode;
-import org.sonar.scanner.config.DefaultConfiguration;
-
-public class ProjectSettings extends DefaultConfiguration {
-
-  public ProjectSettings(PropertyDefinitions propertyDefinitions, Encryption encryption, GlobalAnalysisMode mode, Map<String, String> props) {
-    super(propertyDefinitions, encryption, mode, props);
-  }
-
-}
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectSettingsProvider.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectSettingsProvider.java
deleted file mode 100644 (file)
index 918af7b..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info 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.sonar.scanner.scan;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-import org.picocontainer.injectors.ProviderAdapter;
-import org.sonar.api.batch.bootstrap.ProjectReactor;
-import org.sonar.scanner.bootstrap.GlobalAnalysisMode;
-import org.sonar.scanner.bootstrap.GlobalConfiguration;
-import org.sonar.scanner.repository.ProjectRepositories;
-
-public class ProjectSettingsProvider extends ProviderAdapter {
-
-  private ProjectSettings projectSettings;
-
-  public ProjectSettings provide(ProjectReactor reactor, GlobalConfiguration globalSettings, ProjectRepositories projectRepositories, GlobalAnalysisMode mode) {
-    if (projectSettings == null) {
-
-      Map<String, String> settings = new LinkedHashMap<>();
-      settings.putAll(globalSettings.getProperties());
-      settings.putAll(projectRepositories.settings(reactor.getRoot().getKeyWithBranch()));
-      settings.putAll(reactor.getRoot().properties());
-
-      projectSettings = new ProjectSettings(globalSettings.getDefinitions(), globalSettings.getEncryption(), mode, settings);
-    }
-    return projectSettings;
-  }
-}
index 0e0f827a5bea08f230ffd158e12ec6b952115170..a1c78fc65dd39d5ba8a82da71db167438d207739 100644 (file)
@@ -56,7 +56,7 @@ public class BranchConfigurationProvider extends ProviderAdapter {
   }
 
   private static Supplier<Map<String, String>> createSettingsSupplier(GlobalConfiguration globalConfiguration, ProjectDefinition root, SettingsLoader settingsLoader) {
-    // we can't get ProjectSettings because it creates a circular dependency.
+    // we can't get ProjectConfiguration because it creates a circular dependency.
     // We create our own settings which will only be loaded if needed.
     return () -> {
       Map<String, String> settings = new HashMap<>();
index ce394b9ffe3baa20aaddf90e0fa4bc8da239e8a3..4baae856d69642b035f0e39f6c6ab25c3deefc53 100644 (file)
@@ -30,7 +30,7 @@ import org.sonar.api.utils.log.LogTester;
 import org.sonar.api.utils.log.LoggerLevel;
 import org.sonar.scanner.bootstrap.GlobalAnalysisMode;
 import org.sonar.scanner.config.DefaultConfiguration;
-import org.sonar.scanner.scan.ProjectSettings;
+import org.sonar.scanner.scan.ProjectConfiguration;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.mockito.Mockito.mock;
@@ -49,7 +49,7 @@ public class GenericCoverageSensorTest {
     settings.put(GenericCoverageSensor.OLD_OVERALL_COVERAGE_REPORT_PATHS_PROPERTY_KEY, "old5.xml,old6.xml");
 
     PropertyDefinitions defs = new PropertyDefinitions(GenericCoverageSensor.properties());
-    DefaultConfiguration config = new ProjectSettings(defs, new Encryption(null), mock(GlobalAnalysisMode.class), settings);
+    DefaultConfiguration config = new ProjectConfiguration(defs, new Encryption(null), mock(GlobalAnalysisMode.class), settings);
 
     Set<String> reportPaths = new GenericCoverageSensor(config).loadReportPaths();
 
index 35bc5e3c435f7677267bca256bac827bcd1b0a02..739532a9d2c29a32adecfc94e524b937489854a4 100644 (file)
@@ -31,14 +31,12 @@ import org.junit.rules.TemporaryFolder;
 import org.sonar.api.batch.sensor.internal.SensorContextTester;
 import org.sonar.api.config.Encryption;
 import org.sonar.api.config.PropertyDefinitions;
-import org.sonar.api.config.Settings;
-import org.sonar.api.config.internal.MapSettings;
 import org.sonar.api.utils.log.LogTester;
 import org.sonar.api.utils.log.LoggerLevel;
 import org.sonar.scanner.bootstrap.GlobalAnalysisMode;
 import org.sonar.scanner.config.DefaultConfiguration;
 import org.sonar.scanner.deprecated.test.TestPlanBuilder;
-import org.sonar.scanner.scan.ProjectSettings;
+import org.sonar.scanner.scan.ProjectConfiguration;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.mockito.Mockito.mock;
@@ -61,7 +59,7 @@ public class GenericTestExecutionSensorTest {
     Map<String, String> settings = new HashMap<>();
     settings.put(GenericTestExecutionSensor.OLD_UNIT_TEST_REPORT_PATHS_PROPERTY_KEY, "report.xml");
     PropertyDefinitions defs = new PropertyDefinitions(GenericTestExecutionSensor.properties());
-    DefaultConfiguration config = new ProjectSettings(defs, new Encryption(null), mock(GlobalAnalysisMode.class), settings);
+    DefaultConfiguration config = new ProjectConfiguration(defs, new Encryption(null), mock(GlobalAnalysisMode.class), settings);
 
     new GenericTestExecutionSensor(mock(TestPlanBuilder.class), config).execute(context);
     assertThat(logTester.logs(LoggerLevel.WARN)).contains(
index 3cecb07c1205675b4585afa87dbb9952146007f1..86be7dfda585f1a4e0daa6d1440678957bf8a5d4 100644 (file)
@@ -76,7 +76,7 @@ public class MutableModuleSettingsTest {
     grandParent.addSubProject(parent);
     parent.addSubProject(child);
 
-    List<ProjectDefinition> hierarchy = ModuleSettingsProvider.getTopDownParentProjects(child);
+    List<ProjectDefinition> hierarchy = ModuleConfigurationProvider.getTopDownParentProjects(child);
     assertThat(hierarchy.get(0)).isEqualTo(grandParent);
     assertThat(hierarchy.get(1)).isEqualTo(parent);
     assertThat(hierarchy.get(2)).isEqualTo(child);
index dfb191031ce981d7e1210be4910e79d3fb39f66e..f9738b93d56d2c3a6638764eeee8036e34794f49 100644 (file)
@@ -32,7 +32,7 @@ public class ProjectScanContainerTest {
 
   @Test
   public void should_add_only_batch_extensions() {
-    ExtensionMatcher filter = ProjectScanContainer.getBatchPluginExtensionsFilter();
+    ExtensionMatcher filter = ProjectScanContainer.getScannerProjectExtensionsFilter();
 
     assertThat(filter.accept(new MyBatchExtension())).isTrue();
     assertThat(filter.accept(MyBatchExtension.class)).isTrue();