← Back to issue list

Rust plugin prevents from building a single package in workspace

View original Github issue

Metadata

Project
craft-parts
Number
#934
Type
issue
State
open
Author
artivis
Labels
Created
Updated
Closed

Current evaluation

Rust plugin hardcodes --workspace in cargo build for virtual workspaces, blocking single-package builds via --package. Open ~18 months with no maintainer interaction; the hardcoded flag still exists in current code.

Suggested action: needs triage

Reason: The issue has no labels, no assignee, and zero maintainer comments in ~18 months, showing no triage has occurred. However, close_stale is not warranted because I verified the hardcoded `cargo build --workspace` at rust_plugin.py:324 still exists in current HEAD, so the reported limitation remains real and actionable. The fix is modest (drop or condition the flag per cargo's default-members semantics) but touches workspace build behavior and binary installation, warranting maintainer assessment.

Impact: 45 Quick Win: 24.75 Staleness: 75 Complexity: 45 Confidence: 80 Support Request: 10

Issue body

### What needs to get done The rust plugin should support building a single (or several) package(s) in a virtual workspace. The `cargo build` command offers the `--package` flag to only build a specific package (the flag can be repeated). However it is superseeded by the `--workspace` flag which effectively instruct to build all packages (not sure if this precedence is a general rule or a positional thing). ### Why it needs to get done While the plugin doesn't explicitely support specifying a package(s), one could abuse the [`rust_cargo_parameters`](https://github.com/canonical/craft-parts/blob/11be8c7a300b28885f9ddcd71f072fae31c440ab/craft_parts/plugins/rust_plugin.py#L50C5-L50C26) to stuff e.g. `['--package', 'foo']`. However, the plugin [hardcode the `--workspace`](https://github.com/canonical/craft-parts/blob/11be8c7a300b28885f9ddcd71f072fae31c440ab/craft_parts/plugins/rust_plugin.py#L316) flag and all packages are built regardless of the workaround. Edit: Similarly, a workspace definition may contain the `default-members` entry. It defines the members of a virtual workspace that should be built in case neither `--workspace` nor `--package` are specified. If `default-members` isn't specified either, the fallback is to build all (`--workspace`). So the hardcoded flag could probably be removed altogether from the plugin. Source: [The cargo book](https://doc.rust-lang.org/cargo/reference/workspaces.html?highlight=workspace#workspaces).

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 45
Quick Win: 24.75
Staleness: 75
Complexity: 45
Confidence: 80
Support Request: 10
needs triage Rust plugin hardcodes --workspace in cargo build for virtual workspaces, blocking single-package builds via --package. Open ~18 months with no maintainer interaction; the hardcoded flag still exists in current code.
qwen/qwen3.6-35b-a3b
Staleness: 92
Complexity: 20
Confidence: 85
Support Request: 10
needs triage Rust plugin hardcodes --workspace in cargo build, blocking single-package builds. Untriaged, no maintainer comments, inactive for over a year.
qwen3.6-35b-a3b-mtp-q6
Staleness: 90
Complexity: 30
Confidence: 75
Support Request: 10
needs triage Rust plugin hardcodes --workspace flag, blocking single-package builds. Unlabelled, zero maintainer comments, inactive for over a year.
qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 30
Confidence: 80
Support Request: 10
needs triage Rust plugin hardcodes --workspace in cargo build, preventing single-package builds in virtual workspaces. Suggests removing the flag to respect --package or default-members. Open, inactive for 465 days, awaiting triage.

Update history

No update history recorded yet.

Related issues

No related issues found above the similarity threshold.