feat(daemon): report per-target metadata on request
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 3s
VoidBuildSystem CI / signing-openssl-gcc16 (push) Failing after 55s

This commit is contained in:
faumaray committed 2026-12-04 02:24:22 +03:00
1 parent cf06b427b7
commit 3a3376c331
8 files changed
+154 -3

No files matched your search

+20
View File
@@ -1478,6 +1478,7 @@ struct DaemonCmdOptions {
std::string editor_arg{"all"};
std::optional<std::string> member_arg;
std::string graph_format_arg{"dot"};
std::optional<std::string> target_arg;
std::optional<std::string> file_filter_arg;
std::string limit_arg{"50"};
std::string timeout_ms_arg{"2000"};
@@ -1565,6 +1566,14 @@ int execute_daemon_command(std::string_view sub, const DaemonCmdOptions &opts) {
request_json = std::format(R"({{"op":"graph","profile":{},"format":{}}})",
Util::json_quote(opts.profile_arg),
Util::json_quote(opts.graph_format_arg));
} else if (sub == "target_info") {
if (!opts.target_arg || opts.target_arg->empty()) {
std::cerr << "vbs daemon target: --name must not be empty\n";
return 2;
}
request_json =
std::format(R"({{"op":"target_info","profile":{},"target":{}}})",
Util::json_quote(opts.profile_arg), Util::json_quote(*opts.target_arg));
} else if (sub == "info") {
request_json = R"({"op":"info"})";
} else if (sub == "clean") {
@@ -2704,6 +2713,14 @@ int main(int argc, char **argv) {
.option_default("--profile", "-p", "Profile to resolve", daemon_opts.profile_arg, "debug")
.option("--member", "", "Workspace member (required for workspace roots)",
daemon_opts.member_arg);
auto &daemon_target_cmd =
daemon_cmd.subcommand("target", "Target metadata served by the daemon");
auto &daemon_target_info_cmd = daemon_target_cmd.subcommand(
"info", "Report one target's kind, sources, outputs, and runtime libraries");
configure_daemon_common(daemon_target_info_cmd);
daemon_target_info_cmd
.option_default("--profile", "-p", "Profile to evaluate", daemon_opts.profile_arg, "debug")
.option("--name", "-n", "Target name", daemon_opts.target_arg);
auto &daemon_workspace_cmd =
daemon_cmd.subcommand("workspace", "Workspace metadata served by the daemon");
auto &daemon_workspace_members_cmd =
@@ -2880,6 +2897,9 @@ int main(int argc, char **argv) {
} else if (daemon_sub == "compdb" && parsed.matched_command_path.size() > 2 &&
parsed.matched_command_path[2] == "generations") {
daemon_sub = "compdb_generations";
} else if (daemon_sub == "target" && parsed.matched_command_path.size() > 2 &&
parsed.matched_command_path[2] == "info") {
daemon_sub = "target_info";
}
return execute_daemon_command(daemon_sub, daemon_opts);
}