Skip to content

Commit 40d70b4

Browse files
committed
cleanup
1 parent fac4e45 commit 40d70b4

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

buildSrc/src/main/groovy/org/elasticsearch/gradle/VersionCollection.groovy

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class VersionCollection {
118118
} else {
119119
// caveat 3 - if our currentVersion is a X.0.0, we need to check X-1 minors to see if they are released
120120
if (currentVersion.minor == 0) {
121-
for (Version version : getMinorTips(currentVersion.major - 1)) {
121+
for (Version version: getMinorTips(currentVersion.major - 1)) {
122122
if (isReleased(version) == false) {
123123
// caveat 1 - This should only ever contain 2 non released branches in flight. An example is 6.x is frozen,
124124
// and 6.2 is cut but not yet released there is some simple logic to make sure that in the case of more than 2,
@@ -138,13 +138,8 @@ class VersionCollection {
138138
break
139139
}
140140
}
141-
// caveat 0 - now dip back 2 versions to get the last supported snapshot version of the line
142-
Version highestMinor = getHighestPreviousMinor(currentVersion.major - 1)
143-
if (highestMinor == null) {
144-
maintenanceBugfixSnapshot = null
145-
} else {
146-
maintenanceBugfixSnapshot = replaceAsSnapshot(highestMinor)
147-
}
141+
// caveat 0 - the last supported snapshot of the line is on a version that we don't support (N-2)
142+
maintenanceBugfixSnapshot = null
148143
} else {
149144
// caveat 3 did not apply. version is not a X.0.0, so we are somewhere on a X.Y line
150145
// only check till minor == 0 of the major
@@ -298,10 +293,7 @@ class VersionCollection {
298293
*/
299294
private Version getHighestPreviousMinor(Integer nextMajorVersion) {
300295
SortedSet<Version> result = versionSet.headSet(Version.fromString("${nextMajorVersion}.0.0"))
301-
if (result.isEmpty()) {
302-
return null
303-
}
304-
return result.last()
296+
return result.isEmpty() ? null : result.last()
305297
}
306298

307299
/**

buildSrc/src/test/groovy/org/elasticsearch/gradle/VersionCollectionTests.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class VersionCollectionTests extends GradleUnitTestCase {
2626
assertEquals(vc.nextMinorSnapshot, Version.fromString("6.3.0-SNAPSHOT"))
2727
assertEquals(vc.stagedMinorSnapshot, Version.fromString("6.2.0-SNAPSHOT"))
2828
assertEquals(vc.nextBugfixSnapshot, Version.fromString("6.1.1-SNAPSHOT"))
29-
assertEquals(vc.maintenanceBugfixSnapshot, Version.fromString("5.2.1-SNAPSHOT"))
29+
assertNull(vc.maintenanceBugfixSnapshot)
3030

3131
vc.indexCompatible.containsAll(vc.versions)
3232

@@ -65,7 +65,7 @@ class VersionCollectionTests extends GradleUnitTestCase {
6565
assertEquals(vc.nextMinorSnapshot, Version.fromString("6.3.0-SNAPSHOT"))
6666
assertEquals(vc.stagedMinorSnapshot, null)
6767
assertEquals(vc.nextBugfixSnapshot, Version.fromString("6.2.1-SNAPSHOT"))
68-
assertEquals(vc.maintenanceBugfixSnapshot, Version.fromString("5.2.1-SNAPSHOT"))
68+
assertNull(vc.maintenanceBugfixSnapshot)
6969

7070
vc.indexCompatible.containsAll(vc.versions)
7171

0 commit comments

Comments
 (0)