rmannibucau commented on code in PR #14071:
URL: https://github.com/apache/maven/pull/14071#discussion_r4671484711


##########
impl/maven-cli/src/main/java/org/apache/maven/cling/event/ExecutionEventLogger.java:
##########
@@ -295,15 +293,36 @@ private void formatBuildTime(StringBuilder buffer, 
BuildSummary buildSummary) {
     }
 
     private void logResult(MavenSession session) {
-        infoLine('-');
-        MessageBuilder buffer = builder();
-
         boolean failure = session.getResult().hasExceptions();
+        String status = failure ? "BUILD FAILURE" : "BUILD SUCCESS";
+
+        Instant finish = MonotonicClock.now();
+        Duration time = 
Duration.between(session.getRequest().getStartInstant(), finish);
+        String wallClock = session.getRequest().getDegreeOfConcurrency() > 1 ? 
" (Wall Clock)" : "";
+        String totalTime = "Total time:  " + formatDuration(time) + wallClock;
+
+        ZonedDateTime rounded = 
finish.truncatedTo(ChronoUnit.SECONDS).atZone(ZoneId.systemDefault());
+        String finishedAt = "Finished at: " + formatTimestamp(rounded);
+
+        int leftWidth = Math.max(0, (lineLength - finishedAt.length()) / 2);
+        int middleWidth = Math.max(0, lineLength - leftWidth - 
finishedAt.length());
+
+        int statusPadding = Math.max(0, leftWidth - status.length());
+        int totalTimePadding = Math.max(0, middleWidth - totalTime.length());
+        int overflow = Math.max(0, totalTime.length() - middleWidth);
+        statusPadding = Math.max(0, statusPadding - overflow);
+
+        MessageBuilder buffer = builder();
         if (failure) {
-            buffer.failure("BUILD FAILURE");
+            buffer.failure(status);
         } else {
-            buffer.success("BUILD SUCCESS");
+            buffer.success(status);
         }
+        buffer.a(chars(' ', statusPadding));
+        buffer.a(totalTime);

Review Comment:
   Yes, this is intentional. The status, total time and finish timestamp now 
form a single logger event, so they share the status severity: INFO on success 
and ERROR on failure. Keeping timing at INFO on failure would require splitting 
or duplicating that event, which would undo the single-line summary design or 
duplicate its metadata.
   
   The PR description now explicitly calls out that timing fields are promoted 
to ERROR on failure; the existing INFO-enabled guard around summary emission is 
unchanged. The failure tests already assert an ERROR line containing `BUILD 
FAILURE`, `Total time` and `Finished at`. All 18 `ExecutionEventLoggerTest` 
tests passed locally on JDK 21. The minimum-terminal-width test rename is 
already in the current head.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to