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

+39
View File
@@ -2,6 +2,7 @@
#include <Void/Build/Util/Json.hpp>
#include <algorithm>
#include <cstdlib>
#include <set>
#include <type_traits>
@@ -1064,6 +1065,44 @@ Dependency Project::dependency(std::string name) {
state_->dependencies.push_back(std::move(record));
return Dependency{state_, state_->dependencies.size() - 1};
}
Dependency Project::workspace_dependency(std::string name) {
auto dep = dependency(name);
auto &record = state_->dependencies.back();
const std::string env_name = "VBS_WORKSPACE_MEMBER_" + record.name;
const char *member_path = std::getenv(env_name.c_str());
if (!member_path || member_path[0] == '\0') {
throw std::invalid_argument{"workspace member '" + record.name +
"' is not provided by the enclosing workspace"};
}
record.source_kind = DependencySourceKind::Path;
record.location = member_path;
record.builder = "native";
record.options.insert_or_assign("vbs.workspace.member", OptionValue{record.name});
return dep;
}
Workspace &Workspace::member(std::string name, std::string path) {
require_text(name, "workspace member name");
require_text(path, "workspace member path");
if (std::ranges::any_of(members_, [&](const auto &member) { return member.name == name; })) {
throw std::invalid_argument{"duplicate workspace member '" + name + "'"};
}
members_.push_back({std::move(name), std::move(path)});
return *this;
}
const std::vector<WorkspaceMemberRecord> &Workspace::members() const noexcept { return members_; }
std::string Workspace::to_json() const {
return "{\"schema_version\":1,\"members\":" +
json_array(members_,
[](const WorkspaceMemberRecord &member) {
return "{\"name\":" + json_quote(member.name) +
",\"path\":" + json_quote(member.path) + '}';
}) +
'}';
}
void Project::dependencies_file(std::string toml_path) {
require_text(toml_path, "dependencies manifest path");
state_->dependency_files.push_back(std::move(toml_path));