feat(daemon): build all workspace members in order
This commit is contained in:
1 parent
359783d2ad
commit
1a884fd931
6 files changed
+135
-39
No files matched your search
@@ -149,6 +149,10 @@ Stage: VERIFIED — Plans 01–19 + Plan 20 Slices 1–2C + Track A + Track B (B
|
||||
- Extracted `resolve_member_options` (workspace member selection, shared root lock) and applied it to the daemon `ide_query`, `ide_generate`, and `compdb_export` requests; non-workspace roots reject `member`, workspace roots require it.
|
||||
- `vbs daemon ide query|generate` and `vbs daemon compdb export` accept `--member`; the workspace daemon test now covers member-scoped IDE query/generate (`.clangd` in the member directory) and the missing-member error.
|
||||
|
||||
- **Wave 33 (Daemon Workspace-Wide Build)**:
|
||||
- Split the daemon build path into `execute_project_build` (returns a structured `BuildOutcome`) and `build_project`; a workspace build without `member` now builds every member in declared order, sharing the root lock and CAS, and returns per-member outcomes plus aggregate `executed`/`cached`/`failed`. A member-scoped build still returns `member`.
|
||||
- The workspace daemon test now expects the workspace-wide build to succeed and include both members, in addition to the member-scoped IDE checks.
|
||||
|
||||
## Remaining future scope
|
||||
|
||||
- **Post-v1 Expansion Roadmap ([21-expansion-roadmap.md](../roadmap/21-expansion-roadmap.md) & [20-future-translation-platforms.md](../roadmap/20-future-translation-platforms.md))**: Live `conan` CLI verification (Track B3), Track C (macOS/Windows ports + dual-profile cross-compilation), Track D3 signing (SBOM, Ed25519 primitives, trusted-key enforcement and distribution, binary-variant signing and distribution materialization, the #52 built-in-backend capability probe, and the VoidLibrary pin bump to `0002e74` done), Track E3 (daemon core, bounded `describe`, build-serving, dependency materialization, daemon-backed IDE metadata, compdb export, IDE config generation, editor watch poll and bounded long-poll done; dedicated external editor plugins remain), and Track E4 (`Void::Net`/`Void::Sqlite` alignment) remain planned scope.
|
||||
|
||||
@@ -39,4 +39,5 @@ Base HEAD: `fe0d1a6`
|
||||
| Wave 30 (`vbs binaries list|fetch`) | CLI over `fetch_binary_variants`: list id/digest/size/signature state; fetch resolves the variant and downloads with SHA-256 verification | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Registry suite 6/6, full CTest 8/8) | `src/Main.cpp`, `tests/RegistryTests.cpp`, `tests/CliContracts.cmake`, docs |
|
||||
| Wave 31 (Daemon workspace support) | Workspace `describe` member summaries; workspace `build` with `member` + shared root lock (`DaemonOptions::lock_root`) | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Daemon 13/13, full CTest 8/8) | `include/Void/Build/Daemon/Daemon.hpp`, `src/Daemon/Daemon.cpp`, `tests/DaemonTests.cpp`, docs |
|
||||
| Wave 32 (Member-scoped daemon IDE) | `resolve_member_options` shared by daemon IDE query/generate and compdb export; `--member` CLI flags; workspace member IDE coverage | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Daemon 13/13, full CTest 8/8) | `src/Daemon/Daemon.cpp`, `src/Main.cpp`, `tests/DaemonTests.cpp`, docs |
|
||||
| Wave 33 (Daemon workspace-wide build) | `execute_project_build`/`BuildOutcome` split; workspace build without `member` builds all members in order with per-member and aggregate results | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Daemon 13/13, full CTest 8/8) | `src/Daemon/Daemon.cpp`, `tests/DaemonTests.cpp`, docs |
|
||||
| Future (Plan 20 Slice 3 / Tracks C, E3 editor extensions, E4, live `conan`) | Live `conan` CLI verification; macOS/Windows/cross-compile; binary-variant signing and key distribution; daemon-side dependency materialization and editor plugins; `Void::Net`/`Void::Sqlite` alignment | PLANNED (unimplemented) | [21-expansion-roadmap.md](../roadmap/21-expansion-roadmap.md), [20-future-translation-platforms.md](../roadmap/20-future-translation-platforms.md) |
|
||||
@@ -584,6 +584,20 @@ dev cpp-gcc -c ctest --test-dir build/pinned --output-on-failure
|
||||
- Full CTest: **8 / 8 passed** in 211.77 s.
|
||||
- `clang-format --dry-run --Werror` passes on the changed C++ files.
|
||||
|
||||
## Daemon Workspace-Wide Build (GCC 16.2, pin `0002e74`)
|
||||
|
||||
```sh
|
||||
dev cpp-gcc -c cmake --build build/pinned --parallel 8
|
||||
dev cpp-gcc -c build/pinned/bin/vbs_v1_tests --suite Daemon --no-color
|
||||
dev cpp-gcc -c ctest --test-dir build/pinned --output-on-failure
|
||||
```
|
||||
|
||||
- Build: exit 0. Daemon suite: **13 / 13 passed** in 26.94 s; the workspace test now asserts that a
|
||||
workspace-wide `build` (no `member`) succeeds with `workspace:true` and per-member entries for
|
||||
both `lib` and `app`, and still covers member-scoped build/IDE requests.
|
||||
- Full CTest: **8 / 8 passed** in 211.82 s.
|
||||
- `clang-format --dry-run --Werror` passes on the changed C++ files.
|
||||
|
||||
## Limits and Unrun Checks
|
||||
|
||||
1. **HTTPS git fetch**: the host shell is proxy-restricted, but the Docker container could clone `https://git.faumaray.com/Void/VoidLibrary.git`; the pinned commit `3e254055e081a104f08df68dde39711bc7813518` was fetched directly for the verification above. A separate configure against the local `/home/faumaray/Projects/Library` checkout via `VBS_VOID_SOURCE_DIR` also succeeded (development-only override, checkout unmodified).
|
||||
|
||||
@@ -73,7 +73,7 @@ flowchart LR
|
||||
| --- | --- | --- |
|
||||
| **E1 — Everyday CLI Ergonomics (Implemented in Wave 8)** | `vbs init` project scaffolding, `vbs clean`, `vbs doctor` environment diagnostics, `vbs graph --format dot|json`, and `vbs build --native-foreign`. | End-to-end CLI & integration tests passing in `vbs_cli_contract` and `vbs_v1_tests`. |
|
||||
| **E2 — Multi-Package Workspaces (`workspace.cpp`)** *(verified in Docker GCC 16)* | Shared root `vbs.lock` and `build/.vbs` CAS, `workspace_dependency()` cross-member native linking, and affected-member selection (`vbs build/test --member <pkg>` / `--changed-since <ref>`). | 3-package workspace fixture (shared library + app + tests) builds/tests with one root lockfile; member selection and `--changed-since` verified in `FullV1Tests.workspace_members_shared_build_and_member_selection`. |
|
||||
| **E3 — IDE Config/Query & Background Daemon** | `build.cpp`/`build.profiles.cpp`/`build-support/` SDK entries in `compile_commands.json` + `vbs ide generate` (`.clangd`, `.vscode/`, `.zed/`, `.idea/customTargets.xml`) & `vbs ide query` (**Implemented & Verified in Wave 10**); Unix-socket daemon core holding a warm `StateStore` + project `DirectoryWatcher` with `vbs daemon run\|status\|stop\|gc\|recover\|describe` (**Implemented & Verified in Wave 14; bounded `describe` added in the post-v1 daemon follow-up**). `describe` returns a bounded graph summary (`target_names` ≤ 128 entries × 200 bytes, `profile` ≤ 128 bytes, 10 s evaluation timeout); `vbs daemon build` executes the lowered graph in-process against the warm state store with bounded `profile`/`targets`/`jobs`, including daemon-side dependency resolution/materialization and provider import via `Package::resolve_and_materialize_dependencies`; `vbs daemon ide query` publishes/selects the profile compilation database and serves the IDE workspace/target metadata JSON over the socket, `vbs daemon compdb export` returns the published compilation-database path and entry count, `vbs daemon ide generate` writes the editor presets over the socket, `vbs daemon ide poll` exposes a bounded editor-extension watch protocol (changed paths, sequence, overflow state), and `vbs daemon ide wait` adds a bounded long-poll variant. Daemon workspace support describes members, builds a selected member with the shared root lock, and serves member-scoped IDE query/generate/compdb requests via `--member`. Dedicated editor extensions remain planned. | `vbs ide` & `build.cpp` syntax-check verified in `FullV1Tests.cpp`; daemon lifecycle/status/gc/shutdown/describe verified in `DaemonTests.cpp` (6/6 under `dev cpp-gcc`); the live `vbs daemon describe` CLI round-trip is verified in `vbs_cli_contract`. |
|
||||
| **E3 — IDE Config/Query & Background Daemon** | `build.cpp`/`build.profiles.cpp`/`build-support/` SDK entries in `compile_commands.json` + `vbs ide generate` (`.clangd`, `.vscode/`, `.zed/`, `.idea/customTargets.xml`) & `vbs ide query` (**Implemented & Verified in Wave 10**); Unix-socket daemon core holding a warm `StateStore` + project `DirectoryWatcher` with `vbs daemon run\|status\|stop\|gc\|recover\|describe` (**Implemented & Verified in Wave 14; bounded `describe` added in the post-v1 daemon follow-up**). `describe` returns a bounded graph summary (`target_names` ≤ 128 entries × 200 bytes, `profile` ≤ 128 bytes, 10 s evaluation timeout); `vbs daemon build` executes the lowered graph in-process against the warm state store with bounded `profile`/`targets`/`jobs`, including daemon-side dependency resolution/materialization and provider import via `Package::resolve_and_materialize_dependencies`; `vbs daemon ide query` publishes/selects the profile compilation database and serves the IDE workspace/target metadata JSON over the socket, `vbs daemon compdb export` returns the published compilation-database path and entry count, `vbs daemon ide generate` writes the editor presets over the socket, `vbs daemon ide poll` exposes a bounded editor-extension watch protocol (changed paths, sequence, overflow state), and `vbs daemon ide wait` adds a bounded long-poll variant. Daemon workspace support describes members, builds all members in order (or a selected member) with the shared root lock, and serves member-scoped IDE query/generate/compdb requests via `--member`. Dedicated editor extensions remain planned. | `vbs ide` & `build.cpp` syntax-check verified in `FullV1Tests.cpp`; daemon lifecycle/status/gc/shutdown/describe verified in `DaemonTests.cpp` (6/6 under `dev cpp-gcc`); the live `vbs daemon describe` CLI round-trip is verified in `vbs_cli_contract`. |
|
||||
| **E4 — Transport & Storage Upstream Alignment** | Adopt `Void::Net` (`VL-004`/`VL-005`) and `Void::Sqlite` (`VL-011b`) when lightweight/bundled builds become available in minimal Nix toolchains, reducing VBS transport code further. | All `vbs_registry_tests` and `vbs_core_tests` pass on both minimal and full toolchains. |
|
||||
|
||||
---
|
||||
|
||||
+109
-34
@@ -611,34 +611,38 @@ Void::Result::Result<std::size_t, std::string> materialize_project_dependencies(
|
||||
|
||||
// Bounded build-serving request: resolves dependencies, lowers the project graph, and executes it
|
||||
// in-process against the daemon's warm StateStore.
|
||||
std::string build_project(const DaemonOptions &options, State::StateStore &state,
|
||||
std::string_view profile_name,
|
||||
std::optional<CompilerFamily> compiler_override,
|
||||
const std::vector<std::string> &selected_targets, std::size_t jobs,
|
||||
std::string_view selected_member) {
|
||||
auto effective_result = resolve_member_options(options, selected_member);
|
||||
if (!effective_result) {
|
||||
return error_response(std::format("build: {}", effective_result.error()));
|
||||
}
|
||||
const DaemonOptions &effective = *effective_result;
|
||||
const std::string member_name = Config::is_workspace_root(options.project_root)
|
||||
? std::string{selected_member}
|
||||
: std::string{};
|
||||
struct BuildOutcome {
|
||||
std::string profile;
|
||||
std::size_t targets{0};
|
||||
std::size_t actions{0};
|
||||
std::size_t dependencies{0};
|
||||
std::size_t executed{0};
|
||||
std::size_t cached{0};
|
||||
std::size_t failed{0};
|
||||
bool succeeded{false};
|
||||
std::string diagnostic;
|
||||
JsonValue::Array failed_actions;
|
||||
};
|
||||
|
||||
auto evaluated = evaluate_project_graph(effective, profile_name, compiler_override, "build");
|
||||
Void::Result::Result<BuildOutcome, std::string>
|
||||
execute_project_build(const DaemonOptions &options, State::StateStore &state,
|
||||
std::string_view profile_name,
|
||||
std::optional<CompilerFamily> compiler_override,
|
||||
const std::vector<std::string> &selected_targets, std::size_t jobs) {
|
||||
auto evaluated = evaluate_project_graph(options, profile_name, compiler_override, "build");
|
||||
if (!evaluated) {
|
||||
return error_response(evaluated.error());
|
||||
return std::unexpected{evaluated.error()};
|
||||
}
|
||||
|
||||
std::map<std::string, Graph::ImportedTargetInterface, std::less<>> imported_targets;
|
||||
auto materialized =
|
||||
materialize_project_dependencies(effective, state, *evaluated, jobs, imported_targets);
|
||||
materialize_project_dependencies(options, state, *evaluated, jobs, imported_targets);
|
||||
if (!materialized) {
|
||||
return error_response(materialized.error());
|
||||
return std::unexpected{materialized.error()};
|
||||
}
|
||||
auto graph = lower_graph(effective, *evaluated, std::move(imported_targets), "build");
|
||||
auto graph = lower_graph(options, *evaluated, std::move(imported_targets), "build");
|
||||
if (!graph) {
|
||||
return error_response(graph.error());
|
||||
return std::unexpected{graph.error()};
|
||||
}
|
||||
|
||||
Execution::ExecutionOptions exec_options;
|
||||
@@ -646,34 +650,105 @@ std::string build_project(const DaemonOptions &options, State::StateStore &state
|
||||
exec_options.selected_targets = selected_targets;
|
||||
auto report = Execution::execute_graph(*graph, state, exec_options);
|
||||
if (!report) {
|
||||
return error_response(std::format("build: {}", report.error().format()));
|
||||
return std::unexpected{std::format("build: {}", report.error().format())};
|
||||
}
|
||||
|
||||
JsonValue::Array failed_actions;
|
||||
BuildOutcome outcome;
|
||||
outcome.profile = evaluated->context.name;
|
||||
outcome.targets = graph->targets.size();
|
||||
outcome.actions = graph->actions.size();
|
||||
outcome.dependencies = *materialized;
|
||||
outcome.executed = report->executed_count;
|
||||
outcome.cached = report->cached_count;
|
||||
outcome.failed = report->failed_count;
|
||||
outcome.succeeded = report->succeeded;
|
||||
outcome.diagnostic = report->diagnostic;
|
||||
for (const auto &result : report->results) {
|
||||
if (!result.succeeded) {
|
||||
JsonValue::Object failure;
|
||||
failure.emplace("action", JsonValue{result.action_id});
|
||||
failure.emplace("target", JsonValue{result.target_name});
|
||||
failure.emplace("error", JsonValue{result.error_message});
|
||||
failed_actions.emplace_back(std::move(failure));
|
||||
outcome.failed_actions.emplace_back(std::move(failure));
|
||||
}
|
||||
}
|
||||
return outcome;
|
||||
}
|
||||
|
||||
JsonValue::Object build_outcome_json(const BuildOutcome &outcome) {
|
||||
JsonValue::Object object;
|
||||
object.emplace("ok", JsonValue{report->succeeded});
|
||||
object.emplace("profile", JsonValue{outcome.profile});
|
||||
object.emplace("targets", JsonValue{static_cast<std::int64_t>(outcome.targets)});
|
||||
object.emplace("actions", JsonValue{static_cast<std::int64_t>(outcome.actions)});
|
||||
object.emplace("dependencies", JsonValue{static_cast<std::int64_t>(outcome.dependencies)});
|
||||
object.emplace("executed", JsonValue{static_cast<std::int64_t>(outcome.executed)});
|
||||
object.emplace("cached", JsonValue{static_cast<std::int64_t>(outcome.cached)});
|
||||
object.emplace("failed", JsonValue{static_cast<std::int64_t>(outcome.failed)});
|
||||
object.emplace("diagnostic", JsonValue{outcome.diagnostic});
|
||||
object.emplace("failed_actions", JsonValue{outcome.failed_actions});
|
||||
return object;
|
||||
}
|
||||
|
||||
std::string build_project(const DaemonOptions &options, State::StateStore &state,
|
||||
std::string_view profile_name,
|
||||
std::optional<CompilerFamily> compiler_override,
|
||||
const std::vector<std::string> &selected_targets, std::size_t jobs,
|
||||
std::string_view selected_member) {
|
||||
const bool workspace = Config::is_workspace_root(options.project_root);
|
||||
|
||||
// Workspace-wide build: every member in declared order, sharing the root lock and CAS.
|
||||
if (workspace && selected_member.empty()) {
|
||||
auto members = evaluate_workspace_members(options);
|
||||
if (!members) {
|
||||
return error_response(members.error());
|
||||
}
|
||||
JsonValue::Array member_array;
|
||||
std::size_t executed = 0;
|
||||
std::size_t cached = 0;
|
||||
std::size_t failed = 0;
|
||||
bool all_ok = true;
|
||||
for (const auto &member : *members) {
|
||||
const auto member_opts = member_options(options, member.path);
|
||||
auto outcome = execute_project_build(member_opts, state, profile_name,
|
||||
compiler_override, selected_targets, jobs);
|
||||
if (!outcome) {
|
||||
return error_response(
|
||||
std::format("build: member '{}': {}", member.name, outcome.error()));
|
||||
}
|
||||
JsonValue::Object entry = build_outcome_json(*outcome);
|
||||
entry.emplace("name", JsonValue{member.name});
|
||||
entry.emplace("ok", JsonValue{outcome->succeeded});
|
||||
member_array.emplace_back(std::move(entry));
|
||||
executed += outcome->executed;
|
||||
cached += outcome->cached;
|
||||
failed += outcome->failed;
|
||||
all_ok = all_ok && outcome->succeeded;
|
||||
}
|
||||
JsonValue::Object object;
|
||||
object.emplace("ok", JsonValue{all_ok});
|
||||
object.emplace("op", JsonValue{std::string{"build"}});
|
||||
object.emplace("workspace", JsonValue{true});
|
||||
object.emplace("members", JsonValue{std::move(member_array)});
|
||||
object.emplace("executed", JsonValue{static_cast<std::int64_t>(executed)});
|
||||
object.emplace("cached", JsonValue{static_cast<std::int64_t>(cached)});
|
||||
object.emplace("failed", JsonValue{static_cast<std::int64_t>(failed)});
|
||||
return serialize_response(JsonValue{std::move(object)});
|
||||
}
|
||||
|
||||
auto effective_result = resolve_member_options(options, selected_member);
|
||||
if (!effective_result) {
|
||||
return error_response(std::format("build: {}", effective_result.error()));
|
||||
}
|
||||
auto outcome = execute_project_build(*effective_result, state, profile_name, compiler_override,
|
||||
selected_targets, jobs);
|
||||
if (!outcome) {
|
||||
return error_response(outcome.error());
|
||||
}
|
||||
JsonValue::Object object = build_outcome_json(*outcome);
|
||||
object.emplace("ok", JsonValue{outcome->succeeded});
|
||||
object.emplace("op", JsonValue{std::string{"build"}});
|
||||
object.emplace("profile", JsonValue{evaluated->context.name});
|
||||
object.emplace("targets", JsonValue{static_cast<std::int64_t>(graph->targets.size())});
|
||||
object.emplace("actions", JsonValue{static_cast<std::int64_t>(graph->actions.size())});
|
||||
object.emplace("dependencies", JsonValue{static_cast<std::int64_t>(*materialized)});
|
||||
object.emplace("executed", JsonValue{static_cast<std::int64_t>(report->executed_count)});
|
||||
object.emplace("cached", JsonValue{static_cast<std::int64_t>(report->cached_count)});
|
||||
object.emplace("failed", JsonValue{static_cast<std::int64_t>(report->failed_count)});
|
||||
object.emplace("diagnostic", JsonValue{report->diagnostic});
|
||||
object.emplace("failed_actions", JsonValue{std::move(failed_actions)});
|
||||
if (!member_name.empty()) {
|
||||
object.emplace("member", JsonValue{member_name});
|
||||
if (workspace) {
|
||||
object.emplace("member", JsonValue{std::string{selected_member}});
|
||||
}
|
||||
return serialize_response(JsonValue{std::move(object)});
|
||||
}
|
||||
|
||||
@@ -836,10 +836,12 @@ void build(Void::Build::Project &project) {
|
||||
Void::Testing::expect(describe_raw->find("\"name\":\"lib\"") != std::string::npos);
|
||||
Void::Testing::expect(describe_raw->find("\"name\":\"app\"") != std::string::npos);
|
||||
|
||||
auto no_member = request_object(socket, R"({"op":"build"})", std::chrono::seconds{120});
|
||||
Void::Testing::require(no_member.has_value());
|
||||
Void::Testing::expect(!bool_field(*no_member, "ok", true));
|
||||
Void::Testing::expect(str_field(*no_member, "error").find("member") != std::string::npos);
|
||||
auto workspace_build =
|
||||
Void::Build::Daemon::request(socket, R"({"op":"build"})", std::chrono::seconds{120});
|
||||
Void::Testing::require(workspace_build.has_value());
|
||||
Void::Testing::expect(workspace_build->find("\"workspace\":true") != std::string::npos);
|
||||
Void::Testing::expect(workspace_build->find("\"name\":\"lib\"") != std::string::npos);
|
||||
Void::Testing::expect(workspace_build->find("\"name\":\"app\"") != std::string::npos);
|
||||
|
||||
auto build_raw = Void::Build::Daemon::request(socket, R"({"op":"build","member":"app"})",
|
||||
std::chrono::seconds{120});
|
||||
|
||||
Reference in new issue
Block a user