]> source.dussan.org Git - sonar-scanner-cli.git/commitdiff
SONARUNNER-125 Fix duplicate properties when parsing complexe sonar-project.properties
authorJulien HENRY <julien.henry@sonarsource.com>
Wed, 3 Dec 2014 23:12:45 +0000 (00:12 +0100)
committerJulien HENRY <julien.henry@sonarsource.com>
Wed, 3 Dec 2014 23:12:45 +0000 (00:12 +0100)
sonar-runner-dist/src/main/java/org/sonar/runner/Conf.java
sonar-runner-dist/src/test/java/org/sonar/runner/ConfTest.java
sonar-runner-dist/src/test/resources/org/sonar/runner/ConfTest/shouldSupportDeepModuleConfigurationInRoot/project/module1/module11/module111/placeholder.txt [new file with mode: 0644]
sonar-runner-dist/src/test/resources/org/sonar/runner/ConfTest/shouldSupportDeepModuleConfigurationInRoot/project/module1/module11/module112/placeholder.txt [new file with mode: 0644]
sonar-runner-dist/src/test/resources/org/sonar/runner/ConfTest/shouldSupportDeepModuleConfigurationInRoot/project/module1/module11/placeholder.txt [deleted file]
sonar-runner-dist/src/test/resources/org/sonar/runner/ConfTest/shouldSupportDeepModuleConfigurationInRoot/project/sonar-project.properties

index 6ba9d723b445209fd1177a79eb560ebc6b3ae4a6..4066f83adf814265e7c0dd8d24b150c57a3b9252 100644 (file)
@@ -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);
       }
index 35bbfbf30703b261a8057ce0c95e7bb3f41fe3eb..04292e256e14cae7bf8d5fd7036303470263b6ca 100644 (file)
@@ -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/module111/placeholder.txt b/sonar-runner-dist/src/test/resources/org/sonar/runner/ConfTest/shouldSupportDeepModuleConfigurationInRoot/project/module1/module11/module111/placeholder.txt
new file mode 100644 (file)
index 0000000..e69de29
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 (file)
index 0000000..e69de29
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/placeholder.txt
deleted file mode 100644 (file)
index e69de29..0000000
index 527137700f3e2e58e656b4b29ec2f30799b6f070..56eb032aa9b6191e663e16b2e61dd9ce7c3324a0 100644 (file)
@@ -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