feat(profiles): per-dependency overrides, toolchain pin and profile CLI (G3)
VoidBuildSystem CI / 1 · Requirements (push) Successful in 5s
VoidBuildSystem CI / 2A · Linux build (debug) (push) Successful in 2m50s
VoidBuildSystem CI / 2A · Linux build (coverage) (push) Successful in 3m29s
VoidBuildSystem CI / 2A · Linux build (sanitizers) (push) Successful in 4m7s
VoidBuildSystem CI / 2B · Windows Wine build (debug) (push) Successful in 1m53s
VoidBuildSystem CI / 2A · Linux build (relwithdebinfo) (push) Successful in 4m22s
VoidBuildSystem CI / 2B · Windows Wine build (relwithdebinfo) (push) Successful in 3m22s
VoidBuildSystem CI / 3A · Linux test (coverage) (push) Failing after 1m57s
VoidBuildSystem CI / 3A · Linux test (sanitizers) (push) Successful in 2m0s
VoidBuildSystem CI / 3B · Windows Wine test (debug) (push) Successful in 19s
VoidBuildSystem CI / 3B · Windows Wine test (relwithdebinfo) (push) Successful in 18s
VoidBuildSystem CI / 3A · Linux test (relwithdebinfo) (push) Failing after 7m8s
VoidBuildSystem CI / 3A · Linux test (debug) (push) Failing after 7m24s
VoidBuildSystem CI / 4A2 · VBS installers (linux target) (push) Skipped
VoidBuildSystem CI / 4A2 · VBS installers (windows target) (push) Skipped
VoidBuildSystem CI / 5 · Release (push) Skipped
VoidBuildSystem CI / 1 · Requirements (push) Successful in 5s
VoidBuildSystem CI / 2A · Linux build (debug) (push) Successful in 2m50s
VoidBuildSystem CI / 2A · Linux build (coverage) (push) Successful in 3m29s
VoidBuildSystem CI / 2A · Linux build (sanitizers) (push) Successful in 4m7s
VoidBuildSystem CI / 2B · Windows Wine build (debug) (push) Successful in 1m53s
VoidBuildSystem CI / 2A · Linux build (relwithdebinfo) (push) Successful in 4m22s
VoidBuildSystem CI / 2B · Windows Wine build (relwithdebinfo) (push) Successful in 3m22s
VoidBuildSystem CI / 3A · Linux test (coverage) (push) Failing after 1m57s
VoidBuildSystem CI / 3A · Linux test (sanitizers) (push) Successful in 2m0s
VoidBuildSystem CI / 3B · Windows Wine test (debug) (push) Successful in 19s
VoidBuildSystem CI / 3B · Windows Wine test (relwithdebinfo) (push) Successful in 18s
VoidBuildSystem CI / 3A · Linux test (relwithdebinfo) (push) Failing after 7m8s
VoidBuildSystem CI / 3A · Linux test (debug) (push) Failing after 7m24s
VoidBuildSystem CI / 4A2 · VBS installers (linux target) (push) Skipped
VoidBuildSystem CI / 4A2 · VBS installers (windows target) (push) Skipped
VoidBuildSystem CI / 5 · Release (push) Skipped
- Dependency::profile(name, DependencyProfileOptions) records per-profile compile/link options, defines, LTO and sanitizers. The native provider applies the matching override to the dependency's own ProfileContext and hashes the overrides into the provider input hash, so changing them invalidates cached dependency builds. - vbs-toolchain.toml pins compiler, minimum version, C/C++ standards and sysroot (optional strict); it is loaded once and checked after every toolchain probe. Drift warns by default and fails with --locked-toolchain or strict = true; malformed pins fail with the TOML diagnostic. - vbs profile list|show|diff lists declared profiles with parents, prints a resolved profile (flags, standards, LTO, sanitizers, sysroot) or the fields that differ between two. Verified: dependency_profile_overrides_apply_to_native_builds (a define from the override is required by the dependency source), toolchain_pin_detects_and_enforces_drift and profile_commands_list_show_and_diff pass; vbs_core_tests 8/8; CLI contracts pass; clang-format clean.
This commit is contained in:
1 parent
f03524628b
commit
3b5d28d7b0
13 files changed
+702
-4
No files matched your search
@@ -86,6 +86,15 @@ struct FeatureDescription {
|
||||
std::string description;
|
||||
};
|
||||
|
||||
// Per-profile overrides applied to a dependency's own build (Tracks G3).
|
||||
struct DependencyProfileOptions {
|
||||
std::vector<std::string> compile_options;
|
||||
std::vector<std::string> link_options;
|
||||
std::vector<std::string> defines;
|
||||
std::optional<LtoMode> lto;
|
||||
std::vector<Sanitizer> sanitizers;
|
||||
};
|
||||
|
||||
struct ProfileDescription {
|
||||
std::string name;
|
||||
std::vector<std::string> compile_options;
|
||||
@@ -240,6 +249,7 @@ struct DependencyRecord {
|
||||
std::string sha256;
|
||||
std::vector<std::string> features;
|
||||
std::string required_feature; // Optional dependency: only used when this feature is on.
|
||||
std::map<std::string, DependencyProfileOptions, std::less<>> profile_overrides;
|
||||
bool build_dependency{false};
|
||||
};
|
||||
|
||||
@@ -345,6 +355,8 @@ class Dependency {
|
||||
Dependency &feature(std::string name);
|
||||
// Optional dependency: resolved only when the project feature is enabled.
|
||||
Dependency &when(std::string feature);
|
||||
// Per-profile overrides for the dependency's own build (e.g. its release profile).
|
||||
Dependency &profile(std::string profile, DependencyProfileOptions options = {});
|
||||
Dependency &build_dependency(bool is_build_tool = true);
|
||||
[[nodiscard]] ImportedTarget target(std::string exported_name) const;
|
||||
[[nodiscard]] const DependencyRecord &record() const;
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
|
||||
#include <Void/Build.hpp>
|
||||
#include <Void/Build/Toolchain/Driver.hpp>
|
||||
#include <Void/Functional/Error.hpp>
|
||||
#include <Void/Functional/Result.hpp>
|
||||
|
||||
#include <filesystem>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace Void::Build::Toolchain {
|
||||
|
||||
// `vbs-toolchain.toml`: a project-level toolchain contract checked after probing the compiler.
|
||||
struct ToolchainPin {
|
||||
std::string compiler; // "gcc" or "clang" (empty = unconstrained)
|
||||
std::string version; // minimum compiler version, e.g. "16.2"
|
||||
std::string cxx_standard; // e.g. "cxx26" (also accepts "c++26")
|
||||
std::string c_standard; // e.g. "c17"
|
||||
std::string sysroot; // exact sysroot path when set
|
||||
bool strict{false}; // fail on drift even without --locked-toolchain
|
||||
};
|
||||
|
||||
// Loads `<project_root>/vbs-toolchain.toml`; nullopt when the file does not exist.
|
||||
[[nodiscard]] Void::Result::Result<std::optional<ToolchainPin>, Void::Result::Error>
|
||||
load_toolchain_pin(const std::filesystem::path &project_root);
|
||||
|
||||
struct ToolchainDrift {
|
||||
std::vector<std::string> differences;
|
||||
[[nodiscard]] bool empty() const noexcept { return differences.empty(); }
|
||||
};
|
||||
|
||||
// Compares the resolved profile and probe against the pin. A minimum version is satisfied by any
|
||||
// equal or newer version.
|
||||
[[nodiscard]] ToolchainDrift check_toolchain_pin(const ToolchainPin &pin,
|
||||
const ProfileContext &profile,
|
||||
const ToolchainCapabilities &toolchain);
|
||||
|
||||
// Parses a version prefix ("16.2.0" -> {16,2,0}); empty when no digits are present.
|
||||
[[nodiscard]] std::vector<int> parse_version_prefix(std::string_view text);
|
||||
|
||||
} // namespace Void::Build::Toolchain
|
||||
Reference in new issue
Block a user