diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2012-11-27 00:38:18 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2012-11-27 00:38:18 +0100 |
commit | 4b0679d4670f131be4e6f5905a48b5bb5f2396e0 (patch) | |
tree | 6d091553ca4e549ab6a8d2a0daa4031233b54615 | |
parent | 13ef8a8d4ebb984df8cc1f3507cc7335109c6580 (diff) | |
download | sonarqube-4b0679d4670f131be4e6f5905a48b5bb5f2396e0.tar.gz sonarqube-4b0679d4670f131be4e6f5905a48b5bb5f2396e0.zip |
SONAR-3895 fix the default values of sonar.dryRun.excludePlugins/includePlugins
3 files changed, 16 insertions, 3 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 43176b47b83..0592005e12e 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 @@ -332,13 +332,14 @@ import java.util.List; @Property( key = CoreProperties.DRY_RUN_INCLUDE_PLUGINS, name = "Plugins accepted for dry run", + defaultValue = CoreProperties.DRY_RUN_INCLUDE_PLUGINS_DEFAULT_VALUE, global = true, project = false, category = CoreProperties.CATEGORY_GENERAL), @Property( key = CoreProperties.DRY_RUN_EXCLUDE_PLUGINS, name = "Plugins excluded for dry run", global = true, project = false, - defaultValue = "devcockpit,pdfreport,report,scmactivity,views", + defaultValue = CoreProperties.DRY_RUN_EXCLUDE_PLUGINS_DEFAULT_VALUE, category = CoreProperties.CATEGORY_GENERAL), @Property( key = "sonar.dryRun.export.path", diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchPluginRepository.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchPluginRepository.java index c0dddd09215..1ea9307364d 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchPluginRepository.java +++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchPluginRepository.java @@ -122,8 +122,12 @@ public class BatchPluginRepository implements PluginRepository { blacks.addAll(Arrays.asList(settings.getStringArray(CoreProperties.BATCH_EXCLUDE_PLUGINS))); } if (settings.getBoolean(CoreProperties.DRY_RUN)) { - whites.addAll(Arrays.asList(settings.getStringArray(CoreProperties.DRY_RUN_INCLUDE_PLUGINS))); - blacks.addAll(Arrays.asList(settings.getStringArray(CoreProperties.DRY_RUN_EXCLUDE_PLUGINS))); + // These default values are not supported by Settings because the class CorePlugin + // is not loaded yet. + whites.addAll(propertyValues(settings, + CoreProperties.DRY_RUN_INCLUDE_PLUGINS, CoreProperties.DRY_RUN_INCLUDE_PLUGINS_DEFAULT_VALUE)); + blacks.addAll(propertyValues(settings, + CoreProperties.DRY_RUN_EXCLUDE_PLUGINS, CoreProperties.DRY_RUN_EXCLUDE_PLUGINS_DEFAULT_VALUE)); } if (!whites.isEmpty()) { LOG.info("Include plugins: " + Joiner.on(", ").join(whites)); @@ -133,6 +137,11 @@ public class BatchPluginRepository implements PluginRepository { } } + static List<String> propertyValues(Settings settings, String key, String defaultValue) { + String s = StringUtils.defaultIfEmpty(settings.getString(key), defaultValue); + return Arrays.asList(StringUtils.split(s, ",")); + } + boolean accepts(String pluginKey) { if (CORE_PLUGIN.equals(pluginKey) || ENGLISH_PACK_PLUGIN.equals(pluginKey)) { return true; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/CoreProperties.java b/sonar-plugin-api/src/main/java/org/sonar/api/CoreProperties.java index f94c6d7bc8a..9ad4e496a47 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/CoreProperties.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/CoreProperties.java @@ -161,15 +161,18 @@ public interface CoreProperties { String BATCH_INCLUDE_PLUGINS = "sonar.includePlugins"; String BATCH_EXCLUDE_PLUGINS = "sonar.excludePlugins"; + /** * @since 3.4 */ String DRY_RUN_INCLUDE_PLUGINS = "sonar.dryRun.includePlugins"; + String DRY_RUN_INCLUDE_PLUGINS_DEFAULT_VALUE = ""; /** * @since 3.4 */ String DRY_RUN_EXCLUDE_PLUGINS = "sonar.dryRun.excludePlugins"; + String DRY_RUN_EXCLUDE_PLUGINS_DEFAULT_VALUE = "devcockpit,pdfreport,report,scmactivity,views"; /** * @since 2.10 |