aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/runtime
diff options
context:
space:
mode:
authorGravatar Klaus Aehlig <aehlig@google.com>2016-04-04 15:54:58 +0000
committerGravatar Kristina Chodorow <kchodorow@google.com>2016-04-05 14:03:56 +0000
commit2ce24d44c562fbc003baf1b45e39d84ee72c9696 (patch)
treed70412e7c791f5e5e4e7d9516490b8ca632d8894 /src/main/java/com/google/devtools/build/lib/runtime
parent5116c1a9e3d869df7b6cdb847e4ac2614565a1e6 (diff)
experimental UI: update progress bar on progress events
In the experimental UI, use progress events as an occasion to update the progress bar. However, to avoid unnecessary noise, only do so, if the progress bar potentially changes with time. -- Change-Id: I9bee093c29e0eb50e7fcce2fa6e941a02d615def Reviewed-on: https://bazel-review.googlesource.com/#/c/3206 MOS_MIGRATED_REVID=118944208
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/runtime')
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/ExperimentalStateTracker.java15
2 files changed, 19 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java b/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java
index 0073c245ce..dc488bd6e0 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java
@@ -115,6 +115,10 @@ public class ExperimentalEventHandler extends BlazeCommandEventHandler {
}
terminal.flush();
break;
+ case PROGRESS:
+ if (stateTracker.progressBarTimeDependent()) {
+ refresh();
+ }
}
}
} catch (IOException e) {
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalStateTracker.java b/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalStateTracker.java
index 889222228c..0764d53778 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalStateTracker.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalStateTracker.java
@@ -147,6 +147,21 @@ class ExperimentalStateTracker {
}
}
+ /***
+ * Predicate indicating whether the contents of the progress bar can change, if the
+ * only thing that happens is that time passes; this is the case, e.g., if the progress
+ * bar shows time information relative to the current time.
+ */
+ boolean progressBarTimeDependent() {
+ if (status != null) {
+ return false;
+ }
+ if (runningActions.size() >= 1) {
+ return true;
+ }
+ return false;
+ }
+
synchronized void writeProgressBar(AnsiTerminalWriter terminalWriter) throws IOException {
if (status != null) {
if (ok) {