summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2013-11-27 17:27:47 +0100
committerJulien HENRY <julien.henry@sonarsource.com>2013-11-27 17:27:47 +0100
commit8c6f1e299e2424aa6e858f68d562c5511bf7f3ba (patch)
tree60764a6b304e0105a1ab3d23254cc144d9b1fa26
parente556b76dee419bb6b85e17116bcd05f504add65d (diff)
downloadsonarqube-8c6f1e299e2424aa6e858f68d562c5511bf7f3ba.tar.gz
sonarqube-8c6f1e299e2424aa6e858f68d562c5511bf7f3ba.zip
SONAR-4876 Don't expose new sonar.moduleKey property in CoreProperties
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/DefaultProjectBootstrapper.java17
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/CoreProperties.java5
2 files changed, 11 insertions, 11 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/DefaultProjectBootstrapper.java b/sonar-batch/src/main/java/org/sonar/batch/scan/DefaultProjectBootstrapper.java
index 4c00baf33ff..ca2c50e546a 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/DefaultProjectBootstrapper.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/DefaultProjectBootstrapper.java
@@ -53,6 +53,11 @@ class DefaultProjectBootstrapper implements ProjectBootstrapper {
private static final Logger LOG = LoggerFactory.getLogger(DefaultProjectBootstrapper.class);
+ /**
+ * @since 4.1 but not yet exposed in {@link CoreProperties}
+ */
+ private static final String MODULE_KEY_PROPERTY = "sonar.moduleKey";
+
private static final String PROPERTY_PROJECT_BASEDIR = "sonar.projectBaseDir";
private static final String PROPERTY_PROJECT_CONFIG_FILE = "sonar.projectConfigFile";
private static final String PROPERTY_MODULES = "sonar.modules";
@@ -97,7 +102,7 @@ class DefaultProjectBootstrapper implements ProjectBootstrapper {
/**
* Array of all mandatory properties required for a child project before its properties get merged with its parent ones.
*/
- private static final String[] MANDATORY_PROPERTIES_FOR_CHILD = {CoreProperties.MODULE_KEY_PROPERTY, CoreProperties.PROJECT_NAME_PROPERTY};
+ private static final String[] MANDATORY_PROPERTIES_FOR_CHILD = {MODULE_KEY_PROPERTY, CoreProperties.PROJECT_NAME_PROPERTY};
/**
* Properties that must not be passed from the parent project to its children.
@@ -265,19 +270,19 @@ class DefaultProjectBootstrapper implements ProjectBootstrapper {
@VisibleForTesting
protected static void setModuleKeyAndNameIfNotDefined(Properties childProps, String moduleId, String parentKey) {
- if (!childProps.containsKey(CoreProperties.MODULE_KEY_PROPERTY)) {
+ if (!childProps.containsKey(MODULE_KEY_PROPERTY)) {
if (!childProps.containsKey(CoreProperties.PROJECT_KEY_PROPERTY)) {
- childProps.put(CoreProperties.MODULE_KEY_PROPERTY, parentKey + ":" + moduleId);
+ childProps.put(MODULE_KEY_PROPERTY, parentKey + ":" + moduleId);
} else {
String childKey = childProps.getProperty(CoreProperties.PROJECT_KEY_PROPERTY);
- childProps.put(CoreProperties.MODULE_KEY_PROPERTY, parentKey + ":" + childKey);
+ childProps.put(MODULE_KEY_PROPERTY, parentKey + ":" + childKey);
}
}
if (!childProps.containsKey(CoreProperties.PROJECT_NAME_PROPERTY)) {
childProps.put(CoreProperties.PROJECT_NAME_PROPERTY, moduleId);
}
// For backward compatibility with ProjectDefinition
- childProps.put(CoreProperties.PROJECT_KEY_PROPERTY, childProps.getProperty(CoreProperties.MODULE_KEY_PROPERTY));
+ childProps.put(CoreProperties.PROJECT_KEY_PROPERTY, childProps.getProperty(MODULE_KEY_PROPERTY));
}
@VisibleForTesting
@@ -308,7 +313,7 @@ class DefaultProjectBootstrapper implements ProjectBootstrapper {
missing.append(mandatoryProperty);
}
}
- String moduleKey = StringUtils.defaultIfBlank(props.getProperty(CoreProperties.MODULE_KEY_PROPERTY), props.getProperty(CoreProperties.PROJECT_KEY_PROPERTY));
+ String moduleKey = StringUtils.defaultIfBlank(props.getProperty(MODULE_KEY_PROPERTY), props.getProperty(CoreProperties.PROJECT_KEY_PROPERTY));
if (missing.length() != 0) {
throw new IllegalStateException("You must define the following mandatory properties for '" + (moduleKey == null ? "Unknown" : moduleKey) + "': " + missing);
}
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 2ca4a37cc29..a9e07108eeb 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
@@ -137,11 +137,6 @@ public interface CoreProperties {
String PROJECT_KEY_PROPERTY = "sonar.projectKey";
/**
- * @since 4.1
- */
- String MODULE_KEY_PROPERTY = "sonar.moduleKey";
-
- /**
* @since 2.6
*/
String PROJECT_NAME_PROPERTY = "sonar.projectName";