feat(features): additive C++ feature flags (G2)
VoidBuildSystem CI / 1 · Requirements (push) Successful in 8s
VoidBuildSystem CI / 2A · Linux build (debug) (push) Successful in 2m47s
VoidBuildSystem CI / 2A · Linux build (coverage) (push) Successful in 2m53s
VoidBuildSystem CI / 2A · Linux build (sanitizers) (push) Successful in 3m36s
VoidBuildSystem CI / 2B · Windows Wine build (debug) (push) Successful in 1m57s
VoidBuildSystem CI / 2B · Windows Wine build (relwithdebinfo) (push) Successful in 3m23s
VoidBuildSystem CI / 3B · Windows Wine test (debug) (push) Successful in 25s
VoidBuildSystem CI / 3B · Windows Wine test (relwithdebinfo) (push) Successful in 24s
VoidBuildSystem CI / 2A · Linux build (relwithdebinfo) (push) Successful in 6m1s
VoidBuildSystem CI / 3A · Linux test (coverage) (push) Failing after 2m2s
VoidBuildSystem CI / 3A · Linux test (sanitizers) (push) Successful in 2m2s
VoidBuildSystem CI / 3A · Linux test (relwithdebinfo) (push) Failing after 6m54s
VoidBuildSystem CI / 3A · Linux test (debug) (push) Failing after 7m4s
VoidBuildSystem CI / 4A2 · VBS installers (linux target) (push) Skipped
VoidBuildSystem CI / 4A2 · VBS installers (windows target) (push) Skipped
VoidBuildSystem CI / 5 · Release (push) Skipped

- Project::feature(name, default_on) / FeatureDescription, Target's
  require_feature() (the `.requires` spelling is a C++20 keyword), and
  Dependency::when(feature) for optional dependencies.
- --features a,b / --no-default-features on build, test, run, explain and
  deps resolve/update. Unification is additive: defaults (unless
  disabled) + features required by targets + requested features.
- Enabled features add VBS_FEATURE_<NAME> compile definitions to every
  target, so action keys and the cache are feature-aware; switching the
  set invalidates cached actions.
- Optional dependencies are filtered before resolution, so vbs.lock
  contains only active ones.
- vbs explain --show-features prints the unified set with reasons
  (default/requested/required by target); vbs metadata lists declared
  features with their enabled state; the descriptor JSON carries features
  and target requirements.

API note: features provide preprocessor-level configuration (defines), not
ABI/layout changes across a feature boundary.

Verified: features_unify_defines_and_invalidate_action_keys and
optional_dependencies_follow_feature_selection pass; vbs_core_tests 8/8;
CLI contracts pass; clang-format clean.
This commit is contained in:
faumaray committed 2026-12-06 20:01:29 +03:00
1 parent 8b21583eeb
commit f03524628b
10 files changed
+512 -3

No files matched your search

+11
View File
@@ -157,6 +157,17 @@ the registry offline; `install-binary` installs and runs the registry artifact.
### G2 — Feature flags that actually work *(M–L)*
**Status: implemented (Wave 150).** `Project::feature(name, default_on)` (or
`FeatureDescription`), `Target::require_feature(name)` (the plan's `.requires` spelling collides
with the C++20 keyword) and `Dependency::when(feature)`; `--features a,b` /
`--no-default-features` on build/test/run/explain/deps; additive unification (defaults + target
requirements + requests); `VBS_FEATURE_<NAME>` defines on every target so action keys and the
cache follow the feature set; optional dependencies filtered before resolution; `vbs explain
--show-features` and `vbs metadata` report the unified set and its reasons. Verified by
`FullV1Tests.features_unify_defines_and_invalidate_action_keys` and
`optional_dependencies_follow_feature_selection`. The ABI rule (features may add definition
macros, never layout) is documented.
**Beats:** Cargo's best idea, applied to C++ — no C++ build system has additive, unified features.
Current state: `Dependency::feature(name)` is recorded and serialized into the lockfile but **is