Skip to content

Commit 949f836

Browse files
committed
spotless
1 parent cb6420f commit 949f836

File tree

2 files changed

+15
-21
lines changed

2 files changed

+15
-21
lines changed

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/transport/GenerateTransportVersionDataTask.java

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
package org.elasticsearch.gradle.internal.transport;
1111

1212
import com.google.common.collect.Streams;
13+
1314
import org.elasticsearch.gradle.VersionProperties;
1415
import org.gradle.api.DefaultTask;
1516
import org.gradle.api.file.RegularFileProperty;
@@ -77,10 +78,7 @@ public void generateTransportVersionData() throws IOException {
7778
// Create the new version
7879
final var mainReleaseVersion = VersionProperties.getElasticsearchVersion();
7980
final var areWeOnMain = forMinorVersion.equals(mainReleaseVersion);
80-
int newVersion = bumpVersionNumber(
81-
latestTV.ids().getFirst(),
82-
areWeOnMain ? PartToBump.SERVER : PartToBump.PATCH
83-
);
81+
int newVersion = bumpVersionNumber(latestTV.ids().getFirst(), areWeOnMain ? PartToBump.SERVER : PartToBump.PATCH);
8482

8583
// Load the tvSetData for the specified name, if it exists
8684
final var tvSetDataFromFile = TransportVersionUtils.getDefinedFile(tvDataDir, tvName);
@@ -103,10 +101,7 @@ public enum PartToBump {
103101
}
104102

105103
// TODO Do I need to remove the patch when updating the server portion? NO, but probably need some additional checks
106-
private static int bumpVersionNumber(
107-
int tvIDToBump,
108-
PartToBump partToBump
109-
) {
104+
private static int bumpVersionNumber(int tvIDToBump, PartToBump partToBump) {
110105

111106
/* The TV format:
112107
*
@@ -121,24 +116,27 @@ private static int bumpVersionNumber(
121116
case SERVER -> {
122117
var newId = tvIDToBump + 1000;
123118
if ((newId / 1000) % 100 == 0) {
124-
throw new IllegalStateException("Insufficient server version section in TransportVersion: " + tvIDToBump
125-
+ ", Cannot bump.");
119+
throw new IllegalStateException(
120+
"Insufficient server version section in TransportVersion: " + tvIDToBump + ", Cannot bump."
121+
);
126122
}
127123
yield tvIDToBump + 1000;
128124
}
129125
case SUBSIDIARY -> {
130126
var newId = tvIDToBump + 100;
131127
if ((newId / 100) == 0) {
132-
throw new IllegalStateException("Insufficient subsidiary version section in TransportVersion: " + tvIDToBump
133-
+ ", Cannot bump.");
128+
throw new IllegalStateException(
129+
"Insufficient subsidiary version section in TransportVersion: " + tvIDToBump + ", Cannot bump."
130+
);
134131
}
135132
yield newId;
136133
}
137134
case PATCH -> {
138135
var newId = tvIDToBump + 1;
139136
if (newId % 10 == 0) {
140-
throw new IllegalStateException("Insufficient patch version section in TransportVersion: " + tvIDToBump
141-
+ ", Cannot bump.");
137+
throw new IllegalStateException(
138+
"Insufficient patch version section in TransportVersion: " + tvIDToBump + ", Cannot bump."
139+
);
142140
}
143141
yield newId;
144142
}

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/transport/TransportVersionUtils.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
package org.elasticsearch.gradle.internal.transport;
1111

1212
import com.google.common.collect.Comparators;
13+
1314
import org.gradle.api.GradleException;
1415
import org.gradle.api.Project;
1516
import org.gradle.api.attributes.Attribute;
@@ -34,8 +35,7 @@ class TransportVersionUtils {
3435
private static final String LATEST_DIR = "latest";
3536
private static final String DEFINED_DIR = "defined";
3637

37-
record TransportVersionDefinition(String name, List<Integer> ids) {
38-
}
38+
record TransportVersionDefinition(String name, List<Integer> ids) {}
3939

4040
record TransportVersionReference(String name, String location) {
4141
@Override
@@ -71,11 +71,7 @@ static void updateLatestFile(Path dataDir, String majorMinor, String name, int i
7171
validateNameFormat(name);
7272
var path = dataDir.resolve(LATEST_DIR).resolve(majorMinor + ".csv");
7373
assert Files.isRegularFile(path) : "\"Latest\" file was not found at" + path + ", but is required: ";
74-
Files.writeString(
75-
path,
76-
name + "," + id + "\n",
77-
StandardCharsets.UTF_8
78-
);
74+
Files.writeString(path, name + "," + id + "\n", StandardCharsets.UTF_8);
7975
}
8076

8177
static void validateNameFormat(String name) {

0 commit comments

Comments
 (0)