aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2014-12-04 00:12:45 +0100
committerJulien HENRY <julien.henry@sonarsource.com>2014-12-04 00:12:45 +0100
commit8632a8cd838273b3946a7b4e79a86e2927b70d8d (patch)
tree3cb89070af8731c1efb90bc48f36b053cae2f06c
parent78020aefc3f16277a2ec1a19077384a8cbd9eb11 (diff)
downloadsonar-scanner-cli-8632a8cd838273b3946a7b4e79a86e2927b70d8d.tar.gz
sonar-scanner-cli-8632a8cd838273b3946a7b4e79a86e2927b70d8d.zip
SONARUNNER-125 Fix duplicate properties when parsing complexe sonar-project.properties
-rw-r--r--sonar-runner-dist/src/main/java/org/sonar/runner/Conf.java2
-rw-r--r--sonar-runner-dist/src/test/java/org/sonar/runner/ConfTest.java4
-rw-r--r--sonar-runner-dist/src/test/resources/org/sonar/runner/ConfTest/shouldSupportDeepModuleConfigurationInRoot/project/module1/module11/module111/placeholder.txt (renamed from sonar-runner-dist/src/test/resources/org/sonar/runner/ConfTest/shouldSupportDeepModuleConfigurationInRoot/project/module1/module11/placeholder.txt)0
-rw-r--r--sonar-runner-dist/src/test/resources/org/sonar/runner/ConfTest/shouldSupportDeepModuleConfigurationInRoot/project/module1/module11/module112/placeholder.txt0
-rw-r--r--sonar-runner-dist/src/test/resources/org/sonar/runner/ConfTest/shouldSupportDeepModuleConfigurationInRoot/project/sonar-project.properties6
5 files changed, 11 insertions, 1 deletions
diff --git a/sonar-runner-dist/src/main/java/org/sonar/runner/Conf.java b/sonar-runner-dist/src/main/java/org/sonar/runner/Conf.java
index 6ba9d72..4066f83 100644
--- a/sonar-runner-dist/src/main/java/org/sonar/runner/Conf.java
+++ b/sonar-runner-dist/src/main/java/org/sonar/runner/Conf.java
@@ -101,7 +101,7 @@ class Conf {
moduleProps = loadChildConfigFile(parentBaseDir, moduleProps, module);
// the child project may have children as well
- loadModulesProperties(moduleProps, projectProps, module + ".");
+ loadModulesProperties(moduleProps, projectProps, prefix + module + ".");
// and finally add this child properties to global props
merge(projectProps, prefix, module, moduleProps);
}
diff --git a/sonar-runner-dist/src/test/java/org/sonar/runner/ConfTest.java b/sonar-runner-dist/src/test/java/org/sonar/runner/ConfTest.java
index 35bbfbf..04292e2 100644
--- a/sonar-runner-dist/src/test/java/org/sonar/runner/ConfTest.java
+++ b/sonar-runner-dist/src/test/java/org/sonar/runner/ConfTest.java
@@ -100,8 +100,12 @@ public class ConfTest {
assertThat(properties.getProperty("1.sonar.projectName")).isEqualTo("Module 1");
assertThat(properties.getProperty("1.11.sonar.projectName")).isEqualTo("Module 11");
+ assertThat(properties.getProperty("1.11.111.sonar.projectName")).isEqualTo("Module 111");
assertThat(properties.getProperty("1.12.sonar.projectName")).isEqualTo("Module 12");
assertThat(properties.getProperty("2.sonar.projectName")).isEqualTo("Module 2");
+
+ // SONARUNNER-125
+ assertThat(properties.getProperty("11.111.sonar.projectName")).isNull();
}
@Test
diff --git a/sonar-runner-dist/src/test/resources/org/sonar/runner/ConfTest/shouldSupportDeepModuleConfigurationInRoot/project/module1/module11/placeholder.txt b/sonar-runner-dist/src/test/resources/org/sonar/runner/ConfTest/shouldSupportDeepModuleConfigurationInRoot/project/module1/module11/module111/placeholder.txt
index e69de29..e69de29 100644
--- a/sonar-runner-dist/src/test/resources/org/sonar/runner/ConfTest/shouldSupportDeepModuleConfigurationInRoot/project/module1/module11/placeholder.txt
+++ b/sonar-runner-dist/src/test/resources/org/sonar/runner/ConfTest/shouldSupportDeepModuleConfigurationInRoot/project/module1/module11/module111/placeholder.txt
diff --git a/sonar-runner-dist/src/test/resources/org/sonar/runner/ConfTest/shouldSupportDeepModuleConfigurationInRoot/project/module1/module11/module112/placeholder.txt b/sonar-runner-dist/src/test/resources/org/sonar/runner/ConfTest/shouldSupportDeepModuleConfigurationInRoot/project/module1/module11/module112/placeholder.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/sonar-runner-dist/src/test/resources/org/sonar/runner/ConfTest/shouldSupportDeepModuleConfigurationInRoot/project/module1/module11/module112/placeholder.txt
diff --git a/sonar-runner-dist/src/test/resources/org/sonar/runner/ConfTest/shouldSupportDeepModuleConfigurationInRoot/project/sonar-project.properties b/sonar-runner-dist/src/test/resources/org/sonar/runner/ConfTest/shouldSupportDeepModuleConfigurationInRoot/project/sonar-project.properties
index 5271377..56eb032 100644
--- a/sonar-runner-dist/src/test/resources/org/sonar/runner/ConfTest/shouldSupportDeepModuleConfigurationInRoot/project/sonar-project.properties
+++ b/sonar-runner-dist/src/test/resources/org/sonar/runner/ConfTest/shouldSupportDeepModuleConfigurationInRoot/project/sonar-project.properties
@@ -4,6 +4,12 @@ sonar.modules=1,2
1.sonar.modules=11,12
1.11.sonar.projectBaseDir=module11
1.11.sonar.projectName=Module 11
+1.11.sonar.modules=111,112
+1.11.111.sonar.projectBaseDir=module111
+1.11.111.sonar.projectName=Module 111
+1.11.112.sonar.projectBaseDir=module112
+1.11.112.sonar.projectName=Module 112
+
1.12.sonar.projectBaseDir=module12
1.12.sonar.projectName=Module 12