|
15 | 15 | */ |
16 | 16 |
|
17 | 17 | #include <vix/cli/commands/run/dev/DevSession.hpp> |
| 18 | +#include <vix/cli/build/BuildStyle.hpp> |
18 | 19 | #include <vix/cli/Style.hpp> |
19 | 20 | #include <vix/cli/commands/run/RunScriptHelpers.hpp> |
20 | 21 | #include <vix/cli/errors/RawLogDetectors.hpp> |
@@ -112,13 +113,21 @@ namespace vix::commands::RunCommand::dev |
112 | 113 | << "\n\n"; |
113 | 114 | } |
114 | 115 |
|
115 | | - void print_dev_started(int pid) |
| 116 | + void print_dev_started( |
| 117 | + int pid, |
| 118 | + std::optional<long long> rebuildDurationMs) |
116 | 119 | { |
117 | 120 | std::cout << " " |
118 | | - << GREEN << "✔" << RESET |
119 | | - << " Started" |
120 | | - << GRAY << " pid=" << pid << RESET |
121 | | - << "\n"; |
| 121 | + << GREEN << "✔" << RESET << " "; |
| 122 | + if (rebuildDurationMs) |
| 123 | + { |
| 124 | + std::cout << "Rebuilt in "; |
| 125 | + vix::cli::build::write_build_duration( |
| 126 | + std::cout, |
| 127 | + *rebuildDurationMs); |
| 128 | + std::cout << GRAY << " · " << RESET; |
| 129 | + } |
| 130 | + std::cout << "Started" << GRAY << " pid=" << pid << RESET << "\n"; |
122 | 131 | } |
123 | 132 |
|
124 | 133 | void print_dev_app_exited_cleanly() |
@@ -284,9 +293,18 @@ namespace vix::commands::RunCommand::dev |
284 | 293 | << GRAY << " (dev)" << RESET |
285 | 294 | << "\n"; |
286 | 295 |
|
| 296 | + fs::path changedPath = change.path; |
| 297 | + if (!dev_verbose_ui(options_)) |
| 298 | + { |
| 299 | + std::error_code ec; |
| 300 | + const fs::path relative = fs::relative(change.path, options_.projectDir, ec); |
| 301 | + if (!ec && !relative.empty()) |
| 302 | + changedPath = relative; |
| 303 | + } |
| 304 | + |
287 | 305 | std::cout << " " |
288 | 306 | << GRAY << "changed: " << RESET |
289 | | - << change.path.string() |
| 307 | + << changedPath.generic_string() |
290 | 308 | << "\n"; |
291 | 309 | } |
292 | 310 |
|
@@ -378,10 +396,19 @@ namespace vix::commands::RunCommand::dev |
378 | 396 | { |
379 | 397 | const DevChangeKind rebuildKind = pendingChangeKind_; |
380 | 398 | pendingChangeKind_ = DevChangeKind::Ignore; |
| 399 | + const bool isRebuild = rebuildKind != DevChangeKind::Ignore; |
| 400 | + const auto rebuildStart = std::chrono::steady_clock::now(); |
381 | 401 |
|
382 | 402 | DevRebuilderResult rebuildResult = |
383 | 403 | co_await rebuild_async(ctx, rebuildKind, ct); |
384 | 404 |
|
| 405 | + const std::optional<long long> rebuildDurationMs = isRebuild && rebuildResult.ok |
| 406 | + ? std::optional<long long>( |
| 407 | + std::chrono::duration_cast<std::chrono::milliseconds>( |
| 408 | + std::chrono::steady_clock::now() - rebuildStart) |
| 409 | + .count()) |
| 410 | + : std::nullopt; |
| 411 | + |
385 | 412 | if (ct.is_cancelled()) |
386 | 413 | { |
387 | 414 | result.exitCode = 130; |
@@ -448,7 +475,7 @@ namespace vix::commands::RunCommand::dev |
448 | 475 | } |
449 | 476 |
|
450 | 477 | const DevChildRunResult childResult = |
451 | | - co_await run_child_once_async(ctx, *exePath, ct); |
| 478 | + co_await run_child_once_async(ctx, *exePath, ct, rebuildDurationMs); |
452 | 479 |
|
453 | 480 | if (childResult.reason == DevChildExitReason::RestartRequested) |
454 | 481 | continue; |
@@ -859,7 +886,8 @@ namespace vix::commands::RunCommand::dev |
859 | 886 | vix::async::core::task<DevChildRunResult> DevSession::run_child_once_async( |
860 | 887 | vix::async::core::io_context &ctx, |
861 | 888 | const fs::path &exePath, |
862 | | - vix::async::core::cancel_token ct) |
| 889 | + vix::async::core::cancel_token ct, |
| 890 | + std::optional<long long> rebuildDurationMs) |
863 | 891 | { |
864 | 892 | using Clock = std::chrono::steady_clock; |
865 | 893 |
|
@@ -907,7 +935,7 @@ namespace vix::commands::RunCommand::dev |
907 | 935 | std::string runtimeLog; |
908 | 936 |
|
909 | 937 | if (!options_.quiet) |
910 | | - print_dev_started(static_cast<int>(pid)); |
| 938 | + print_dev_started(static_cast<int>(pid), rebuildDurationMs); |
911 | 939 |
|
912 | 940 | // Do not make the first observable child output wait for a complete file |
913 | 941 | // polling period. File indexing remains at pollInterval; this short, |
|
0 commit comments