Always display failed and main project at the end (fixes #723) (#724)

This commit is contained in:
Guillaume Nodet
2022-12-14 09:34:24 +01:00
committed by GitHub
parent 031c263232
commit fd3f20ef96

View File

@@ -32,6 +32,7 @@ import java.util.Deque;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
@@ -287,12 +288,18 @@ public class TerminalOutput implements ClientOutput {
case Message.PROJECT_STOPPED: {
StringMessage be = (StringMessage) entry;
final String artifactId = be.getMessage();
Project prj = projects.remove(artifactId);
if (prj != null) {
prj.log.forEach(log);
// Display project log if it has not failed and if it's not the main project
if (!Objects.equals(name, artifactId)) {
Project prj = projects.get(artifactId);
if (prj != null) {
if (failures.stream().noneMatch(e -> Objects.equals(artifactId, e.getProjectId()))) {
projects.remove(artifactId);
prj.log.forEach(log);
}
}
doneProjects++;
displayDone();
}
doneProjects++;
displayDone();
break;
}
case Message.BUILD_STATUS: {
@@ -300,7 +307,11 @@ public class TerminalOutput implements ClientOutput {
break;
}
case Message.BUILD_FINISHED: {
Project main = projects.remove(name);
projects.values().stream().flatMap(p -> p.log.stream()).forEach(log);
if (main != null) {
main.log.forEach(log);
}
clearDisplay();
try {
log.close();