aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorEvgeny Mandrikov <mandrikov@gmail.com>2011-10-24 19:44:42 +0400
committerEvgeny Mandrikov <mandrikov@gmail.com>2011-10-24 22:45:07 +0400
commitee793fab90acd22fec498199ac3132afe4ef4313 (patch)
tree0302ffc6a722aff4d40042f2bf31acd80b5d9832 /plugins
parentf40963af9acbad8d329efac215e516ed5fd79902 (diff)
downloadsonarqube-ee793fab90acd22fec498199ac3132afe4ef4313.tar.gz
sonarqube-ee793fab90acd22fec498199ac3132afe4ef4313.zip
SONAR-2796 Display which directories Sonar will use during analysis
* Dedicated Initializer was created in order to do this. * Exclusions also displayed by this component.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java3
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/batch/ProjectFileSystemLogger.java55
2 files changed, 58 insertions, 0 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
index b0783c10c3c..6d71e3a7971 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
@@ -28,6 +28,7 @@ import org.sonar.api.checks.NoSonarFilter;
import org.sonar.api.resources.Java;
import org.sonar.plugins.core.batch.ExcludedResourceFilter;
import org.sonar.plugins.core.batch.MavenInitializer;
+import org.sonar.plugins.core.batch.ProjectFileSystemLogger;
import org.sonar.plugins.core.charts.DistributionAreaChart;
import org.sonar.plugins.core.charts.DistributionBarChart;
import org.sonar.plugins.core.charts.XradarChart;
@@ -215,6 +216,8 @@ public class CorePlugin extends SonarPlugin {
public List getExtensions() {
List extensions = Lists.newLinkedList();
+ extensions.add(ProjectFileSystemLogger.class);
+
// maven
extensions.add(MavenInitializer.class);
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/batch/ProjectFileSystemLogger.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/batch/ProjectFileSystemLogger.java
new file mode 100644
index 00000000000..d1bb942f6cb
--- /dev/null
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/batch/ProjectFileSystemLogger.java
@@ -0,0 +1,55 @@
+/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2008-2011 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * Sonar 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.
+ *
+ * Sonar 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 Sonar; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+ */
+package org.sonar.plugins.core.batch;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.sonar.api.batch.Initializer;
+import org.sonar.api.resources.Project;
+import org.sonar.api.resources.ProjectFileSystem;
+
+public class ProjectFileSystemLogger extends Initializer {
+
+ private static final Logger LOG = LoggerFactory.getLogger(ProjectFileSystemLogger.class);
+
+ @Override
+ public void execute(Project project) {
+ String[] exclusionPatterns = project.getExclusionPatterns();
+ if (exclusionPatterns != null && exclusionPatterns.length > 0) {
+ LOG.info("Excluded sources: {}", Arrays.toString(exclusionPatterns));
+ }
+ ProjectFileSystem projectFileSystem = project.getFileSystem();
+ logDirectories("Source directories:", projectFileSystem.getSourceDirs());
+ logDirectories("Test directories:", projectFileSystem.getTestDirs());
+ }
+
+ private void logDirectories(String name, List<java.io.File> dirs) {
+ if (!dirs.isEmpty()) {
+ LOG.info(name);
+ for (java.io.File dir : dirs) {
+ LOG.info(" {}", dir);
+ }
+ }
+ }
+
+}