diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2016-01-19 16:07:28 +0100 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2016-01-20 20:12:44 +0100 |
commit | a7a4837bcb2487b0b83bf3489099e3efe0f64e49 (patch) | |
tree | 0ee6b9866ff1858b946004fd088304dc291a1ea9 /sonar-batch/src/main/java/org/sonar/batch/bootstrap | |
parent | acdb68379316021febe9c6c435bbe4450d137ed0 (diff) | |
download | sonarqube-a7a4837bcb2487b0b83bf3489099e3efe0f64e49.tar.gz sonarqube-a7a4837bcb2487b0b83bf3489099e3efe0f64e49.zip |
SONAR-7234 Remove @SupportedEnvironment
Diffstat (limited to 'sonar-batch/src/main/java/org/sonar/batch/bootstrap')
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/bootstrap/ExtensionInstaller.java | 10 | ||||
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/bootstrap/ExtensionUtils.java | 21 |
2 files changed, 3 insertions, 28 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ExtensionInstaller.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ExtensionInstaller.java index 80c73e48dae..02517f6d696 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ExtensionInstaller.java +++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ExtensionInstaller.java @@ -23,7 +23,6 @@ import java.util.List; import javax.annotation.Nullable; import org.sonar.api.ExtensionProvider; import org.sonar.api.SonarPlugin; -import org.sonar.batch.bootstrapper.EnvironmentInformation; import org.sonar.core.platform.ComponentContainer; import org.sonar.core.platform.PluginInfo; import org.sonar.core.platform.PluginRepository; @@ -31,11 +30,9 @@ import org.sonar.core.platform.PluginRepository; public class ExtensionInstaller { private final PluginRepository pluginRepository; - private final EnvironmentInformation env; - public ExtensionInstaller(PluginRepository pluginRepository, EnvironmentInformation env) { + public ExtensionInstaller(PluginRepository pluginRepository) { this.pluginRepository = pluginRepository; - this.env = env; } public ExtensionInstaller install(ComponentContainer container, ExtensionMatcher matcher) { @@ -66,9 +63,8 @@ public class ExtensionInstaller { return this; } - private void doInstall(ComponentContainer container, ExtensionMatcher matcher, @Nullable PluginInfo pluginInfo, Object extension) { - if (ExtensionUtils.supportsEnvironment(extension, env) - && matcher.accept(extension)) { + private static void doInstall(ComponentContainer container, ExtensionMatcher matcher, @Nullable PluginInfo pluginInfo, Object extension) { + if (matcher.accept(extension)) { container.addExtension(pluginInfo, extension); } else { container.declareExtension(pluginInfo, extension); diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ExtensionUtils.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ExtensionUtils.java index 74735c7cd34..adf16a40315 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ExtensionUtils.java +++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ExtensionUtils.java @@ -19,12 +19,9 @@ */ package org.sonar.batch.bootstrap; -import org.apache.commons.lang.StringUtils; import org.sonar.api.batch.BatchSide; import org.sonar.api.batch.InstantiationStrategy; -import org.sonar.api.batch.SupportedEnvironment; import org.sonar.api.utils.AnnotationUtils; -import org.sonar.batch.bootstrapper.EnvironmentInformation; public class ExtensionUtils { @@ -44,24 +41,6 @@ public class ExtensionUtils { return AnnotationUtils.getAnnotation(extension, BatchSide.class) != null; } - public static boolean supportsEnvironment(Object extension, EnvironmentInformation environment) { - SupportedEnvironment env = AnnotationUtils.getAnnotation(extension, SupportedEnvironment.class); - if (env == null) { - return true; - } - for (String supported : env.value()) { - if (StringUtils.equalsIgnoreCase(environment.getKey(), supported)) { - return true; - } - } - return false; - } - - public static boolean isMavenExtensionOnly(Object extension) { - SupportedEnvironment env = AnnotationUtils.getAnnotation(extension, SupportedEnvironment.class); - return env != null && env.value().length == 1 && StringUtils.equalsIgnoreCase("maven", env.value()[0]); - } - public static boolean isType(Object extension, Class<?> extensionClass) { Class clazz = extension instanceof Class ? (Class) extension : extension.getClass(); return extensionClass.isAssignableFrom(clazz); |