Skip to content

Commit

Permalink
build: remove workspace-hack from proc-macro crates' dependencies
Browse files Browse the repository at this point in the history
To avoid many dependencies compiled twice, once as normal dependency and once as build-dependency (including very heavy onces, like zstd, aws-sdk-s3).

**This reduces fresh debug build's compile time from >400s to <300s on my mac.**

I'm not 100% sure about the mechanism yet, but it's clear that feature selection and dependency selection work differently for build-dependencies (incl proc-macros). When `workspack-hack` is used as a proc-macro crate's dependency, all its dependencies *can be* compiled twice.

See #9553 (comment) for more details.
  • Loading branch information
xxchan committed Oct 19, 2023
1 parent bf3dbbb commit 7fcd709
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 7 deletions.
2 changes: 0 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions src/common/proc_macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,5 @@ proc-macro2 = { version = "1", default-features = false }
syn = "1"
bae = "0.1.7"

[target.'cfg(not(madsim))'.dependencies]
workspace-hack = { path = "../../workspace-hack" }
[lints]
workspace = true
3 changes: 0 additions & 3 deletions src/prost/helpers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ proc-macro2 = { version = "1", default-features = false }
quote = "1"
syn = "2"

[target.'cfg(not(madsim))'.dependencies]
workspace-hack = { path = "../../workspace-hack" }

[package.metadata.cargo-machete]
ignored = ["workspace-hack"]

Expand Down

0 comments on commit 7fcd709

Please sign in to comment.