]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-13155 do not suggest major upgrades of dependencies
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Tue, 17 Mar 2020 20:25:50 +0000 (21:25 +0100)
committersonartech <sonartech@sonarsource.com>
Sat, 21 Mar 2020 20:04:02 +0000 (20:04 +0000)
build.gradle

index 18fded9f6f7d4ac393627b419b8dd67c2875e5f6..51f1961ceeb834517e012b23969073de668c6dca 100644 (file)
@@ -531,20 +531,21 @@ artifactory {
 
 // https://github.com/ben-manes/gradle-versions-plugin
 apply plugin: 'com.github.ben-manes.versions'
-// Exclude dev versions from the list of dependency upgrades, for
-// example to replace:
-//   org.slf4j:log4j-over-slf4j [1.7.25 -> 1.8.0-beta4]
-// by
-//   org.slf4j:log4j-over-slf4j [1.7.25 -> 1.7.26]
-dependencyUpdates.resolutionStrategy {
-  componentSelection { rules ->
-    rules.all { ComponentSelection selection ->
-      boolean rejected = ['alpha', 'beta', 'rc', 'cr', 'm', 'preview'].any { qualifier ->
-        selection.candidate.version ==~ /(?i).*[.-]${qualifier}[.\d-]*/
-      }
-      if (rejected) {
-        selection.reject('Development version')
-      }
+dependencyUpdates {
+  rejectVersionIf {
+    // Exclude dev versions from the list of dependency upgrades, for
+    // example to replace:
+    //   org.slf4j:log4j-over-slf4j [1.7.25 -> 1.8.0-beta4]
+    // by
+    //   org.slf4j:log4j-over-slf4j [1.7.25 -> 1.7.26]
+    boolean rejected = ['alpha', 'beta', 'rc', 'cr', 'm', 'preview'].any { qualifier ->
+      it.candidate.version ==~ /(?i).*[.-]${qualifier}[.\d-]*/
     }
+    // Exclude upgrades on new major versions :
+    //   com.hazelcast:hazelcast [3.12.3 -> 4.0.0]
+    rejected |= !it.candidate.version.substring(0, 2).equals(it.currentVersion.substring(0, 2))
+
+    rejected
   }
 }