feat(daemon): serve IDE workspace and compdb metadata over the Unix socket
This commit is contained in:
1 parent
e97f3905e5
commit
118c0dc860
9 files changed
+152
-8
No files matched your search
@@ -105,7 +105,7 @@ All CLI help text (`vbs --help`, `vbs <command> --help`, `vbs compdb --help`, `v
|
||||
- `vbs publish --registry URL --name PKG --version X.Y.Z [--project DIR] [--description TEXT] [--token-env VAR] [--private]`
|
||||
- `vbs bridge --request FILE --output FILE` (backend for [cmake/bridge/VbsDeps.cmake](cmake/bridge/VbsDeps.cmake))
|
||||
- `vbs gc [--build-dir DIR] [--max-bytes N]`
|
||||
- `vbs daemon run|status|stop|gc|recover [--project DIR] [--build-dir DIR] [--socket PATH]` (Unix-socket daemon holding a warm state store and project watcher; `run` serves in the foreground, the rest are client requests)
|
||||
- `vbs daemon run|status|stop|gc|recover|describe|build|ide query [--project DIR] [--build-dir DIR] [--socket PATH]` (Unix-socket daemon holding a warm state store and project watcher; `run` serves in the foreground, the rest are client requests)
|
||||
- `vbs gen-tests --input FILE --output-dir DIR`
|
||||
- `vbs-registry --data-dir DIR --web-root DIR [--bind ADDR] [--port PORT] ...`
|
||||
|
||||
|
||||
@@ -101,9 +101,13 @@ Stage: VERIFIED — Plans 01–19 + Plan 20 Slices 1–2C + Track A + Track B (B
|
||||
- Added generic Ed25519 message primitives (`sign_message`/`verify_message`) in `Provenance::Signing`, optional `signature`/`public_key` on `BinaryVariantMeta`, the canonical `vbs-binary-v1` message and `verify_trusted_binary_signature` trust policy, and `select_compatible_signed_binary`: it selects the first ABI-compatible variant and, when trusted keys are supplied, fails closed on unsigned, untrusted, or invalid variants. With no trusted keys it matches `select_compatible_binary`.
|
||||
- `SignatureEnforcement` now covers binary-variant policy and signed selection (7 cases). Binary-variant distribution/download remains future work; this is the verification layer used by it.
|
||||
|
||||
- **Wave 21 (Track E3 Daemon-Backed Editor Metadata)**:
|
||||
- Added the `ide_query` daemon request (`vbs daemon ide query`): it evaluates/lowers the project graph, publishes the profile compilation database (selecting it when no editor selection exists), and returns the IDE metadata JSON (`schema_version`, project/build roots, profile identity, toolchain, compdb path, and per-target sources/outputs) wrapped with `ok`/`op`/`compdb`. The response flattens the query's trailing newline so the socket protocol stays one JSON object per line.
|
||||
- Added `Daemon.ide_query_serves_workspace_targets_and_compdb` (compdb exists on disk, schema/profile/app target present) and a CLI help contract; Daemon suite is now 9 cases.
|
||||
|
||||
## 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, the #52 built-in-backend capability probe, and the VoidLibrary pin bump to `0002e74` done; binary-variant distribution remains), Track E3 (daemon core, bounded `describe`, build-serving, and dependency materialization done; external editor plugins remain), and Track E4 (`Void::Net`/`Void::Sqlite` alignment) remain planned 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, the #52 built-in-backend capability probe, and the VoidLibrary pin bump to `0002e74` done; binary-variant distribution remains), Track E3 (daemon core, bounded `describe`, build-serving, dependency materialization, and daemon-backed IDE metadata done; dedicated external editor extensions remain), and Track E4 (`Void::Net`/`Void::Sqlite` alignment) remain planned scope.
|
||||
|
||||
## Environment notes & upstream boundaries
|
||||
|
||||
|
||||
@@ -27,4 +27,5 @@ Base HEAD: `fe0d1a6`
|
||||
| Wave 18 (Track E3 daemon dependency materialization) | Extracted `Package::resolve_and_materialize_dependencies` (`Resolver.hpp/.cpp`) from the CLI; daemon `build` now merges TOML deps, resolves/materializes with the pinned lock, imports provider targets, lowers with imported interfaces, and reports `dependencies` | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Daemon 8/8, full CTest 8/8) | `include/Void/Build/Package/Resolver.hpp`, `src/Package/Resolver.cpp`, `src/Main.cpp`, `src/Daemon/Daemon.cpp`, `tests/DaemonTests.cpp`, build lists, docs |
|
||||
| Wave 19 (Track D3 trusted-key distribution) | `Provenance::load_trusted_keys` over `--trusted-key-file`, project `vbs.keys`, and `VBS_TRUSTED_PUBLIC_KEYS`; 64-hex validation/lowercasing/dedup with `file:line` errors; wired into CLI builds and daemon dependency resolution | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; SignatureEnforcement 5/5, Daemon 8/8, full CTest 8/8) | `include/Void/Build/Provenance/TrustedKeys.hpp`, `src/Provenance/TrustedKeys.cpp`, `src/Main.cpp`, `src/Daemon/Daemon.cpp`, `tests/SignatureEnforcementTests.cpp`, build lists, docs |
|
||||
| Wave 20 (Track D3 binary-variant signing) | `sign_message`/`verify_message`, `BinaryVariantMeta` signature fields, canonical `vbs-binary-v1` message + trusted-key policy, `select_compatible_signed_binary` fail-closed selection | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; SignatureEnforcement 7/7, full CTest 8/8) | `include/Void/Build/Provenance/{Signing,Verification}.hpp`, `src/Provenance/{Signing,Verification}.cpp`, `include/Void/Build/Package/{Solver,Fetch}.hpp`, `src/Package/Fetch.cpp`, `tests/SignatureEnforcementTests.cpp`, docs |
|
||||
| Future (Plan 20 Slice 3 / Tracks C, D3 binary distribution, E3 editor plugins, 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) |
|
||||
| Wave 21 (Track E3 daemon-backed editor metadata) | `ide_query` daemon request + `vbs daemon ide query` CLI: lowers the graph, publishes/selects the profile compdb, returns IDE query JSON (workspace/targets/compdb) over the socket | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Daemon 9/9, full CTest 8/8) | `src/Daemon/Daemon.cpp`, `src/Main.cpp`, `tests/DaemonTests.cpp`, `tests/CliContracts.cmake`, docs |
|
||||
| Future (Plan 20 Slice 3 / Tracks C, D3 binary distribution, 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) |
|
||||
@@ -403,6 +403,22 @@ dev cpp-gcc -c ctest --test-dir build/pinned --output-on-failure
|
||||
- Full CTest: **8 / 8 passed** in 195.08 s.
|
||||
- `clang-format --dry-run --Werror` passes on all changed C++ files.
|
||||
|
||||
## Track E3 Daemon-Backed Editor Metadata (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: **9 / 9 passed** in 15.66 s, including
|
||||
`ide_query_serves_workspace_targets_and_compdb`: the daemon lowers the graph, publishes and
|
||||
selects the profile compilation database, and returns `ok`/`op=ide_query` plus the IDE query JSON
|
||||
(`schema_version=1`, `profile=debug`, target `app`, and an existing `compdb` path).
|
||||
- Full CTest: **8 / 8 passed** in 207.44 s; `vbs_cli_contract` re-run separately after adding the
|
||||
`vbs daemon ide query --help` contract: **passed** (7.45 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`. 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. 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. |
|
||||
|
||||
---
|
||||
|
||||
+47
-1
@@ -3,6 +3,7 @@
|
||||
#include <Void/Build.hpp>
|
||||
#include <Void/Build/BootstrapConfig.hpp>
|
||||
#include <Void/Build/Config/Frontend.hpp>
|
||||
#include <Void/Build/Editor/CompDb.hpp>
|
||||
#include <Void/Build/Execution/Scheduler.hpp>
|
||||
#include <Void/Build/Graph/Graph.hpp>
|
||||
#include <Void/Build/Package/Lockfile.hpp>
|
||||
@@ -12,6 +13,7 @@
|
||||
#include <Void/Build/Provider/Provider.hpp>
|
||||
#include <Void/Build/State/StateStore.hpp>
|
||||
#include <Void/Build/Toolchain/Driver.hpp>
|
||||
#include <Void/Build/Util/Json.hpp>
|
||||
#include <Void/Build/Watch/Watcher.hpp>
|
||||
#include <Void/Configuration/Env.hpp>
|
||||
#include <Void/Data/StrictJson.hpp>
|
||||
@@ -557,6 +559,47 @@ std::string build_project(const DaemonOptions &options, State::StateStore &state
|
||||
return serialize_response(JsonValue{std::move(object)});
|
||||
}
|
||||
|
||||
// Publishes the profile compilation database and returns the IDE query metadata JSON.
|
||||
std::string ide_query_project(const DaemonOptions &options, std::string_view profile_name,
|
||||
std::optional<CompilerFamily> compiler_override) {
|
||||
auto evaluated = evaluate_project_graph(options, profile_name, compiler_override, "ide_query");
|
||||
if (!evaluated) {
|
||||
return error_response(evaluated.error());
|
||||
}
|
||||
auto graph = lower_graph(options, *evaluated, {}, "ide_query");
|
||||
if (!graph) {
|
||||
return error_response(graph.error());
|
||||
}
|
||||
|
||||
const auto frontend = make_frontend_options(options);
|
||||
const auto existing_selection =
|
||||
Editor::read_selection_state(options.project_root).value_or(std::nullopt);
|
||||
|
||||
Editor::PublishOptions publish;
|
||||
publish.project_root = options.project_root;
|
||||
publish.build_root = options.build_root;
|
||||
publish.update_selection = !existing_selection.has_value();
|
||||
publish.sdk_include_dir = frontend.sdk_include_dir;
|
||||
auto published = Editor::publish_profile_compdb(*graph, publish);
|
||||
if (!published) {
|
||||
return error_response(std::format("ide_query: {}", published.error().format()));
|
||||
}
|
||||
|
||||
std::error_code ec;
|
||||
const auto root_compdb = options.build_root / "compile_commands.json";
|
||||
const auto compdb_path =
|
||||
std::filesystem::exists(root_compdb, ec) ? root_compdb : published->compdb_path;
|
||||
std::string query =
|
||||
Editor::format_ide_query_json(*graph, compdb_path, frontend.sdk_include_dir);
|
||||
// The socket protocol is one JSON object per line: the embedded query must not contain
|
||||
// newlines before the final response terminator.
|
||||
while (!query.empty() && (query.back() == '\n' || query.back() == '\r')) {
|
||||
query.pop_back();
|
||||
}
|
||||
return "{\"ok\":true,\"op\":\"ide_query\",\"compdb\":" +
|
||||
Util::json_quote(compdb_path.string()) + ",\"query\":" + query + '}';
|
||||
}
|
||||
|
||||
// Lowers the project graph to a bounded summary without executing it.
|
||||
std::string describe_project(const DaemonOptions &options, std::string_view profile_name,
|
||||
std::optional<CompilerFamily> compiler_override) {
|
||||
@@ -713,7 +756,7 @@ DaemonServer::Impl::DispatchResult DaemonServer::Impl::dispatch(std::string_view
|
||||
if (*name == "status") {
|
||||
return {status_response(), false};
|
||||
}
|
||||
if (*name == "describe" || *name == "build") {
|
||||
if (*name == "describe" || *name == "build" || *name == "ide_query") {
|
||||
std::string profile_name{"debug"};
|
||||
if (const auto entry = object->find("profile"); entry != object->end()) {
|
||||
const auto *value = std::get_if<std::string>(&entry->second.value);
|
||||
@@ -743,6 +786,9 @@ DaemonServer::Impl::DispatchResult DaemonServer::Impl::dispatch(std::string_view
|
||||
if (*name == "describe") {
|
||||
return {describe_project(options, profile_name, compiler_override), false};
|
||||
}
|
||||
if (*name == "ide_query") {
|
||||
return {ide_query_project(options, profile_name, compiler_override), false};
|
||||
}
|
||||
|
||||
std::vector<std::string> selected_targets;
|
||||
if (const auto entry = object->find("targets"); entry != object->end()) {
|
||||
|
||||
+23
-3
@@ -1443,6 +1443,13 @@ int execute_daemon_command(std::string_view sub, const DaemonCmdOptions &opts) {
|
||||
}
|
||||
request_json =
|
||||
std::format(R"({{"op":"describe","profile":{}}})", Util::json_quote(opts.profile_arg));
|
||||
} else if (sub == "ide_query") {
|
||||
if (opts.profile_arg.empty()) {
|
||||
std::cerr << "vbs daemon ide query: --profile must not be empty\n";
|
||||
return 2;
|
||||
}
|
||||
request_json =
|
||||
std::format(R"({{"op":"ide_query","profile":{}}})", Util::json_quote(opts.profile_arg));
|
||||
} else if (sub == "build") {
|
||||
std::size_t jobs = 0;
|
||||
const auto [ptr, ec] = std::from_chars(opts.jobs_arg.data(),
|
||||
@@ -1467,8 +1474,9 @@ int execute_daemon_command(std::string_view sub, const DaemonCmdOptions &opts) {
|
||||
// Describe evaluates the whole project graph (descriptor compile, toolchain probe, lowering),
|
||||
// which can exceed the 2 s default; the daemon bounds evaluation at 10 s.
|
||||
const auto request_timeout = sub == "build" ? std::chrono::milliseconds{std::chrono::hours{1}}
|
||||
: sub == "describe" ? std::chrono::milliseconds{15000}
|
||||
: std::chrono::milliseconds{2000};
|
||||
: sub == "describe" ? std::chrono::milliseconds{15000}
|
||||
: sub == "ide_query" ? std::chrono::milliseconds{30000}
|
||||
: std::chrono::milliseconds{2000};
|
||||
auto response = Daemon::request(socket_path, request_json, request_timeout);
|
||||
if (!response) {
|
||||
std::cerr << "vbs daemon: " << response.error().message() << '\n';
|
||||
@@ -2411,6 +2419,13 @@ int main(int argc, char **argv) {
|
||||
.option_many("--target", "-t", "Target to build", daemon_opts.targets)
|
||||
.option_default("--jobs", "-j", "Maximum parallel jobs (0 = hardware concurrency)",
|
||||
daemon_opts.jobs_arg, "0");
|
||||
auto &daemon_ide_cmd = daemon_cmd.subcommand("ide", "Editor/IDE metadata served by the daemon");
|
||||
configure_daemon_common(daemon_ide_cmd);
|
||||
auto &daemon_ide_query_cmd =
|
||||
daemon_ide_cmd.subcommand("query", "Emit IDE workspace/target/compdb metadata JSON");
|
||||
configure_daemon_common(daemon_ide_query_cmd);
|
||||
daemon_ide_query_cmd.option_default("--profile", "-p", "Profile to query",
|
||||
daemon_opts.profile_arg, "debug");
|
||||
|
||||
const auto parsed = root.parse_detailed(argc, argv);
|
||||
if (parsed.is_help()) {
|
||||
@@ -2503,7 +2518,12 @@ int main(int argc, char **argv) {
|
||||
return execute_ide_command(parsed.matched_command_path.at(1), ide_opts);
|
||||
}
|
||||
if (cmd == "daemon") {
|
||||
return execute_daemon_command(parsed.matched_command_path.at(1), daemon_opts);
|
||||
std::string daemon_sub = parsed.matched_command_path.at(1);
|
||||
if (daemon_sub == "ide" && parsed.matched_command_path.size() > 2 &&
|
||||
parsed.matched_command_path[2] == "query") {
|
||||
daemon_sub = "ide_query";
|
||||
}
|
||||
return execute_daemon_command(daemon_sub, daemon_opts);
|
||||
}
|
||||
|
||||
std::cerr << "vbs: unhandled subcommand '" << cmd << "'\n";
|
||||
|
||||
@@ -49,6 +49,7 @@ check_process(0 "Usage: vbs daemon <command>.*Commands:.*run.*status.*stop.*reco
|
||||
check_process(0 "Usage: vbs daemon run " "" daemon run --help)
|
||||
check_process(0 "Usage: vbs daemon describe .*--profile" "" daemon describe --help)
|
||||
check_process(0 "Usage: vbs daemon build .*--profile.*--target.*--jobs" "" daemon build --help)
|
||||
check_process(0 "Usage: vbs daemon ide query .*--profile" "" daemon ide query --help)
|
||||
check_process(2 "" "missing subcommand for 'vbs daemon'" daemon)
|
||||
|
||||
# Daemon-backed describe contract: start `vbs daemon run`, query the bounded graph summary over
|
||||
|
||||
@@ -435,6 +435,62 @@ void build(Void::Build::Project &project) {
|
||||
Void::Testing::expect(run_result.has_value());
|
||||
}
|
||||
|
||||
VOID_TEST(Daemon, ide_query_serves_workspace_targets_and_compdb) {
|
||||
auto temp = Void::FileSystem::TempDir::open("vbs_daemon_");
|
||||
Void::Testing::require(temp.has_value());
|
||||
const auto options = make_options(temp->path());
|
||||
|
||||
{
|
||||
std::ofstream descriptor{options.project_root / "build.cpp"};
|
||||
descriptor << R"cpp(#include <Void/Build.hpp>
|
||||
|
||||
void build(Void::Build::Project &project) {
|
||||
auto app = project.executable("app");
|
||||
app.sources({"main.cpp"});
|
||||
}
|
||||
)cpp";
|
||||
Void::Testing::require(descriptor.good());
|
||||
}
|
||||
{
|
||||
std::ofstream source{options.project_root / "main.cpp"};
|
||||
source << "int main() { return 0; }\n";
|
||||
Void::Testing::require(source.good());
|
||||
}
|
||||
|
||||
auto server = Void::Build::Daemon::DaemonServer::create(options);
|
||||
Void::Testing::require(server.has_value());
|
||||
const auto socket = server->socket_path();
|
||||
|
||||
Void::Result::Result<void, Void::Result::Error> run_result;
|
||||
std::jthread worker{[&] { run_result = server->run(); }};
|
||||
Void::Testing::require(wait_for_path(socket, std::chrono::seconds{5}));
|
||||
|
||||
auto raw =
|
||||
Void::Build::Daemon::request(socket, R"({"op":"ide_query"})", std::chrono::seconds{120});
|
||||
auto shutdown = Void::Build::Daemon::request(socket, R"({"op":"shutdown"})");
|
||||
Void::Testing::expect(shutdown.has_value());
|
||||
worker.join();
|
||||
Void::Testing::expect(run_result.has_value());
|
||||
Void::Testing::require(raw.has_value());
|
||||
const auto parsed = parse_json(*raw);
|
||||
Void::Testing::require(parsed.has_value());
|
||||
const auto *object = as_object(*parsed);
|
||||
Void::Testing::require(object != nullptr);
|
||||
Void::Testing::expect(bool_field(*object, "ok"));
|
||||
Void::Testing::expect_eq(str_field(*object, "op"), std::string{"ide_query"});
|
||||
const std::string compdb = str_field(*object, "compdb");
|
||||
Void::Testing::expect(!compdb.empty());
|
||||
Void::Testing::expect(std::filesystem::exists(compdb));
|
||||
|
||||
const auto *query = field(*object, "query");
|
||||
Void::Testing::require(query != nullptr);
|
||||
const auto *query_object = as_object(*query);
|
||||
Void::Testing::require(query_object != nullptr);
|
||||
Void::Testing::expect_eq(int_field(*query_object, "schema_version"), std::int64_t{1});
|
||||
Void::Testing::expect_eq(str_field(*query_object, "profile"), std::string{"debug"});
|
||||
Void::Testing::expect(raw->find("\"name\":\"app\"") != std::string::npos);
|
||||
}
|
||||
|
||||
VOID_TEST(Daemon, describe_empty_project_reports_zero_targets) {
|
||||
auto temp = Void::FileSystem::TempDir::open("vbs_daemon_");
|
||||
Void::Testing::require(temp.has_value());
|
||||
|
||||
Reference in new issue
Block a user