Skip to content

Commit c0bbefe

Browse files
author
elasticsearchmachine
committed
[CI] Auto commit changes from spotless
1 parent e60b391 commit c0bbefe

File tree

2 files changed

+34
-14
lines changed

2 files changed

+34
-14
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ public void checkTransportVersion() throws IOException {
7474
Files.writeString(outputFile, String.join("\n", results.stream().map(Object::toString).sorted().toList()));
7575
}
7676

77-
private void addNamesFromClassesDirectory(Set<TransportVersionUtils.TransportVersionReference> results, Path basePath) throws IOException {
77+
private void addNamesFromClassesDirectory(Set<TransportVersionUtils.TransportVersionReference> results, Path basePath)
78+
throws IOException {
7879
Files.walkFileTree(basePath, new SimpleFileVisitor<>() {
7980
@Override
8081
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {

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

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ private record IdAndDefinition(TransportVersionId id, TransportVersionDefinition
7878
// all transport version names referenced
7979
private final Set<String> allNames = new HashSet<>();
8080
// direct lookup of definition by name
81-
private final Map<String,TransportVersionDefinition> definitions = new HashMap<>();
81+
private final Map<String, TransportVersionDefinition> definitions = new HashMap<>();
8282
// which resource files already existed
8383
private final Set<String> existingResources = new HashSet<>();
8484
// reverse lookup of ids back to name
85-
private final Map<Integer,String> definedIds = new HashMap<>();
85+
private final Map<Integer, String> definedIds = new HashMap<>();
8686
// lookup of base ids back to definition
8787
private final Map<Integer, List<IdAndDefinition>> idsByBase = new HashMap<>();
8888
// direct lookup of latest for each branch
@@ -146,10 +146,17 @@ private String gitCommand(String... args) {
146146
});
147147

148148
if (result.getExitValue() != 0) {
149-
throw new RuntimeException("git command failed with exit code " + result.getExitValue() + System.lineSeparator() +
150-
"command: " + String.join(" ", command) + System.lineSeparator() +
151-
"output:" + System.lineSeparator()
152-
+ stdout.toString(StandardCharsets.UTF_8));
149+
throw new RuntimeException(
150+
"git command failed with exit code "
151+
+ result.getExitValue()
152+
+ System.lineSeparator()
153+
+ "command: "
154+
+ String.join(" ", command)
155+
+ System.lineSeparator()
156+
+ "output:"
157+
+ System.lineSeparator()
158+
+ stdout.toString(StandardCharsets.UTF_8)
159+
);
153160
}
154161

155162
return stdout.toString(StandardCharsets.UTF_8);
@@ -245,16 +252,29 @@ private void recordAndValidateLatest(TransportVersionLatest latest) {
245252
throwLatestFailure(latest.branch(), "contains transport version name [" + latest.name() + "] which is not defined");
246253
}
247254
if (latestDefinition.ids().contains(latest.id()) == false) {
248-
throwLatestFailure(latest.branch(), "has id " + latest.id() +
249-
" which is not in definition [" + definitionRelativePath(latest.name()) + "]");
255+
throwLatestFailure(
256+
latest.branch(),
257+
"has id " + latest.id() + " which is not in definition [" + definitionRelativePath(latest.name()) + "]"
258+
);
250259
}
251260

252261
List<IdAndDefinition> baseIds = idsByBase.get(latest.id().base());
253262
IdAndDefinition lastId = baseIds.getLast();
254263
if (lastId.id().complete() != latest.id().complete()) {
255-
throwLatestFailure(latest.branch(), "has id " + latest.id() + " from [" + latest.name() +
256-
"] with base " + latest.id().base() + " but another id " + lastId.id().complete() + " from [" +
257-
lastId.definition().name() + "] is later for that base");
264+
throwLatestFailure(
265+
latest.branch(),
266+
"has id "
267+
+ latest.id()
268+
+ " from ["
269+
+ latest.name()
270+
+ "] with base "
271+
+ latest.id().base()
272+
+ " but another id "
273+
+ lastId.id().complete()
274+
+ " from ["
275+
+ lastId.definition().name()
276+
+ "] is later for that base"
277+
);
258278
}
259279

260280
TransportVersionLatest existingLatest = readExistingLatest(latest.branch());
@@ -272,8 +292,7 @@ private void cleanupAndValidateBase(int base, List<IdAndDefinition> ids) {
272292
for (int ndx = 0; ndx < ids.size(); ++ndx) {
273293
IdAndDefinition idAndDefinition = ids.get(ndx);
274294
if (idAndDefinition.id().patch() != ndx) {
275-
throw new IllegalStateException("Transport version base version " + base +
276-
" is missing patch version " + (base + ndx));
295+
throw new IllegalStateException("Transport version base version " + base + " is missing patch version " + (base + ndx));
277296
}
278297
}
279298
}

0 commit comments

Comments
 (0)