feat: adopt VoidLibrary VL-001..VL-013, self-building build.cpp, live logs, and generated CLI help
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 10s

This commit is contained in:
faumaray committed 2026-11-27 01:43:06 +03:00
1 parent ab64147f9d
commit 363fb8200e
33 files changed
+1754 -3155

No files matched your search

+57 -10
View File
@@ -4,6 +4,7 @@
#include <Void/Build/Platform/FileOps.hpp>
#include <Void/Build/Platform/ProcessSupervisor.hpp>
#include <Void/Build/Util/Sha256.hpp>
#include <Void/Log/Log.hpp>
#include <Void/System/Path.hpp>
#include <Void/System/Types.hpp>
#include <Void/Time/Stopwatch.hpp>
@@ -266,17 +267,53 @@ execute_graph(const Graph::BuildGraph &graph, State::StateStore &state,
std::size_t active_workers = 0;
std::size_t completed_count = 0;
std::atomic<std::size_t> started_exec_count{0};
bool abort_scheduling = false;
auto action_label = [&](const Graph::ActionNode &act) -> std::string {
auto rel_name = [&](const std::filesystem::path &p) -> std::string {
if (p.empty()) {
return act.target_name;
}
if (!graph.project_root.empty() && Platform::path_is_within(graph.project_root, p)) {
return p.lexically_relative(graph.project_root).generic_string();
}
return p.filename().string();
};
switch (act.kind) {
case Graph::ActionKind::Compile:
return std::format("Compile {}", rel_name(!act.logical_source_file.empty()
? act.logical_source_file
: act.logical_output_file));
case Graph::ActionKind::PrecompiledHeader:
return std::format("PCH {}", rel_name(act.logical_source_file));
case Graph::ActionKind::HeaderUnit:
return std::format("HdrUnit {}", rel_name(act.logical_source_file));
case Graph::ActionKind::ModuleScan:
return std::format("ModScan {}", rel_name(act.logical_source_file));
case Graph::ActionKind::ModuleBmi:
return std::format("BMI {}", rel_name(act.logical_source_file));
case Graph::ActionKind::Archive:
return std::format("Archive {}", rel_name(act.logical_output_file));
case Graph::ActionKind::Link:
return std::format("Link {}", rel_name(act.logical_output_file));
case Graph::ActionKind::Custom:
return std::format("Action {}", act.target_name);
}
return act.id;
};
auto emit_event = [&](ExecutionEvent::Kind kind, const Graph::ActionNode &act,
std::size_t completed, std::string msg = {}) {
const std::string &label, std::size_t completed,
std::chrono::milliseconds elapsed = {}, std::string msg = {}) {
if (options.on_event) {
options.on_event(ExecutionEvent{kind, act.id, act.target_name, completed,
selected_indices.size(), std::move(msg)});
options.on_event(ExecutionEvent{kind, act.id, act.target_name, label, completed,
selected_indices.size(), elapsed, std::move(msg)});
}
};
auto run_one_action = [&](const Graph::ActionNode &act) -> ActionExecutionResult {
auto run_one_action = [&](const Graph::ActionNode &act,
const std::string &label) -> ActionExecutionResult {
const auto timer = Void::Time::Stopwatch::started();
ActionExecutionResult res;
res.action_id = act.id;
@@ -308,6 +345,10 @@ execute_graph(const Graph::BuildGraph &graph, State::StateStore &state,
}
}
const std::size_t seq = started_exec_count.fetch_add(1, std::memory_order_relaxed) + 1;
Void::Log::info("Build", "[{:>2}/{}] {}", seq, selected_indices.size(), label);
emit_event(ExecutionEvent::Kind::ActionStarted, act, label, seq);
// 2. Prepare output directories and response file.
std::error_code ec;
for (const auto &out : act.declared_outputs) {
@@ -477,8 +518,8 @@ execute_graph(const Graph::BuildGraph &graph, State::StateStore &state,
}
const auto &act = graph.actions[idx];
emit_event(ExecutionEvent::Kind::ActionStarted, act, completed_count);
auto ares = run_one_action(act);
const std::string label = action_label(act);
auto ares = run_one_action(act, label);
{
std::lock_guard lk{mu};
@@ -487,10 +528,14 @@ execute_graph(const Graph::BuildGraph &graph, State::StateStore &state,
if (ares.succeeded) {
if (ares.from_cache) {
++report.cached_count;
emit_event(ExecutionEvent::Kind::ActionCached, act, completed_count);
Void::Log::debug("Build", "[cached] {}", label);
emit_event(ExecutionEvent::Kind::ActionCached, act, label, completed_count,
ares.elapsed);
} else {
++report.executed_count;
emit_event(ExecutionEvent::Kind::ActionSucceeded, act, completed_count);
Void::Log::debug("Build", "Done {} ({}ms)", label, ares.elapsed.count());
emit_event(ExecutionEvent::Kind::ActionSucceeded, act, label,
completed_count, ares.elapsed);
}
for (const std::size_t dep_idx : dependents[idx]) {
if (--in_degree[dep_idx] == 0) {
@@ -505,8 +550,10 @@ execute_graph(const Graph::BuildGraph &graph, State::StateStore &state,
if (report.diagnostic.empty()) {
report.diagnostic = act.id + ": " + ares.error_message;
}
emit_event(ExecutionEvent::Kind::ActionFailed, act, completed_count,
ares.error_message);
Void::Log::error("Build", "FAILED {} ({}): {}", label, act.id,
ares.error_message);
emit_event(ExecutionEvent::Kind::ActionFailed, act, label, completed_count,
ares.elapsed, ares.error_message);
if (options.fail_fast) {
abort_scheduling = true;
internal_stop.request_stop();