aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/SpringProjectScanContainer.java
diff options
context:
space:
mode:
authorMatteo Mara <matteo.mara@sonarsource.com>2023-12-20 12:33:45 +0100
committersonartech <sonartech@sonarsource.com>2023-12-21 20:02:33 +0000
commitb2bf62fd3a2507e05539befb66c6292757b535a4 (patch)
tree28018603844869c686ec0031812e20022a04dff3 /sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/SpringProjectScanContainer.java
parent6e57d86a3edb938012009bdd47bcbaf77a07acc8 (diff)
downloadsonarqube-b2bf62fd3a2507e05539befb66c6292757b535a4.tar.gz
sonarqube-b2bf62fd3a2507e05539befb66c6292757b535a4.zip
SONAR-21195 Support ProjectBuilders for on-demand plugins
Diffstat (limited to 'sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/SpringProjectScanContainer.java')
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/SpringProjectScanContainer.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/SpringProjectScanContainer.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/SpringProjectScanContainer.java
index b70fde51660..6ec3d025c8d 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/SpringProjectScanContainer.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/SpringProjectScanContainer.java
@@ -25,6 +25,8 @@ import javax.annotation.Priority;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonar.api.Plugin;
+import org.sonar.api.batch.bootstrap.ProjectBuilder;
+import org.sonar.api.batch.bootstrap.ProjectReactor;
import org.sonar.api.batch.fs.internal.DefaultInputModule;
import org.sonar.api.measures.Metrics;
import org.sonar.api.resources.Languages;
@@ -138,6 +140,12 @@ public class SpringProjectScanContainer extends SpringComponentContainer {
protected void doAfterStart() {
getParentComponentByType(ScannerMetrics.class).addPluginMetrics(getComponentsByType(Metrics.class));
getComponentByType(ProjectLock.class).tryLock();
+
+ // NOTE: ProjectBuilders executed here will have any changes they make to the ProjectReactor discarded.
+ ProjectBuilder[] phase2ProjectBuilders = getComponentsByType(ProjectBuilder.class).toArray(new ProjectBuilder[0]);
+ getComponentByType(ProjectBuildersExecutor.class).executeProjectBuilders(phase2ProjectBuilders, getComponentByType(ProjectReactor.class),
+ "Executing phase 2 project builders");
+
getComponentByType(ProjectFileIndexer.class).index();
GlobalAnalysisMode analysisMode = getComponentByType(GlobalAnalysisMode.class);
InputModuleHierarchy tree = getComponentByType(InputModuleHierarchy.class);