From 92f01954fc68bcbe8004b1e8433a469ca67118e7 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Wed, 27 May 2015 13:37:37 +0200 Subject: [PATCH] SONAR-6370 move properties out of core plugin --- plugins/sonar-core-plugin/pom.xml | 67 +------- .../org/sonar/plugins/core/CorePlugin.java | 162 ------------------ .../core/config/CorePropertyDefinitions.java | 124 +++++++++++++- 3 files changed, 124 insertions(+), 229 deletions(-) diff --git a/plugins/sonar-core-plugin/pom.xml b/plugins/sonar-core-plugin/pom.xml index 58ead2cf637..770bdb4ed90 100644 --- a/plugins/sonar-core-plugin/pom.xml +++ b/plugins/sonar-core-plugin/pom.xml @@ -13,79 +13,16 @@ SonarQube :: Plugins :: Core - - com.google.code.findbugs - jsr305 - provided - org.codehaus.sonar sonar-plugin-api provided - org.codehaus.sonar - sonar-core - provided - - - jfree - jfreechart - provided - - - org.apache.maven - maven-plugin-api - provided - - - org.apache.maven - maven-core - provided - - - commons-collections - commons-collections + com.google.code.findbugs + jsr305 provided - - - - org.codehaus.sonar - sonar-core - ${project.version} - test-jar - test - - - org.mockito - mockito-core - test - - - org.dbunit - dbunit - test - - - - com.h2database - h2 - test - - - - org.codehaus.sonar - sonar-testing-harness - test - - - org.codehaus.sonar - sonar-plugin-api - test-jar - test - ${project.version} - 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 289cb0a9ccd..ceb5531722f 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 @@ -21,172 +21,10 @@ package org.sonar.plugins.core; import java.util.Collections; import java.util.List; -import org.sonar.api.CoreProperties; -import org.sonar.api.Properties; -import org.sonar.api.Property; -import org.sonar.api.PropertyType; import org.sonar.api.SonarPlugin; -@Properties({ - @Property( - key = CoreProperties.SERVER_BASE_URL, - defaultValue = CoreProperties.SERVER_BASE_URL_DEFAULT_VALUE, - name = "Server base URL", - description = "HTTP URL of this SonarQube server, such as http://yourhost.yourdomain/sonar. This value is used i.e. to create links in emails.", - project = false, - global = true, - category = CoreProperties.CATEGORY_GENERAL), - @Property( - key = CoreProperties.LINKS_HOME_PAGE, - defaultValue = "", - name = "Project Home Page", - description = "HTTP URL of the home page of the project.", - project = false, - global = false, - category = CoreProperties.CATEGORY_GENERAL), - @Property( - key = CoreProperties.LINKS_CI, - defaultValue = "", - name = "CI server", - description = "HTTP URL of the continuous integration server.", - project = false, - global = false, - category = CoreProperties.CATEGORY_GENERAL), - @Property( - key = CoreProperties.LINKS_ISSUE_TRACKER, - defaultValue = "", - name = "Issue Tracker", - description = "HTTP URL of the issue tracker.", - project = false, - global = false, - category = CoreProperties.CATEGORY_GENERAL), - @Property( - key = CoreProperties.LINKS_SOURCES, - defaultValue = "", - name = "SCM server", - description = "HTTP URL of the server which hosts the sources of the project.", - project = false, - global = false, - category = CoreProperties.CATEGORY_GENERAL), - @Property( - key = CoreProperties.LINKS_SOURCES_DEV, - defaultValue = "", - name = "SCM connection for developers", - description = "HTTP URL used by developers to connect to the SCM server for the project.", - project = false, - global = false, - category = CoreProperties.CATEGORY_GENERAL), - @Property( - key = CoreProperties.ANALYSIS_MODE, - defaultValue = CoreProperties.ANALYSIS_MODE_ANALYSIS, - name = "Analysis mode", - type = PropertyType.SINGLE_SELECT_LIST, - options = {CoreProperties.ANALYSIS_MODE_ANALYSIS, CoreProperties.ANALYSIS_MODE_PREVIEW, CoreProperties.ANALYSIS_MODE_INCREMENTAL}, - global = false, project = false, - category = CoreProperties.CATEGORY_GENERAL), - @Property( - key = CoreProperties.PREVIEW_INCLUDE_PLUGINS, - deprecatedKey = CoreProperties.DRY_RUN_INCLUDE_PLUGINS, - name = "Plugins accepted for Preview and Incremental modes", - description = "Comma-separated list of plugin keys. Those plugins will be used during preview or incremental analyses.", - defaultValue = CoreProperties.PREVIEW_INCLUDE_PLUGINS_DEFAULT_VALUE, - global = true, project = false, - category = CoreProperties.CATEGORY_GENERAL), - @Property( - key = CoreProperties.PREVIEW_EXCLUDE_PLUGINS, - deprecatedKey = CoreProperties.DRY_RUN_EXCLUDE_PLUGINS, - name = "Plugins excluded for Preview and Incremental modes", - description = "Comma-separated list of plugin keys. Those plugins will not be used during preview or incremental analyses.", - global = true, project = false, - defaultValue = CoreProperties.PREVIEW_EXCLUDE_PLUGINS_DEFAULT_VALUE, - category = CoreProperties.CATEGORY_GENERAL), - - // SERVER-SIDE TECHNICAL PROPERTIES - - @Property( - key = CoreProperties.CORE_AUTHENTICATOR_REALM, - name = "Security Realm", - project = false, - global = false - ), - @Property( - key = "sonar.security.savePassword", - name = "Save external password", - project = false, - global = false - ), - @Property( - key = "sonar.authenticator.downcase", - name = "Downcase login", - description = "Downcase login during user authentication, typically for Active Directory", - project = false, - global = false, - defaultValue = "false", - type = PropertyType.BOOLEAN), - @Property( - key = CoreProperties.CORE_AUTHENTICATOR_CREATE_USERS, - name = "Create user accounts", - description = "Create accounts when authenticating users via an external system", - project = false, - global = false, - defaultValue = "true", - type = PropertyType.BOOLEAN), - @Property( - key = CoreProperties.CORE_AUTHENTICATOR_UPDATE_USER_ATTRIBUTES, - name = "Update user attributes", - description = "When using the LDAP or OpenID plugin, at each login, the user attributes (name, email, ...) are re-synchronized", - project = false, - global = false, - defaultValue = "true", - type = PropertyType.BOOLEAN), - @Property( - key = CoreProperties.CORE_AUTHENTICATOR_IGNORE_STARTUP_FAILURE, - name = "Ignore failures during authenticator startup", - defaultValue = "false", - project = false, - global = false, - type = PropertyType.BOOLEAN), - @Property( - key = "sonar.enableFileVariation", - name = "Enable file variation", - global = false, - defaultValue = "false", - category = CoreProperties.CATEGORY_GENERAL), - @Property( - key = CoreProperties.CORE_AUTHENTICATOR_LOCAL_USERS, - name = "Local/technical users", - description = "Comma separated list of user logins that will always be authenticated using SonarQube database. " - + "When using the LDAP plugin, for these accounts, the user attributes (name, email, ...) are not re-synchronized", - project = false, - global = false, - defaultValue = "admin", - type = PropertyType.STRING, - multiValues = true), - @Property( - key = CoreProperties.SCM_DISABLED_KEY, - defaultValue = "false", - name = "Disable the SCM Sensor", - description = "Disable the retrieval of blame information from Source Control Manager", - module = false, - project = true, - global = true, - category = CoreProperties.CATEGORY_SCM, - type = PropertyType.BOOLEAN - ), - @Property( - key = CoreProperties.SCM_PROVIDER_KEY, - defaultValue = "", - name = "Key of the SCM provider for this project", - description = "Force the provider to be used to get SCM information for this project. By default auto-detection is done. Example: svn, git.", - module = false, - project = true, - global = false, - category = CoreProperties.CATEGORY_SCM - ) -}) public final class CorePlugin extends SonarPlugin { - @SuppressWarnings("rawtypes") @Override public List getExtensions() { return Collections.emptyList(); diff --git a/sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java b/sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java index 8a19cd775c7..c392960f020 100644 --- a/sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java +++ b/sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java @@ -21,14 +21,14 @@ package org.sonar.core.config; import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; +import java.util.Arrays; +import java.util.List; import org.sonar.api.CoreProperties; import org.sonar.api.PropertyType; import org.sonar.api.config.PropertyDefinition; import org.sonar.api.resources.Qualifiers; import org.sonar.core.computation.dbcleaner.DataCleanerProperties; -import java.util.List; - public class CorePropertyDefinitions { private CorePropertyDefinitions() { @@ -44,6 +44,126 @@ public class CorePropertyDefinitions { defs.addAll(DataCleanerProperties.all()); defs.addAll(ImmutableList.of( + PropertyDefinition.builder(CoreProperties.SERVER_BASE_URL) + .name("Server base URL") + .description("HTTP URL of this SonarQube server, such as http://yourhost.yourdomain/sonar. This value is used i.e. to create links in emails.") + .category(CoreProperties.CATEGORY_GENERAL) + .defaultValue(CoreProperties.SERVER_BASE_URL_DEFAULT_VALUE) + .build(), + + PropertyDefinition.builder(CoreProperties.LINKS_HOME_PAGE) + .name("Project Home Page") + .description("HTTP URL of the home page of the project.") + .hidden() + .build(), + PropertyDefinition.builder(CoreProperties.LINKS_CI) + .name("CI server") + .description("HTTP URL of the continuous integration server.") + .category(CoreProperties.CATEGORY_GENERAL) + .build(), + PropertyDefinition.builder(CoreProperties.LINKS_ISSUE_TRACKER) + .name("Issue Tracker") + .description("HTTP URL of the issue tracker.") + .category(CoreProperties.CATEGORY_GENERAL) + .hidden() + .build(), + PropertyDefinition.builder(CoreProperties.LINKS_SOURCES) + .name("SCM server") + .description("HTTP URL of the server which hosts the sources of the project.") + .category(CoreProperties.CATEGORY_GENERAL) + .build(), + PropertyDefinition.builder(CoreProperties.LINKS_SOURCES_DEV) + .name("SCM connection for developers") + .description("HTTP URL used by developers to connect to the SCM server for the project.") + .category(CoreProperties.CATEGORY_GENERAL) + .hidden() + .build(), + PropertyDefinition.builder(CoreProperties.ANALYSIS_MODE) + .name("Analysis mode") + .type(PropertyType.SINGLE_SELECT_LIST) + .options(Arrays.asList(CoreProperties.ANALYSIS_MODE_ANALYSIS, CoreProperties.ANALYSIS_MODE_PREVIEW, CoreProperties.ANALYSIS_MODE_INCREMENTAL)) + .category(CoreProperties.CATEGORY_GENERAL) + .defaultValue(CoreProperties.ANALYSIS_MODE_ANALYSIS) + .hidden() + .build(), + PropertyDefinition.builder(CoreProperties.PREVIEW_INCLUDE_PLUGINS) + .deprecatedKey(CoreProperties.DRY_RUN_INCLUDE_PLUGINS) + .name("Plugins accepted for Preview and Incremental modes") + .description("Comma-separated list of plugin keys. Those plugins will be used during preview or incremental analyses.") + .category(CoreProperties.CATEGORY_GENERAL) + .defaultValue(CoreProperties.PREVIEW_INCLUDE_PLUGINS_DEFAULT_VALUE) + .build(), + PropertyDefinition.builder(CoreProperties.PREVIEW_EXCLUDE_PLUGINS) + .deprecatedKey(CoreProperties.DRY_RUN_EXCLUDE_PLUGINS) + .name("Plugins excluded for Preview and Incremental modes") + .description("Comma-separated list of plugin keys. Those plugins will not be used during preview or incremental analyses.") + .category(CoreProperties.CATEGORY_GENERAL) + .defaultValue(CoreProperties.PREVIEW_EXCLUDE_PLUGINS_DEFAULT_VALUE) + .build(), + PropertyDefinition.builder(CoreProperties.CORE_AUTHENTICATOR_REALM) + .name("Security Realm") + .hidden() + .build(), + PropertyDefinition.builder("sonar.security.savePassword") + .name("Save external password") + .hidden() + .build(), + PropertyDefinition.builder("sonar.authenticator.downcase") + .name("Downcase login") + .description("Downcase login during user authentication, typically for Active Directory") + .type(PropertyType.BOOLEAN) + .defaultValue("false") + .hidden() + .build(), + PropertyDefinition.builder(CoreProperties.CORE_AUTHENTICATOR_CREATE_USERS) + .name("Create user accounts") + .description("Create accounts when authenticating users via an external system") + .type(PropertyType.BOOLEAN) + .defaultValue("true") + .hidden() + .build(), + PropertyDefinition.builder(CoreProperties.CORE_AUTHENTICATOR_UPDATE_USER_ATTRIBUTES) + .name("Update user attributes") + .description("When using the LDAP or OpenID plugin, at each login, the user attributes (name, email, ...) are re-synchronized") + .hidden() + .type(PropertyType.BOOLEAN) + .defaultValue("true") + .build(), + PropertyDefinition.builder(CoreProperties.CORE_AUTHENTICATOR_IGNORE_STARTUP_FAILURE) + .name("Ignore failures during authenticator startup") + .type(PropertyType.BOOLEAN) + .defaultValue("false") + .hidden() + .build(), + PropertyDefinition.builder("sonar.enableFileVariation") + .name("Enable file variation") + .hidden() + .type(PropertyType.BOOLEAN) + .defaultValue("false") + .build(), + PropertyDefinition.builder(CoreProperties.CORE_AUTHENTICATOR_LOCAL_USERS) + .name("Local/technical users") + .description("Comma separated list of user logins that will always be authenticated using SonarQube database. " + + "When using the LDAP plugin, for these accounts, the user attributes (name, email, ...) are not re-synchronized") + .type(PropertyType.STRING) + .multiValues(true) + .defaultValue("admin") + .build(), + PropertyDefinition.builder(CoreProperties.SCM_DISABLED_KEY) + .name("Disable the SCM Sensor") + .description("Disable the retrieval of blame information from Source Control Manager") + .category(CoreProperties.CATEGORY_SCM) + .type(PropertyType.BOOLEAN) + .onQualifiers(Qualifiers.PROJECT) + .defaultValue("false") + .build(), + PropertyDefinition.builder(CoreProperties.SCM_PROVIDER_KEY) + .name("Key of the SCM provider for this project") + .description("Force the provider to be used to get SCM information for this project. By default auto-detection is done. Example: svn, git.") + .category(CoreProperties.CATEGORY_SCM) + .onlyOnQualifiers(Qualifiers.PROJECT) + .build(), + // WEB LOOK&FEEL PropertyDefinition.builder("sonar.lf.logoUrl") .deprecatedKey("sonar.branding.image") -- 2.39.5