Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: cargo new --workspace could create a new workspace and embed the new crate under crates/ #13825

Closed
poliorcetics opened this issue Apr 29, 2024 · 2 comments
Labels
A-workspaces Area: workspaces C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-new S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted. S-triage Status: This issue is waiting on initial triage.

Comments

@poliorcetics
Copy link
Contributor

Problem

I often want to create new projects as workspaces directly.

Currently this isn't possible: I either have to use a template, copy paste from an existing workspace or do it manually.

Proposed Solution

Have cargo new my-crate --workspace create a workspace with the crate being under crates/my-crate and the members being crates/*.

--workspace would take an (optional, default crates) argument to customize the path for the members.

It would create empty [workspace.dependencies] (and [workspace.lints] ?) table(s) with doc link, as is currently done for crate creation.

In the [dependencies] section of the created crate, it could show how to use workspace dependencies instead of specifying them separately in all crates.

Notes

I feel this would be a nice addition to promote workspace usage and a common format for them. It would also make using them when starting a new project much easier.

I haven't found an issue for this but I may easily have missed it, feel free to close/mark as duplicate if that was already asked for.

There's probably more design work to do too, I'm typing the issue after encountering the issue but I haven't spent a long time looking for issues that would crop up from this.

@poliorcetics poliorcetics added C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage. labels Apr 29, 2024
@heisen-li
Copy link
Contributor

@rustbot label +A-workspaces +Command-new +S-needs-design -S-trige

It seems there is a similar proposal here:#8365

@rustbot rustbot added A-workspaces Area: workspaces Command-new S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted. labels Apr 29, 2024
@poliorcetics
Copy link
Contributor Author

I searched for "cargo new --workspace" and that issue didn't surface 😭, mine is clearly a duplicate, closing in favor of the existing one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-workspaces Area: workspaces C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-new S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted. S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

3 participants