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
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:
1 parent
8b21583eeb
commit
f03524628b
10 files changed
+512
-3
No files matched your search
@@ -80,6 +80,12 @@ struct ProfileContext {
|
||||
bool nondeterministic{false};
|
||||
};
|
||||
|
||||
struct FeatureDescription {
|
||||
std::string name;
|
||||
bool default_on{false};
|
||||
std::string description;
|
||||
};
|
||||
|
||||
struct ProfileDescription {
|
||||
std::string name;
|
||||
std::vector<std::string> compile_options;
|
||||
@@ -196,6 +202,7 @@ struct TargetRecord {
|
||||
std::vector<ScopedOption> defines;
|
||||
std::vector<ScopedOption> link_options;
|
||||
std::vector<std::string> prerequisites;
|
||||
std::vector<std::string> required_features; // Project features this target requires.
|
||||
CStandard c_standard{CStandard::Default};
|
||||
CxxStandard cxx_standard{CxxStandard::Default};
|
||||
std::string precompiled_header;
|
||||
@@ -232,6 +239,7 @@ struct DependencyRecord {
|
||||
std::string registry_authority;
|
||||
std::string sha256;
|
||||
std::vector<std::string> features;
|
||||
std::string required_feature; // Optional dependency: only used when this feature is on.
|
||||
bool build_dependency{false};
|
||||
};
|
||||
|
||||
@@ -306,6 +314,8 @@ class Target {
|
||||
Target &fixture_setup(std::string name);
|
||||
Target &fixture_required(std::string name);
|
||||
Target &fixture_cleanup(std::string name);
|
||||
// Contributes a project feature to the additive feature set (Cargo-style unification).
|
||||
Target &require_feature(std::string feature);
|
||||
Target &nondeterministic(bool enabled = true);
|
||||
Target &enabled(bool flag);
|
||||
Target &install(std::string destination = {}, std::string component = "default");
|
||||
@@ -333,6 +343,8 @@ class Dependency {
|
||||
Dependency &package(std::string id, std::string range);
|
||||
Dependency ®istry(std::string authority_url);
|
||||
Dependency &feature(std::string name);
|
||||
// Optional dependency: resolved only when the project feature is enabled.
|
||||
Dependency &when(std::string feature);
|
||||
Dependency &build_dependency(bool is_build_tool = true);
|
||||
[[nodiscard]] ImportedTarget target(std::string exported_name) const;
|
||||
[[nodiscard]] const DependencyRecord &record() const;
|
||||
@@ -367,6 +379,10 @@ class Project {
|
||||
// A target that compiles declared shader sources to SPIR-V (`.shader(...)`).
|
||||
[[nodiscard]] Target shader_bundle(std::string name);
|
||||
[[nodiscard]] Target test(std::string name);
|
||||
// Declares a project feature (additive; defaults are on unless --no-default-features).
|
||||
Project &feature(std::string name, bool default_on = false);
|
||||
Project &feature(FeatureDescription description);
|
||||
[[nodiscard]] const std::vector<FeatureDescription> &features() const noexcept;
|
||||
[[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.
|
||||
|
||||
@@ -23,6 +23,7 @@ struct ProjectDescription {
|
||||
ProfileContext profile;
|
||||
std::vector<TargetRecord> targets;
|
||||
std::vector<DependencyRecord> dependencies;
|
||||
std::vector<FeatureDescription> features;
|
||||
std::vector<std::string> dependency_files;
|
||||
std::vector<InstallRule> install_rules;
|
||||
|
||||
|
||||
Reference in new issue
Block a user