Compare commits
3 Commits
9281ba7e10
...
3bf962de00
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3bf962de00
|
||
|
|
64471269f2
|
||
|
|
0b2de9d40c
|
2
.gitignore
vendored
2
.gitignore
vendored
@@ -3,3 +3,5 @@
|
||||
/example_logs
|
||||
TODO.org
|
||||
/result
|
||||
/.envrc
|
||||
/.direnv/
|
||||
|
||||
@@ -215,7 +215,15 @@ impl Activity {
|
||||
.as_ref()
|
||||
.map(|phase| Cow::Owned(format!("[{}]", phase))),
|
||||
Activity::OptimizeStore(_activity_optimize_store) => None,
|
||||
Activity::VerifyPaths(_activity_verify_paths) => None,
|
||||
Activity::VerifyPaths(activity_verify_paths) => {
|
||||
get_progress_bar(activity_verify_paths.done, activity_verify_paths.expected)
|
||||
.or_else(|| {
|
||||
get_progress_text(
|
||||
activity_verify_paths.done,
|
||||
activity_verify_paths.expected,
|
||||
)
|
||||
})
|
||||
}
|
||||
Activity::Substitute(_activity_substitute) => None,
|
||||
Activity::QueryPathInfo(_activity_query_path_info) => None,
|
||||
Activity::PostBuildHook(_activity_post_build_hook) => None,
|
||||
@@ -323,8 +331,11 @@ impl Activity {
|
||||
Activity::OptimizeStore(_activity_optimize_store) => {
|
||||
panic!("Attempted to set the progress of an optimize store activity.");
|
||||
}
|
||||
Activity::VerifyPaths(_activity_verify_paths) => {
|
||||
panic!("Attempted to set the progress of a verify paths activity.");
|
||||
Activity::VerifyPaths(activity_verify_paths) => {
|
||||
activity_verify_paths.done = done;
|
||||
activity_verify_paths.expected = expected;
|
||||
activity_verify_paths.running = running;
|
||||
activity_verify_paths.failed = failed;
|
||||
}
|
||||
Activity::Substitute(_activity_substitute) => {
|
||||
panic!("Attempted to set the progress of a substitute activity.");
|
||||
@@ -451,6 +462,10 @@ pub(crate) struct ActivityOptimizeStore {
|
||||
}
|
||||
pub(crate) struct ActivityVerifyPaths {
|
||||
pub(crate) state: ActivityState,
|
||||
pub(crate) done: u64,
|
||||
pub(crate) expected: u64,
|
||||
pub(crate) running: u64,
|
||||
pub(crate) failed: u64,
|
||||
}
|
||||
pub(crate) struct ActivitySubstitute {
|
||||
pub(crate) state: ActivityState,
|
||||
@@ -493,6 +508,23 @@ impl Default for ActivityState {
|
||||
}
|
||||
|
||||
fn get_progress_bar(done: u64, expected: u64) -> Option<Cow<'static, str>> {
|
||||
if expected == 0 {
|
||||
return None;
|
||||
}
|
||||
// ○◔◑◕●
|
||||
// ○◎◉●
|
||||
// ▁▂▃▄▅▆▇█
|
||||
// ▏▎▍▌▋▊▉█
|
||||
// ░▒▓█
|
||||
//
|
||||
// 🮷 download
|
||||
// 🮸 upload
|
||||
// 🮵
|
||||
// 🮶
|
||||
get_progress_bar_clockwise_circle(done, expected)
|
||||
}
|
||||
|
||||
fn get_progress_bar_fade_in(done: u64, expected: u64) -> Option<Cow<'static, str>> {
|
||||
if expected == 0 {
|
||||
return None;
|
||||
}
|
||||
@@ -520,6 +552,36 @@ fn get_progress_bar(done: u64, expected: u64) -> Option<Cow<'static, str>> {
|
||||
}
|
||||
}
|
||||
|
||||
fn get_progress_bar_clockwise_circle(done: u64, expected: u64) -> Option<Cow<'static, str>> {
|
||||
if expected == 0 {
|
||||
return None;
|
||||
}
|
||||
let percent = done as f32 / expected as f32;
|
||||
// ○◔◑◕●
|
||||
// ○◎◉●
|
||||
// ▁▂▃▄▅▆▇█
|
||||
// ▏▎▍▌▋▊▉█
|
||||
// ░▒▓█
|
||||
//
|
||||
// 🮷 download
|
||||
// 🮸 upload
|
||||
// 🮵
|
||||
// 🮶
|
||||
if percent < 0.25 {
|
||||
Some(Cow::Borrowed("○"))
|
||||
} else if percent < 0.5 {
|
||||
Some(Cow::Borrowed("◔"))
|
||||
} else if percent < 0.75 {
|
||||
Some(Cow::Borrowed("◑"))
|
||||
} else if percent < 1.0 {
|
||||
Some(Cow::Borrowed("◕"))
|
||||
} else if percent >= 1.0 {
|
||||
Some(Cow::Borrowed("●"))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
fn get_progress_text(done: u64, expected: u64) -> Option<Cow<'static, str>> {
|
||||
Some(Cow::Owned(format!("[{}/{}]", done, expected)))
|
||||
}
|
||||
|
||||
@@ -163,6 +163,10 @@ impl ActivityTreeStream {
|
||||
activity_start_verify_paths.parent,
|
||||
Activity::VerifyPaths(ActivityVerifyPaths {
|
||||
state: ActivityState::default(),
|
||||
done: 0,
|
||||
expected: 0,
|
||||
running: 0,
|
||||
failed: 0,
|
||||
}),
|
||||
)?;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ use super::nix_output_stream::ActivityResultMessage;
|
||||
use super::nix_output_stream::NixMessage;
|
||||
use super::tree_iter::DrawDagEntry;
|
||||
use super::tree_iter::ReverseTreeIter;
|
||||
use super::tree_iter::get_draw_order;
|
||||
|
||||
pub(crate) struct RunningBuild<'db> {
|
||||
db_handle: &'db DbHandle,
|
||||
@@ -107,7 +106,10 @@ impl<'db> RunningBuild<'db> {
|
||||
};
|
||||
match message {
|
||||
NixAction::Msg(msg_message) => {
|
||||
if msg_message.level > 0 && msg_message.level < 5 {
|
||||
if msg_message.level > 0
|
||||
&& msg_message.level < 5
|
||||
&& !(msg_message.level == 4 && msg_message.msg.starts_with("linking "))
|
||||
{
|
||||
eprintln!("LOG MESSAGE {}: {}", msg_message.level, msg_message.msg);
|
||||
}
|
||||
}
|
||||
@@ -129,8 +131,15 @@ impl<'db> RunningBuild<'db> {
|
||||
ActivityResultMessage::SetPhase(_activity_result_set_phase) => {
|
||||
self.print_current_status();
|
||||
}
|
||||
ActivityResultMessage::Progress(_activity_result_progress) => {
|
||||
self.maybe_print_current_status();
|
||||
ActivityResultMessage::Progress(activity_result_progress) => {
|
||||
if activity_result_progress.done == activity_result_progress.expected
|
||||
&& activity_result_progress.expected > 0
|
||||
{
|
||||
// If we finished the in-progress activity, always render so we show the 100% done version.
|
||||
self.print_current_status();
|
||||
} else {
|
||||
self.maybe_print_current_status();
|
||||
}
|
||||
}
|
||||
ActivityResultMessage::SetExpected(_activity_result_set_expected) => {
|
||||
self.maybe_print_current_status();
|
||||
|
||||
Reference in New Issue
Block a user