aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch
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-batch
parent8015cc71f97f5e049a8120ed54d1fb763f8343f2 (diff)
parent561c33f966fcc7290234077e3ecbde586e2885f0 (diff)
downloadsonarqube-f7f98a13247734bd70b3f36f8bedc8762519f437.tar.gz
sonarqube-f7f98a13247734bd70b3f36f8bedc8762519f437.zip
Merge branch 'master' of github.com:SonarSource/sonar
Diffstat (limited to 'sonar-batch')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/DefaultProjectDefinition.java95
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/DefaultProjectDirectory.java68
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/bootstrap/ProjectDefinition.java95
3 files changed, 95 insertions, 163 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/DefaultProjectDefinition.java b/sonar-batch/src/main/java/org/sonar/batch/DefaultProjectDefinition.java
deleted file mode 100644
index 82e81da59bd..00000000000
--- a/sonar-batch/src/main/java/org/sonar/batch/DefaultProjectDefinition.java
+++ /dev/null
@@ -1,95 +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.batch;
-
-import com.google.common.collect.Lists;
-import org.apache.commons.configuration.Configuration;
-import org.sonar.api.project.ProjectDefinition;
-import org.sonar.api.project.ProjectDirectory;
-
-import java.io.File;
-import java.util.List;
-
-public class DefaultProjectDefinition implements ProjectDefinition {
-
- private String key;
- private Configuration configuration;
- private File sonarWorkingDirectory;
- private File basedir;
- private List<ProjectDirectory> dirs = Lists.newArrayList();
- private DefaultProjectDefinition parent;
- private List<ProjectDefinition> modules;
-
- public String getKey() {
- return key;
- }
-
- public void setKey(String key) {
- this.key = key;
- }
-
- public Configuration getConfiguration() {
- return configuration;
- }
-
- public void setConfiguration(Configuration configuration) {
- this.configuration = configuration;
- }
-
- public File getSonarWorkingDirectory() {
- return sonarWorkingDirectory;
- }
-
- public void setSonarWorkingDirectory(File sonarWorkingDirectory) {
- this.sonarWorkingDirectory = sonarWorkingDirectory;
- }
-
- public File getBasedir() {
- return basedir;
- }
-
- public void setBasedir(File basedir) {
- this.basedir = basedir;
- }
-
- public List<ProjectDirectory> getDirs() {
- return dirs;
- }
-
- public void addDir(ProjectDirectory dir) {
- this.dirs.add(dir);
- }
-
- public ProjectDefinition getParent() {
- return parent;
- }
-
- public void setParent(DefaultProjectDefinition parent) {
- this.parent = parent;
- if (parent != null) {
- parent.modules.add(this);
- }
- }
-
- public List<ProjectDefinition> getModules() {
- return modules;
- }
-
-}
diff --git a/sonar-batch/src/main/java/org/sonar/batch/DefaultProjectDirectory.java b/sonar-batch/src/main/java/org/sonar/batch/DefaultProjectDirectory.java
deleted file mode 100644
index 7c080531435..00000000000
--- a/sonar-batch/src/main/java/org/sonar/batch/DefaultProjectDirectory.java
+++ /dev/null
@@ -1,68 +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.batch;
-
-import org.sonar.api.project.ProjectDirectory;
-
-import java.io.File;
-import java.util.Collections;
-import java.util.List;
-
-public class DefaultProjectDirectory implements ProjectDirectory {
-
- private Kind kind;
- private File location;
- private File outputLocation;
-
- public Kind getKind() {
- return kind;
- }
-
- public void setKind(Kind kind) {
- this.kind = kind;
- }
-
- public File getLocation() {
- return location;
- }
-
- public void setLocation(File location) {
- this.location = location;
- }
-
- public File getOutputLocation() {
- return outputLocation;
- }
-
- public void setOutputLocation(File outputLocation) {
- this.outputLocation = outputLocation;
- }
-
- public List<String> getInclusionPatterns() {
- // TODO see example in ProjectDirectory
- return Collections.emptyList();
- }
-
- public List<String> getExclusionPatterns() {
- // TODO see example in ProjectDirectory
- return Collections.emptyList();
- }
-
-}
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ProjectDefinition.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ProjectDefinition.java
new file mode 100644
index 00000000000..d12dc1a9af1
--- /dev/null
+++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ProjectDefinition.java
@@ -0,0 +1,95 @@
+package org.sonar.batch.bootstrap;
+
+import com.google.common.collect.Lists;
+import org.apache.commons.configuration.Configuration;
+import org.sonar.api.resources.FileSystemDirectory;
+
+import java.io.File;
+import java.util.List;
+
+/**
+ * Defines project in a form suitable to bootstrap Sonar batch.
+ * We assume that project is just a set of configuration properties and directories.
+ * This is a part of bootstrap process, so we should take care about backward compatibility.
+ *
+ * @since 2.6
+ */
+public class ProjectDefinition {
+
+ private Configuration configuration;
+
+ private File workDir;
+ private File basedir;
+ private List<FileSystemDirectory> dirs = Lists.newArrayList();
+
+ private ProjectDefinition parent;
+ private List<ProjectDefinition> modules;
+
+ /**
+ * @return project properties.
+ */
+ public Configuration getConfiguration() {
+ return configuration;
+ }
+
+ public void setConfiguration(Configuration configuration) {
+ this.configuration = configuration;
+ }
+
+ /**
+ * @return Sonar working directory for this project.
+ * It's "${project.build.directory}/sonar" ("${project.basedir}/target/sonar") for Maven projects.
+ */
+ public File getSonarWorkingDirectory() {
+ return workDir;
+ }
+
+ public void setSonarWorkingDirectory(File workDir) {
+ this.workDir = workDir;
+ }
+
+ /**
+ * @return project root directory.
+ * It's "${project.basedir}" for Maven projects.
+ */
+ public File getBasedir() {
+ return basedir;
+ }
+
+ public void setBasedir(File basedir) {
+ this.basedir = basedir;
+ }
+
+ /**
+ * @return project directories.
+ */
+ public List<FileSystemDirectory> getDirs() {
+ return dirs;
+ }
+
+ public void addDir(FileSystemDirectory dir) {
+ this.dirs.add(dir);
+ }
+
+ /**
+ * @return parent project.
+ */
+ public ProjectDefinition getParent() {
+ return parent;
+ }
+
+ public void setParent(ProjectDefinition parent) {
+ this.parent = parent;
+ if (parent != null) {
+ parent.modules.add(this);
+ }
+ }
+
+ /**
+ * @return list of sub-projects.
+ */
+ public List<ProjectDefinition> getModules() {
+ return modules;
+ }
+
+}