aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorEvgeny Mandrikov <mandrikov@gmail.com>2011-01-11 19:59:09 +0300
committerEvgeny Mandrikov <mandrikov@gmail.com>2011-01-18 15:11:11 +0300
commit231a993de184196c75be888dab2da539a600fac0 (patch)
tree22b7054e9317b8bd8077500e8613554ee3a337b4 /sonar-plugin-api
parenta88512126dc63e77c19c62a495b984379a01f020 (diff)
downloadsonarqube-231a993de184196c75be888dab2da539a600fac0.tar.gz
sonarqube-231a993de184196c75be888dab2da539a600fac0.zip
SONAR-1514: Add support for a new Ant task to analyze projects
* Add new environment - Ant. * Introduce new component (Reactor) in order to break dependency on MavenSession. * Add annotation SupportedEnvironment and corresponding check to BatchPluginRepository. To allow specify in which environments BatchExtension should be active. * Use this new annotation to disable MavenDependenciesSensor in Ant environment.
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/SupportedEnvironment.java40
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/platform/Environment.java2
2 files changed, 41 insertions, 1 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/SupportedEnvironment.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/SupportedEnvironment.java
new file mode 100644
index 00000000000..4c62a97d5d2
--- /dev/null
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/SupportedEnvironment.java
@@ -0,0 +1,40 @@
+/*
+ * 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.batch;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation allows to specify in which environments {@link org.sonar.api.BatchExtension} would be active.
+ * Consult to {@link org.sonar.api.platform.Environment} to find possible values, for example - "maven2".
+ * We strictly recommend you to not overuse this annotation - most preferable is to design extensions to work in all environments.
+ *
+ * @since 2.6
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ ElementType.TYPE })
+public @interface SupportedEnvironment {
+
+ String[] value();
+
+}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/platform/Environment.java b/sonar-plugin-api/src/main/java/org/sonar/api/platform/Environment.java
index b9dd664f72c..6279c473ed3 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/platform/Environment.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/platform/Environment.java
@@ -30,7 +30,7 @@ public enum Environment implements BatchComponent, ServerComponent {
/*
* When will GRADLE, ANT, ECLIPSE, INTELLIJ_IDEA be added to this list ? :-)
*/
- SERVER, MAVEN3, MAVEN2;
+ SERVER, MAVEN3, MAVEN2, ANT;
public boolean isServer() {
return this==SERVER;