Skip to content

Commit 82697c9

Browse files
rjernstjozala
andauthored
Remove implementation of set compatible versions task (#134896) (#134922)
This task will go away with the new transport version system. In the meantime, this commit removes the implementation so that the task still exists so release automation can proceed. Co-authored-by: Mariusz Jozala <[email protected]>
1 parent 304b7fb commit 82697c9

File tree

2 files changed

+0
-88
lines changed

2 files changed

+0
-88
lines changed

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/release/SetCompatibleVersionsTask.java

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,14 @@
99

1010
package org.elasticsearch.gradle.internal.release;
1111

12-
import com.github.javaparser.StaticJavaParser;
13-
import com.github.javaparser.ast.CompilationUnit;
14-
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
15-
import com.github.javaparser.ast.expr.NameExpr;
16-
import com.github.javaparser.printer.lexicalpreservation.LexicalPreservingPrinter;
17-
1812
import org.elasticsearch.gradle.Version;
1913
import org.gradle.api.tasks.TaskAction;
2014
import org.gradle.api.tasks.options.Option;
2115
import org.gradle.initialization.layout.BuildLayout;
2216

2317
import java.io.IOException;
24-
import java.nio.file.Path;
2518
import java.util.List;
2619
import java.util.Map;
27-
import java.util.Optional;
2820

2921
import javax.inject.Inject;
3022

@@ -68,34 +60,5 @@ public void executeTask() throws IOException {
6860
if (transportVersion == null) {
6961
throw new IllegalArgumentException("TransportVersion id not specified");
7062
}
71-
Path versionJava = rootDir.resolve(TRANSPORT_VERSIONS_FILE_PATH);
72-
CompilationUnit file = LexicalPreservingPrinter.setup(StaticJavaParser.parse(versionJava));
73-
74-
Optional<CompilationUnit> modifiedFile;
75-
76-
modifiedFile = setMinimumCcsTransportVersion(file, transportVersion);
77-
78-
if (modifiedFile.isPresent()) {
79-
writeOutNewContents(versionJava, modifiedFile.get());
80-
}
81-
}
82-
83-
static Optional<CompilationUnit> setMinimumCcsTransportVersion(CompilationUnit unit, int transportVersion) {
84-
ClassOrInterfaceDeclaration transportVersions = unit.getClassByName("TransportVersions").get();
85-
86-
String tvConstantName = transportVersions.getFields().stream().filter(f -> {
87-
var i = findSingleIntegerExpr(f);
88-
return i.isPresent() && i.getAsInt() == transportVersion;
89-
})
90-
.map(f -> f.getVariable(0).getNameAsString())
91-
.findFirst()
92-
.orElseThrow(() -> new IllegalStateException("Could not find constant for id " + transportVersion));
93-
94-
transportVersions.getFieldByName("MINIMUM_CCS_VERSION")
95-
.orElseThrow(() -> new IllegalStateException("Could not find MINIMUM_CCS_VERSION constant"))
96-
.getVariable(0)
97-
.setInitializer(new NameExpr(tvConstantName));
98-
99-
return Optional.of(unit);
10063
}
10164
}

build-tools-internal/src/test/java/org/elasticsearch/gradle/internal/release/SetCompatibleVersionsTaskTests.java

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)