Binary project output within one workspace depends on build order
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 15.5k
- Forks
- 3k
- Avg merge
- 23h 30m
- Merged PRs (30d)
- 51
Description
Multiple projects within a workspace overwrite each others output, if their executable have the same name.
Imagine the following Cargo.toml snippet to be part of two projects (referred to as project_aand project_b):
[[bin]]
name = "runner"
path = "src/main.rs"
When compiling the workspace after a change in project_a, the following command runs the executable from project_a:
cargo run -p project_b --bin runner
Problems
- I expected the -p flag to be considered or to rise a warning that it's being ignored in conjunction with --bin
- Cargo workspaces allow two projects to target the same binary name, but currently names must be unique within the workspace
Possible Solution(s)
- Deprecate -p and --bin to be used in conjunction
- Fail workspace build if two projects use the same binary-name
Notes
Output of cargo version:
cargo 1.48.0 (65cbdd2dc 2020-10-14)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Create a workspace with two projects whose Cargo.toml files define a binary named runner, then reproduce the behavior with cargo run -p project_b --bin runner. Trace Cargo's workspace binary selection and output handling; done means the requested project is selected reliably or Cargo reports the duplicate or conflicting configuration explicitly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100