feat(workspace): add multi-package workspace builds with shared lock and CAS
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 4s

- 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
This commit is contained in:
faumaray committed 2026-12-03 13:07:09 +03:00
1 parent 09c0a91d1d
commit 2970fbe25c
12 files changed
+515 -19

No files matched your search

+22
View File
@@ -221,6 +221,24 @@ struct DependencyRecord {
bool build_dependency{false};
};
// Workspace declaration (E2): a root workspace.cpp lists member projects that share one
// vbs.lock and one build/.vbs CAS while each keeps its own build.cpp and profile outputs.
struct WorkspaceMemberRecord {
std::string name;
std::string path; // Relative to the workspace root (or absolute).
};
class Workspace {
public:
Workspace() = default;
Workspace &member(std::string name, std::string path);
[[nodiscard]] const std::vector<WorkspaceMemberRecord> &members() const noexcept;
[[nodiscard]] std::string to_json() const;
private:
std::vector<WorkspaceMemberRecord> members_;
};
namespace detail {
struct ProjectState;
}
@@ -319,6 +337,9 @@ class Project {
[[nodiscard]] Target custom_action(std::string name);
[[nodiscard]] Target test(std::string name);
[[nodiscard]] Dependency dependency(std::string name);
// Links to another member of the enclosing workspace. The member path is supplied by the
// workspace driver through VBS_WORKSPACE_MEMBER_<name> and built with the native provider.
[[nodiscard]] Dependency workspace_dependency(std::string name);
void dependencies_file(std::string toml_path = "vbs.deps.toml");
void install_file(std::string source_path, std::string destination,
std::string component = "default");
@@ -342,3 +363,4 @@ class Project {
// Description entry points supplied by ordinary user C++ translation units.
void build(Void::Build::Project &project);
void profiles(Void::Build::Profiles &profiles);
void workspace(Void::Build::Workspace &workspace);
+17
View File
@@ -34,6 +34,19 @@ struct CompiledDescriptor {
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.
@@ -57,4 +70,8 @@ discover_profiles(const CompiledDescriptor &descriptor, const FrontendOptions &o
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