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

- 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:
faumaray committed 2026-12-06 20:09:50 +03:00
1 parent f03524628b
commit 3b5d28d7b0
13 files changed
+702 -4

No files matched your search

+32
View File
@@ -133,6 +133,29 @@ std::string scoped_options_json(const std::vector<ScopedOption> &opts) {
});
}
std::string dependency_profile_overrides_json(
const std::map<std::string, DependencyProfileOptions, std::less<>> &overrides) {
std::string out{"{"};
bool first = true;
for (const auto &[profile_name, options] : overrides) {
if (!first) {
out += ',';
}
first = false;
out += json_quote(profile_name) + ":{\"compile_options\":" +
json_array(options.compile_options, json_quote) + ",\"link_options\":" +
json_array(options.link_options, json_quote) + ",\"defines\":" +
json_array(options.defines, json_quote) + ",\"sanitizers\":" +
json_array(options.sanitizers,
[](Sanitizer s) { return json_quote(sanitizer_name(s)); });
if (options.lto) {
out += ",\"lto\":" + json_quote(lto_mode_name(*options.lto));
}
out += '}';
}
return out + '}';
}
std::string install_rule_json(const InstallRule &rule) {
return "{\"target_name\":" + json_quote(rule.target_name) +
",\"source_path\":" + json_quote(rule.source_path) +
@@ -1084,6 +1107,13 @@ Dependency &Dependency::when(std::string feature) {
return *this;
}
Dependency &Dependency::profile(std::string profile_name, DependencyProfileOptions options) {
require_text(profile_name, "dependency profile name");
owner(owner_)->dependencies.at(index_).profile_overrides[std::move(profile_name)] =
std::move(options);
return *this;
}
Dependency &Dependency::build_dependency(bool is_build_tool) {
owner(owner_)->dependencies.at(index_).build_dependency = is_build_tool;
return *this;
@@ -1417,6 +1447,8 @@ std::string Project::to_json() const {
",\"registry_authority\":" + json_quote(dependency.registry_authority) +
",\"features\":" + json_array(dependency.features, json_quote) +
",\"required_feature\":" + json_quote(dependency.required_feature) +
",\"profile_overrides\":" +
dependency_profile_overrides_json(dependency.profile_overrides) +
",\"build_dependency\":" +
std::string{dependency.build_dependency ? "true" : "false"} + '}';
return result;