diff options
author | Matteo Mara <matteo.mara@sonarsource.com> | 2024-01-31 16:02:54 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-01-31 20:03:38 +0000 |
commit | 737060dc2ce6517ee62d1f8861063aed072467af (patch) | |
tree | 835dd4bd3fb373243c7379cdbae2e688baec5bb2 /sonar-scanner-engine/src | |
parent | 2ef09d69e1a1eeccd205618191f820c414edd64d (diff) | |
download | sonarqube-737060dc2ce6517ee62d1f8861063aed072467af.tar.gz sonarqube-737060dc2ce6517ee62d1f8861063aed072467af.zip |
SONAR-21195 sonar.plugins.downloadOnlyRequired defaults to false if not defined
Diffstat (limited to 'sonar-scanner-engine/src')
4 files changed, 9 insertions, 1 deletions
diff --git a/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumIT.java b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumIT.java index 0229752156f..719b060cc27 100644 --- a/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumIT.java +++ b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumIT.java @@ -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); diff --git a/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/issues/IssuesMediumIT.java b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/issues/IssuesMediumIT.java index 87515a109d7..27508c01b09 100644 --- a/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/issues/IssuesMediumIT.java +++ b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/issues/IssuesMediumIT.java @@ -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(); diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginRepository.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginRepository.java index fb2834604f6..629c460e252 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginRepository.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginRepository.java @@ -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()); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerPluginRepositoryTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerPluginRepositoryTest.java index 0c3f7c14a30..131c0a1aa3b 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerPluginRepositoryTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerPluginRepositoryTest.java @@ -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); |