Skip to content

Add targets to feature matrix#17

Merged
romnn merged 13 commits into
mainfrom
feat/add-targets-to-feature-matrix
Jun 29, 2026
Merged

Add targets to feature matrix#17
romnn merged 13 commits into
mainfrom
feat/add-targets-to-feature-matrix

Conversation

@romnn

@romnn romnn commented Jun 28, 2026

Copy link
Copy Markdown
Owner

No description provided.

romnn added 13 commits June 28, 2026 18:57
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`.
@romnn romnn merged commit b5817bd into main Jun 29, 2026
26 checks passed
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