Files
Build-System/include/Void/Build/Config/Frontend.hpp
T
faumaray 2970fbe25c
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 4s
feat(workspace): add multi-package workspace builds with shared lock and CAS
- SDK: Workspace/workspace() declaration plus Project::workspace_dependency()
- Frontend: workspace.cpp discovery/evaluation alongside build.cpp
- Main: per-member builds sharing the root vbs.lock and build/.vbs CAS, --member and --changed-since selection
- Cross-member native linking; member builds do not steal the root compile_commands.json alias
- Path-dependency snapshots exclude generated editor metadata
- Verified in Docker GCC 16: 8/8 CTest suites; 3-member workspace fixture with unified lockfile
2026-12-03 13:07:09 +03:00

78 lines
3.2 KiB
C++

#pragma once
#include <Void/Build.hpp>
#include <Void/Build/Graph/Graph.hpp>
#include <Void/Functional/Error.hpp>
#include <Void/Functional/Result.hpp>
#include <chrono>
#include <filesystem>
#include <optional>
#include <string>
#include <vector>
namespace Void::Build::Config {
inline constexpr int kFrontendProtocolVersion = 1;
struct FrontendOptions {
std::filesystem::path project_root;
std::filesystem::path build_root;
std::filesystem::path sdk_include_dir;
std::filesystem::path sdk_library_path; // Optional prebuilt libVoidBuild_Sdk.a
std::filesystem::path sdk_source_dir; // Fallback source dir if sdk_library_path absent
std::vector<std::filesystem::path> extra_build_sources; // Explicit --build-source inputs
std::optional<std::filesystem::path> host_compiler;
std::chrono::milliseconds eval_timeout{std::chrono::seconds{30}};
};
struct CompiledDescriptor {
std::filesystem::path executable_path;
std::string seed_identity_hash;
std::vector<std::filesystem::path> config_sources;
std::vector<std::filesystem::path> discovered_headers;
bool recompiled{false};
};
struct WorkspaceMember {
std::string name;
std::string path;
};
struct WorkspaceDescription {
int schema_version{1};
std::vector<WorkspaceMember> members;
};
// True when project_root contains workspace.cpp (a multi-member workspace root).
[[nodiscard]] bool is_workspace_root(const std::filesystem::path &project_root);
// Discovers configuration C++ sources purely from filesystem membership (works without .git!):
// build.cpp, optional build.profiles.cpp, sorted build-support/**/*.cpp, and explicit extra
// sources.
[[nodiscard]] Void::Result::Result<std::vector<std::filesystem::path>, Void::Result::Error>
discover_config_sources(const std::filesystem::path &project_root,
const std::vector<std::filesystem::path> &extra_build_sources = {});
// Compiles (or reuses cached valid) host configuration descriptor executable against
// the fixed Void::Build SDK without invoking CMake or resolving project packages.
[[nodiscard]] Void::Result::Result<CompiledDescriptor, Void::Result::Error>
compile_descriptor(const FrontendOptions &options);
// Invokes the compiled descriptor in profile-discovery mode, returning declared Profiles
// (or default debug/release profiles if build.profiles.cpp is absent).
[[nodiscard]] Void::Result::Result<Profiles, Void::Result::Error>
discover_profiles(const CompiledDescriptor &descriptor, const FrontendOptions &options);
// Evaluates build(Project&) out-of-process for a single resolved ProfileContext using a
// dedicated bounded result file (logs on stdout/stderr cannot corrupt protocol results).
[[nodiscard]] Void::Result::Result<Graph::ProjectDescription, Void::Result::Error>
evaluate_project(const CompiledDescriptor &descriptor, const ProfileContext &context,
const FrontendOptions &options);
// Evaluates workspace(Workspace&) from a workspace.cpp descriptor and returns its members.
[[nodiscard]] Void::Result::Result<WorkspaceDescription, Void::Result::Error>
evaluate_workspace(const CompiledDescriptor &descriptor, const FrontendOptions &options);
} // namespace Void::Build::Config