Fix verifyVersions gradle task and cleanup bwcVersions (#1878)

Signed-off-by: Rabi Panda <adnapibar@gmail.com>
This commit is contained in:
Rabi Panda 2022-01-11 06:19:51 -08:00 committed by GitHub
parent 40442aae7f
commit 8fbd8cd998
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 58 deletions

View File

@ -1,50 +1,4 @@
BWC_VERSION: BWC_VERSION:
- "6.0.0"
- "6.0.1"
- "6.1.0"
- "6.1.1"
- "6.1.2"
- "6.1.3"
- "6.1.4"
- "6.2.0"
- "6.2.1"
- "6.2.2"
- "6.2.3"
- "6.2.4"
- "6.3.0"
- "6.3.1"
- "6.3.2"
- "6.4.0"
- "6.4.1"
- "6.4.2"
- "6.4.3"
- "6.5.0"
- "6.5.1"
- "6.5.2"
- "6.5.3"
- "6.5.4"
- "6.6.0"
- "6.6.1"
- "6.6.2"
- "6.7.0"
- "6.7.1"
- "6.7.2"
- "6.8.0"
- "6.8.1"
- "6.8.2"
- "6.8.3"
- "6.8.4"
- "6.8.5"
- "6.8.6"
- "6.8.7"
- "6.8.8"
- "6.8.9"
- "6.8.10"
- "6.8.11"
- "6.8.12"
- "6.8.13"
- "6.8.14"
- "6.8.15"
- "7.0.0" - "7.0.0"
- "7.0.1" - "7.0.1"
- "7.1.0" - "7.1.0"
@ -75,9 +29,7 @@ BWC_VERSION:
- "7.10.1" - "7.10.1"
- "7.10.2" - "7.10.2"
- "1.0.0" - "1.0.0"
- "1.0.1"
- "1.1.0" - "1.1.0"
- "1.1.1"
- "1.2.0" - "1.2.0"
- "1.2.1" - "1.2.1"
- "1.2.2" - "1.2.2"

View File

@ -168,8 +168,7 @@ tasks.register("verifyVersions") {
// Read the list from maven central. // Read the list from maven central.
// Fetch the metadata and parse the xml into Version instances because it's more straight forward here // Fetch the metadata and parse the xml into Version instances because it's more straight forward here
// rather than bwcVersion ( VersionCollection ). // rather than bwcVersion ( VersionCollection ).
//TODO OpenSearch - Update the maven repo URL for OpenSearch when available. new URL('https://repo1.maven.org/maven2/org/opensearch/opensearch/maven-metadata.xml').openStream().withStream { s ->
new URL('https://repo1.maven.org/maven2/org/elasticsearch/elasticsearch/maven-metadata.xml').openStream().withStream { s ->
BuildParams.bwcVersions.compareToAuthoritative( BuildParams.bwcVersions.compareToAuthoritative(
new XmlParser().parse(s) new XmlParser().parse(s)
.versioning.versions.version .versioning.versions.version
@ -433,11 +432,11 @@ allprojects {
tasks.named('cleanEclipse') { dependsOn 'wipeEclipseSettings' } tasks.named('cleanEclipse') { dependsOn 'wipeEclipseSettings' }
// otherwise the eclipse merging is *super confusing* // otherwise the eclipse merging is *super confusing*
tasks.named('eclipse') { dependsOn 'cleanEclipse', 'copyEclipseSettings' } tasks.named('eclipse') { dependsOn 'cleanEclipse', 'copyEclipseSettings' }
afterEvaluate { afterEvaluate {
tasks.findByName("eclipseJdt")?.configure { tasks.findByName("eclipseJdt")?.configure {
dependsOn 'copyEclipseSettings' dependsOn 'copyEclipseSettings'
} }
} }
} }

View File

@ -370,6 +370,9 @@ public class BwcVersions {
.stream() .stream()
.flatMap(Collection::stream) .flatMap(Collection::stream)
.filter(each -> unreleased.contains(each) == false) .filter(each -> unreleased.contains(each) == false)
// this is to make sure we only consider OpenSearch versions
// TODO remove this filter once legacy ES versions are no longer supported
.filter(v -> v.onOrAfter("1.0.0"))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }

View File

@ -716,14 +716,14 @@ public class BwcVersionsTests extends GradleUnitTestCase {
} }
public void testCompareToAuthoritative() { public void testCompareToAuthoritative() {
List<String> listOfVersions = asList("7.0.0", "7.0.1", "7.1.0", "7.1.1", "7.2.0", "7.3.0", "8.0.0"); List<String> listOfVersions = asList("1.0.0", "1.0.1", "1.1.0", "1.1.1", "1.2.0", "1.3.0", "2.0.0");
List<Version> authoritativeReleasedVersions = Stream.of("7.0.0", "7.0.1", "7.1.0") List<Version> authoritativeReleasedVersions = Stream.of("1.0.0", "1.0.1", "1.1.0")
.map(Version::fromString) .map(Version::fromString)
.collect(Collectors.toList()); .collect(Collectors.toList());
BwcVersions vc = new BwcVersions( BwcVersions vc = new BwcVersions(
listOfVersions.stream().map(this::formatVersionToLine).collect(Collectors.toList()), listOfVersions.stream().map(this::formatVersionToLine).collect(Collectors.toList()),
Version.fromString("8.0.0") Version.fromString("2.0.0")
); );
vc.compareToAuthoritative(authoritativeReleasedVersions); vc.compareToAuthoritative(authoritativeReleasedVersions);
} }
@ -744,11 +744,11 @@ public class BwcVersionsTests extends GradleUnitTestCase {
} }
public void testCompareToAuthoritativeNotReallyRelesed() { public void testCompareToAuthoritativeNotReallyRelesed() {
List<String> listOfVersions = asList("7.0.0", "7.0.1", "7.1.0", "7.1.1", "7.2.0", "7.3.0", "8.0.0"); List<String> listOfVersions = asList("1.0.0", "1.0.1", "1.1.0", "1.1.1", "1.2.0", "1.3.0", "2.0.0");
List<Version> authoritativeReleasedVersions = Stream.of("7.0.0", "7.0.1").map(Version::fromString).collect(Collectors.toList()); List<Version> authoritativeReleasedVersions = Stream.of("1.0.0", "1.0.1").map(Version::fromString).collect(Collectors.toList());
BwcVersions vc = new BwcVersions( BwcVersions vc = new BwcVersions(
listOfVersions.stream().map(this::formatVersionToLine).collect(Collectors.toList()), listOfVersions.stream().map(this::formatVersionToLine).collect(Collectors.toList()),
Version.fromString("8.0.0") Version.fromString("2.0.0")
); );
expectedEx.expect(IllegalStateException.class); expectedEx.expect(IllegalStateException.class);
expectedEx.expectMessage("not really released"); expectedEx.expectMessage("not really released");