]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-21195 sonar.plugins.downloadOnlyRequired defaults to false if not defined
authorMatteo Mara <matteo.mara@sonarsource.com>
Wed, 31 Jan 2024 15:02:54 +0000 (16:02 +0100)
committersonartech <sonartech@sonarsource.com>
Wed, 31 Jan 2024 20:03:38 +0000 (20:03 +0000)
sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumIT.java
sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/issues/IssuesMediumIT.java
sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginRepository.java
sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerPluginRepositoryTest.java

index 0229752156fab10a46d50c40967cd81995a2ff00..719b060cc279093b01ea9f4b5edf1e972a13291e 100644 (file)
@@ -28,6 +28,7 @@ import java.nio.file.Files;
 import java.nio.file.LinkOption;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.util.Map;
 import java.util.Random;
 import java.util.Set;
 import org.apache.commons.io.FileUtils;
@@ -64,6 +65,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.assertj.core.api.Assertions.tuple;
 import static org.junit.Assume.assumeFalse;
 import static org.junit.Assume.assumeTrue;
+import static org.sonar.core.config.ScannerProperties.PLUGIN_LOADING_OPTIMIZATION_KEY;
 
 public class FileSystemMediumIT {
 
@@ -1264,6 +1266,7 @@ public class FileSystemMediumIT {
     File projectDir = new File("test-resources/mediumtest/xoo/sample-with-input-file-filters");
     AnalysisResult result = tester
       .newAnalysis(new File(projectDir, "sonar-project.properties"))
+      .properties(Map.of(PLUGIN_LOADING_OPTIMIZATION_KEY, "true"))
       .execute();
 
     assertThat(result.inputFiles()).hasSize(1);
index 87515a109d7f2535b4037122bfb97510c5953c46..27508c01b091c35b42c34963b39266899bbdb4b3 100644 (file)
@@ -46,6 +46,7 @@ import org.sonar.xoo.rule.XooRulesDefinition;
 import static java.util.Collections.emptySet;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.tuple;
+import static org.sonar.core.config.ScannerProperties.PLUGIN_LOADING_OPTIMIZATION_KEY;
 
 public class IssuesMediumIT {
 
@@ -284,6 +285,7 @@ public class IssuesMediumIT {
         .put("sonar.issue.ignore.multicriteria", "1")
         .put("sonar.issue.ignore.multicriteria.1.ruleKey", "*")
         .put("sonar.issue.ignore.multicriteria.1.resourceKey", "*")
+        .put(PLUGIN_LOADING_OPTIMIZATION_KEY, "true")
         .build())
       .execute();
 
@@ -299,6 +301,7 @@ public class IssuesMediumIT {
         .put("moduleA.sonar.issue.ignore.multicriteria", "1")
         .put("moduleA.sonar.issue.ignore.multicriteria.1.ruleKey", "*")
         .put("moduleA.sonar.issue.ignore.multicriteria.1.resourceKey", "*")
+        .put(PLUGIN_LOADING_OPTIMIZATION_KEY, "true")
         .build())
       .execute();
 
@@ -326,6 +329,7 @@ public class IssuesMediumIT {
         .put("moduleA.sonar.issue.ignore.multicriteria", "1")
         .put("moduleA.sonar.issue.ignore.multicriteria.1.ruleKey", "*")
         .put("moduleA.sonar.issue.ignore.multicriteria.1.resourceKey", "*")
+        .put(PLUGIN_LOADING_OPTIMIZATION_KEY, "true")
         .build())
       .execute();
 
index fb2834604f657d4b27d05c800da365404f7f4614..629c460e252278abf2e33ebcaecd0d083fafe832 100644 (file)
@@ -68,7 +68,7 @@ public class ScannerPluginRepository implements PluginRepository, Startable {
 
   @Override
   public void start() {
-    shouldLoadOnlyRequiredPluginsOnStart = properties.getBoolean(PLUGIN_LOADING_OPTIMIZATION_KEY).orElse(true);
+    shouldLoadOnlyRequiredPluginsOnStart = properties.getBoolean(PLUGIN_LOADING_OPTIMIZATION_KEY).orElse(false);
     if (!shouldLoadOnlyRequiredPluginsOnStart) {
       LOG.warn("{} is false, so ALL available plugins will be downloaded", PLUGIN_LOADING_OPTIMIZATION_KEY);
       pluginsByKeys = new HashMap<>(installer.installAllPlugins());
index 0c3f7c14a3027b2eea3f1a572d89ed98be47b9b0..131c0a1aa3b74da2e2bdf2fc1c92c77b65141dc4 100644 (file)
@@ -69,6 +69,7 @@ public class ScannerPluginRepositoryTest {
       .thenReturn(ImmutableMap.of("squid", squidInstance))
       .thenReturn(ImmutableMap.of("java", javaInstance));
 
+    when(properties.getBoolean(PLUGIN_LOADING_OPTIMIZATION_KEY)).thenReturn(Optional.of(true));
     when(installer.installRequiredPlugins()).thenReturn(globalPlugins);
     when(installer.installPluginsForLanguages(anySet())).thenReturn(languagePlugins);