]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-6370 move properties out of core plugin
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Wed, 27 May 2015 11:37:37 +0000 (13:37 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Thu, 28 May 2015 07:29:04 +0000 (09:29 +0200)
plugins/sonar-core-plugin/pom.xml
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java

index 58ead2cf637827046635f53b8b8d4023bbc3739e..770bdb4ed90884b69f5440c7e2c1755260541655 100644 (file)
   <name>SonarQube :: Plugins :: Core</name>
 
   <dependencies>
-    <dependency>
-      <groupId>com.google.code.findbugs</groupId>
-      <artifactId>jsr305</artifactId>
-      <scope>provided</scope>
-    </dependency>
     <dependency>
       <groupId>org.codehaus.sonar</groupId>
       <artifactId>sonar-plugin-api</artifactId>
       <scope>provided</scope>
     </dependency>
     <dependency>
-      <groupId>org.codehaus.sonar</groupId>
-      <artifactId>sonar-core</artifactId>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>jfree</groupId>
-      <artifactId>jfreechart</artifactId>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-plugin-api</artifactId>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-core</artifactId>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>commons-collections</groupId>
-      <artifactId>commons-collections</artifactId>
+      <groupId>com.google.code.findbugs</groupId>
+      <artifactId>jsr305</artifactId>
       <scope>provided</scope>
     </dependency>
-
-    <!-- unit tests -->
-    <dependency>
-      <groupId>org.codehaus.sonar</groupId>
-      <artifactId>sonar-core</artifactId>
-      <version>${project.version}</version>
-      <type>test-jar</type>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.mockito</groupId>
-      <artifactId>mockito-core</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.dbunit</groupId>
-      <artifactId>dbunit</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <!-- local database -->
-      <groupId>com.h2database</groupId>
-      <artifactId>h2</artifactId>
-      <scope>test</scope>
-    </dependency>
-    
-    <dependency>
-      <groupId>org.codehaus.sonar</groupId>
-      <artifactId>sonar-testing-harness</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.codehaus.sonar</groupId>
-      <artifactId>sonar-plugin-api</artifactId>
-      <type>test-jar</type>
-      <scope>test</scope>
-      <version>${project.version}</version>
-    </dependency>
   </dependencies>
 
   <build>
index 289cb0a9ccd589f15a163206925888748fb24e2d..ceb5531722f75eda63cd53036ac5c2f4264ac5f9 100644 (file)
@@ -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 <i>http://yourhost.yourdomain/sonar</i>. 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();
index 8a19cd775c7ba6dbafbfb79def8bdd24e6911bdb..c392960f0200c3708adf05d8b23dfe9734a5d022 100644 (file)
@@ -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 <i>http://yourhost.yourdomain/sonar</i>. 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")