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

Move rustfmt binariy crates to workspace #4002

Merged
merged 1 commit into from
Jan 7, 2020

Conversation

topecongiro
Copy link
Contributor

After I separated rustfmt into multiple crates, I realized that cargo builds rustfmt-core twice: for rustfmt-core itself and for rustfmt-nightly (the root crate that holds binaries). This duplication is not ideal during development.

The goal of this PR is to mitigate the overhead by moving binaries under the rustfmt-core workspace. The root Cargo.toml works as a shim to the actual binary crate, which is necessary for the rustc repository.

The downside is that we now need to keep the root Cargo.toml in sync with rustfmt-core/rustfmt-bin/Cargo.toml.

@@ -4,3 +4,5 @@ version = "0.1.0"
authors = ["rustfmt devs <[email protected]>"]

[dependencies]

[workspace]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that these files are under the workspace, we need to exclude them from the workspace.

cc rust-lang/cargo#6745

categories = ["development-tools"]
edition = "2018"

[[bin]]
name = "rustfmt"
path = "src/bin/main.rs"
path = "rustfmt-core/rustfmt-bin/src/bin/main.rs"
test = false
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disabled all the tests in the root package as they will be tested in rustfmt-core.

@topecongiro topecongiro force-pushed the add-bin-to-workspace branch from 63c7697 to 8ccbacf Compare January 7, 2020 15:06
@topecongiro topecongiro merged commit e8da49a into rust-lang:master Jan 7, 2020
@topecongiro topecongiro deleted the add-bin-to-workspace branch January 7, 2020 15:07
@calebcartwright
Copy link
Member

The downside is that we now need to keep the root Cargo.toml in sync with rustfmt-core/rustfmt-bin/Cargo.toml.

Just the bin names and paths right?

@karyon
Copy link
Contributor

karyon commented Oct 28, 2021

backport not needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants