]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9799 deprecate legacy branch param (#2662)
authorJanos Gyerik <janos.gyerik@sonarsource.com>
Thu, 12 Oct 2017 12:41:19 +0000 (14:41 +0200)
committerGitHub <noreply@github.com>
Thu, 12 Oct 2017 12:41:19 +0000 (14:41 +0200)
sonar-plugin-api/src/main/java/org/sonar/api/CoreProperties.java
sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectScanContainer.java
sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumTest.java

index 9157f49b532f6d4968a64aa7d807d42825eecb3e..ba01afdc6d5e5c2bdc0231d97a7488677dbfe3ef 100644 (file)
@@ -128,6 +128,12 @@ public interface CoreProperties {
 
   /* Global settings */
   String SONAR_HOME = "SONAR_HOME";
+
+  /**
+   * @deprecated since 6.7. This feature is deprecated in favor of the new branch feature.
+   * @see <a href="https://redirect.sonarsource.com/doc/branches.html">https://redirect.sonarsource.com/doc/branches.html/a>
+   */
+  @Deprecated
   String PROJECT_BRANCH_PROPERTY = "sonar.branch";
   String PROJECT_VERSION_PROPERTY = "sonar.projectVersion";
 
index 053f750158d628c534287281e1d3537a98fc9841..720e39e992be3a59e809e981c3bf0e740446ce78 100644 (file)
@@ -247,6 +247,7 @@ public class ProjectScanContainer extends ComponentContainer {
     String branch = tree.root().definition().getBranch();
     if (branch != null) {
       LOG.info("Branch key: {}", branch);
+      LOG.warn("The use of \"sonar.branch\" is deprecated and replaced by \"sonar.branch.name\". See https://redirect.sonarsource.com/doc/branches.html.");
     }
 
     String branchName = props.property(ScannerProperties.BRANCH_NAME);
index 9a924c9d8ac44b2fd998b7502957a957bb588739..0de22581f630f99cdfe5eb2907008502b8a81131 100644 (file)
@@ -164,6 +164,7 @@ public class FileSystemMediumTest {
 
     assertThat(logs.getAllAsString()).contains("Project key: com.foo.project");
     assertThat(logs.getAllAsString()).contains("Branch key: my-branch");
+    assertThat(logs.getAllAsString()).contains("The use of \"sonar.branch\" is deprecated and replaced by \"sonar.branch.name\".");
   }
 
   @Test