Add targets to feature matrix#17
Merged
Merged
Conversation
Add a target axis so a workspace can declare target triples checked by default, turning a run into `selected packages × effective targets × feature combinations`. A plain `cargo fc check` now exercises the same target cfg views as CI. Config: - `Config.targets` (None=inherit, []=opt-out, list=override), cleared in config resolution so feature generation never reads it. - `WorkspaceConfig.targets`, target-specific `target.'cfg(...)'` `exclude_packages` overrides, and a `subcommands` target-capability table. Planning (new `target_plan` module): - precedence `--target` > package > workspace > `CARGO_BUILD_TARGET` > host, with stable dedupe/ordering and a per-assignment `TargetSource`. - per-target workspace `exclude_packages` resolution. - target capability resolution: built-in subcommands are known; unknown aliases need explicit `subcommands.<token>.targets = true`. - split workspace candidate discovery from exclusion so excludes apply per target; cache package configs once to avoid duplicate deprecation warnings. Execution: - precomputed `ExecutionPlan`s drive both modes. - serial per-target (default): one invocation per (package, target, combo) with exact attribution, `--target` injected for configured sources, `--dedupe` shared across plans. - opt-in `--aggregate-targets`: one invocation per (package, combo) batching shared targets as repeated `--target`, group-level attribution; falls back to serial for `run`, pruned summaries, and single-target runs. - target-aware headers/summaries (`SummaryTarget`); implicit single-host output is unchanged. Matrix: every `cargo fc matrix` row carries `target`; the built-in key wins over user matrix metadata with a compatibility warning. Docs: document configured targets, capability/alias opt-in, the two execution modes, and the matrix schema change in README and GitHub Actions docs. Surface rustc's reason at the cfg-eval boundary.
`--no-targets` temporarily disables running for all configured targets and falls back to Cargo's default single effective target (`--target`, then `CARGO_BUILD_TARGET`, then host) — an alternative to passing an explicit `--target <triple>`. It denies the target capability up front (without the "no targets capability" warning) so it also collapses `cargo fc matrix` to a single target; an explicit `--target` still wins. Document it in the README alongside the existing `--target` guidance.
…helpers - Collapse the command target-capability "policy" ceremony to a single `command_allows_configured_targets(...) -> bool`, dropping the `ResolvedCommandTargetPolicy` struct, the `CommandCapabilitySource` and `CapabilityDecision` enums, and `is_builtin_target_command`'s `Option<bool>`. - Drop dead code: `TargetSource::is_configured`, the two `distinct_targets` helpers, and `RustcTargetEnvironment`'s generic + `with_env` (now a unit struct reading the environment directly). - Have `pkg_metadata_section` / `ws_metadata_section` / `DEFAULT_PKG_METADATA_SECTION` return the dotted path; callers wrap `[...]` and append sub-keys (e.g. `.subcommands.<token>`). Capability warnings/hints reuse `ws_metadata_section` and echo the user's actual metadata alias instead of hardcoding `cargo-fc`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.