aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api/src
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2011-01-21 14:35:01 +0100
committersimonbrandhof <simon.brandhof@gmail.com>2011-01-21 14:35:01 +0100
commitf7f98a13247734bd70b3f36f8bedc8762519f437 (patch)
tree3dbe16003ed404c65eaf49b3df95dd013af9f86c /sonar-plugin-api/src
parent8015cc71f97f5e049a8120ed54d1fb763f8343f2 (diff)
parent561c33f966fcc7290234077e3ecbde586e2885f0 (diff)
downloadsonarqube-f7f98a13247734bd70b3f36f8bedc8762519f437.tar.gz
sonarqube-f7f98a13247734bd70b3f36f8bedc8762519f437.zip
Merge branch 'master' of github.com:SonarSource/sonar
Diffstat (limited to 'sonar-plugin-api/src')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/project/ProjectDefinition.java76
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/DefaultFileSystemDirectory.java98
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/FileSystemDirectory.java (renamed from sonar-plugin-api/src/main/java/org/sonar/api/project/ProjectDirectory.java)21
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/Natures.java18
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java5
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/ProjectFileSystem.java1
6 files changed, 129 insertions, 90 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/project/ProjectDefinition.java b/sonar-plugin-api/src/main/java/org/sonar/api/project/ProjectDefinition.java
deleted file mode 100644
index db076fe803d..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/project/ProjectDefinition.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2009 SonarSource SA
- * 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.api.project;
-
-import org.apache.commons.configuration.Configuration;
-
-import java.io.File;
-import java.util.List;
-
-/**
- * Defines project in a form suitable for Sonar.
- * This is a part of bootstrap process, so we should take care about backward compatibility.
- * <p>
- * We assume that project is just a set of configuration properties and directories. And each project has unique key in format
- * "groupId:artifactId" (for example "org.codehaus.sonar:sonar").
- * </p>
- *
- * @since 2.6
- */
-public interface ProjectDefinition {
-
- /**
- * @return project key.
- */
- String getKey();
-
- /**
- * @return project properties.
- */
- Configuration getConfiguration();
-
- /**
- * @return Sonar working directory.
- * It's "${project.build.directory}/sonar" ("${project.basedir}/target/sonar") for Maven projects.
- */
- File getSonarWorkingDirectory();
-
- /**
- * @return project root directory.
- * It's "${project.basedir}" for Maven projects.
- */
- File getBasedir();
-
- /**
- * @return project directories.
- */
- List<ProjectDirectory> getDirs();
-
- /**
- * @return parent project.
- */
- ProjectDefinition getParent();
-
- /**
- * @return list of sub-projects.
- */
- List<ProjectDefinition> getModules();
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/DefaultFileSystemDirectory.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/DefaultFileSystemDirectory.java
new file mode 100644
index 00000000000..44461fb4772
--- /dev/null
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/DefaultFileSystemDirectory.java
@@ -0,0 +1,98 @@
+/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2009 SonarSource SA
+ * 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.api.resources;
+
+import com.google.common.collect.Lists;
+
+import java.io.File;
+import java.util.Collections;
+import java.util.List;
+
+public class DefaultFileSystemDirectory implements FileSystemDirectory {
+
+ private String nature;
+ private File location;
+ private File outputLocation;
+ private List<String> inclusionPatterns;
+ private List<String> exclusionPatterns;
+
+ public String getNature() {
+ return nature;
+ }
+
+ public DefaultFileSystemDirectory setNature(String nature) {
+ this.nature = nature;
+ return this;
+ }
+
+ public File getLocation() {
+ return location;
+ }
+
+ public DefaultFileSystemDirectory setLocation(File location) {
+ this.location = location;
+ return this;
+ }
+
+ public File getOutputLocation() {
+ return outputLocation;
+ }
+
+ public DefaultFileSystemDirectory setOutputLocation(File outputLocation) {
+ this.outputLocation = outputLocation;
+ return this;
+ }
+
+ public List<String> getInclusionPatterns() {
+ if (inclusionPatterns == null) {
+ return Collections.emptyList();
+ }
+ return Collections.unmodifiableList(inclusionPatterns);
+ }
+
+ /**
+ * @param pattern Ant-like inclusion pattern
+ */
+ public DefaultFileSystemDirectory addInclusionPattern(String pattern) {
+ if (inclusionPatterns == null) {
+ inclusionPatterns = Lists.newArrayList();
+ }
+ inclusionPatterns.add(pattern);
+ return this;
+ }
+
+ public List<String> getExclusionPatterns() {
+ if (exclusionPatterns == null) {
+ return Collections.emptyList();
+ }
+ return Collections.unmodifiableList(exclusionPatterns);
+ }
+
+ /**
+ * @param pattern Ant-like exclusion pattern
+ */
+ public DefaultFileSystemDirectory addExclusionPattern(String pattern) {
+ if (exclusionPatterns == null) {
+ exclusionPatterns = Lists.newArrayList();
+ }
+ exclusionPatterns.add(pattern);
+ return this;
+ }
+}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/project/ProjectDirectory.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/FileSystemDirectory.java
index d516a46b959..17c8298836c 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/project/ProjectDirectory.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/FileSystemDirectory.java
@@ -17,7 +17,8 @@
* License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/
-package org.sonar.api.project;
+package org.sonar.api.resources;
+
import java.io.File;
import java.util.List;
@@ -47,25 +48,17 @@ import java.util.List;
*
* @since 2.6
*/
-public interface ProjectDirectory {
-
- /**
- * TODO We should find a more flexible way to specify kind.
- * Because actually this is just a logical division to be able to associate different quality profiles for different kinds of directories.
- * Imagine that we can have different rules for unit tests, integration tests, performance tests, UI tests and so on.
- * But seems that for now this enumeration would cover our needs.
- */
- public static enum Kind {
- SOURCES, RESOURCES, TESTS, TEST_RESOURCES
- }
+public interface FileSystemDirectory {
/**
- * @return kind of underlying files.
+ * @return nature of underlying files.
+ * @see Natures
*/
- Kind getKind();
+ String getNature();
/**
* @return location of files for compilation.
+ * In case of Java this would be directory with Java source files.
*/
File getLocation();
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Natures.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Natures.java
new file mode 100644
index 00000000000..5b8f102fef6
--- /dev/null
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Natures.java
@@ -0,0 +1,18 @@
+package org.sonar.api.resources;
+
+/**
+ * @since 2.6
+ */
+public interface Natures {
+
+ /**
+ * Everything which relate to source code (for example "src/main/java" and "src/main/resources").
+ */
+ String MAIN = "MAIN";
+
+ /**
+ * Everything which relate to unit tests (for example "src/test/java" and "src/test/resources").
+ */
+ String TEST = "TEST";
+
+}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java
index 9890eeb830d..c891e90395c 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java
@@ -365,12 +365,17 @@ public class Project extends Resource {
return this;
}
+ /**
+ * @deprecated since 2.6. See http://jira.codehaus.org/browse/SONAR-2126
+ */
public ProjectFileSystem getFileSystem() {
return fileSystem;
}
/**
* For internal use only.
+ *
+ * @deprecated since 2.6. See http://jira.codehaus.org/browse/SONAR-2126
*/
public Project setFileSystem(ProjectFileSystem fs) {
this.fileSystem = fs;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ProjectFileSystem.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ProjectFileSystem.java
index d6ef7c3a0e6..9440b37daf7 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ProjectFileSystem.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ProjectFileSystem.java
@@ -26,6 +26,7 @@ import java.util.List;
/**
* @since 1.10
+ * @deprecated since 2.6
*/
public interface ProjectFileSystem {
/**