Skip to content

[codex] Split build-script feature resolution#158

Draft
dzbarsky wants to merge 10 commits into
mainfrom
codex/build-script-exec-features
Draft

[codex] Split build-script feature resolution#158
dzbarsky wants to merge 10 commits into
mainfrom
codex/build-script-exec-features

Conversation

@dzbarsky

Copy link
Copy Markdown
Member

Cargo resolver v2 keeps normal-dependency features separate from build-dependency features, but rules_rs previously resolved both dependency kinds into one external rust_crate target. This change resolves target dependencies without build dependencies, seeds a second resolution over SUPPORTED_EXEC_TRIPLES, and generates either one target when both resolutions match or _target and _exec targets selected by @rules_rust//cargo/settings:use_exec_features_enabled when they differ. It pins rules_rust commit 7837073014b566291368027aa116cd03fe108049, which composes the build-script exec transition with the marker transition through config.exec().and_then(...).

The build_exec_feature_split fixture requires target_feature from a normal dependency and exec_feature from the same crate as a build dependency. The shared crate fails compilation if both features are enabled, so the fixture verifies that the target library and build script receive different feature sets.

Validation used source-built Bazel commit 0878dd724149b73a731ab83859a55a65e9b438ed: @build_exec_feature_split//:_workspace_deps passed with 1,720 actions, //rs/private:all passed 28/28 tests, cargo check --locked passed for the fixture, and Buildifier plus git diff --check passed.

Current scope: proc macros are unchanged, and seed_exec_build_dependencies unions features from all active target triples before resolving each exec triple. Exact target-specific build-script features require resolution keyed by both target triple and exec triple.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant