aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/InputProjectProvider.java
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2018-11-14 22:47:35 +0100
committersonartech <sonartech@sonarsource.com>2019-01-16 09:43:01 +0100
commitf594bf7568192dbfc9b9a8cf4f7c243ea4ad046b (patch)
treeb4d6818199beebf97e5d4d6a10dfcebde10e7ba8 /sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/InputProjectProvider.java
parenta0acec09a79485117ab9c8e3c67a8446224d5de9 (diff)
downloadsonarqube-f594bf7568192dbfc9b9a8cf4f7c243ea4ad046b.tar.gz
sonarqube-f594bf7568192dbfc9b9a8cf4f7c243ea4ad046b.zip
SONAR-11465 Deprecate InputModule and introduce InputProject
Diffstat (limited to 'sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/InputProjectProvider.java')
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/InputProjectProvider.java45
1 files changed, 45 insertions, 0 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/InputProjectProvider.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/InputProjectProvider.java
new file mode 100644
index 00000000000..4363fb6b19e
--- /dev/null
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/InputProjectProvider.java
@@ -0,0 +1,45 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2018 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 org.picocontainer.injectors.ProviderAdapter;
+import org.sonar.api.batch.bootstrap.ProjectReactor;
+import org.sonar.api.batch.fs.internal.DefaultInputProject;
+import org.sonar.scanner.scan.filesystem.ScannerComponentIdGenerator;
+
+public class InputProjectProvider extends ProviderAdapter {
+
+ private DefaultInputProject project = null;
+
+ public DefaultInputProject provide(ProjectBuildersExecutor projectBuildersExecutor, ProjectReactorValidator validator,
+ ProjectReactor projectReactor, ScannerComponentIdGenerator scannerComponentIdGenerator) {
+ if (project == null) {
+ // 1 Apply project builders
+ projectBuildersExecutor.execute(projectReactor);
+
+ // 2 Validate final reactor
+ validator.validate(projectReactor);
+
+ // 3 Create modules and the hierarchy
+ project = new DefaultInputProject(projectReactor.getRoot(), scannerComponentIdGenerator.getAsInt());
+ }
+ return project;
+ }
+}