mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-04 12:02:55 +00:00
add workspace_hack crate
Our builds can be a little inconsistent, because Cargo doesn't deal well with workspaces where there are multiple crates which have different dependencies that select different features. As a workaround, copy what other big rust projects do: add a workspace_hack crate. This crate just pins down a set of dependencies and features that satisfies all of the workspace crates. The benefits are: - running `cargo build` from one of the workspace subdirectories now works without rebuilding anything. - running `cargo install` works (without rebuilding anything). - making small dependency changes is much less likely to trigger large dependency rebuilds.
This commit is contained in:
21
Cargo.lock
generated
21
Cargo.lock
generated
@@ -269,6 +269,7 @@ dependencies = [
|
||||
"tokio-postgres",
|
||||
"toml",
|
||||
"walkeeper",
|
||||
"workspace_hack",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1180,6 +1181,7 @@ dependencies = [
|
||||
"tokio-stream",
|
||||
"tui",
|
||||
"walkdir",
|
||||
"workspace_hack",
|
||||
"zenith_utils",
|
||||
]
|
||||
|
||||
@@ -1342,6 +1344,7 @@ dependencies = [
|
||||
"rand",
|
||||
"regex",
|
||||
"thiserror",
|
||||
"workspace_hack",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2238,6 +2241,7 @@ dependencies = [
|
||||
"tokio-postgres",
|
||||
"tokio-stream",
|
||||
"walkdir",
|
||||
"workspace_hack",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2389,6 +2393,22 @@ dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "workspace_hack"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"memchr",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"regex",
|
||||
"regex-syntax",
|
||||
"serde",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xattr"
|
||||
version = "0.2.2"
|
||||
@@ -2413,6 +2433,7 @@ dependencies = [
|
||||
"control_plane",
|
||||
"pageserver",
|
||||
"postgres_ffi",
|
||||
"workspace_hack",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -7,4 +7,5 @@ members = [
|
||||
"control_plane",
|
||||
"postgres_ffi",
|
||||
"zenith_utils",
|
||||
"workspace_hack",
|
||||
]
|
||||
|
||||
@@ -25,3 +25,4 @@ thiserror = "1"
|
||||
pageserver = { path = "../pageserver" }
|
||||
walkeeper = { path = "../walkeeper" }
|
||||
postgres_ffi = { path = "../postgres_ffi" }
|
||||
workspace_hack = { path = "../workspace_hack" }
|
||||
|
||||
@@ -42,3 +42,4 @@ parse_duration = "2.1.1"
|
||||
|
||||
postgres_ffi = { path = "../postgres_ffi" }
|
||||
zenith_utils = { path = "../zenith_utils" }
|
||||
workspace_hack = { path = "../workspace_hack" }
|
||||
|
||||
@@ -17,6 +17,7 @@ crc32c = "0.6.0"
|
||||
hex = "0.4.3"
|
||||
log = "0.4.14"
|
||||
thiserror = "1.0"
|
||||
workspace_hack = { path = "../workspace_hack" }
|
||||
|
||||
[build-dependencies]
|
||||
bindgen = "0.57"
|
||||
|
||||
@@ -34,3 +34,4 @@ walkdir = "2"
|
||||
# FIXME: 'pageserver' is needed for ZTimelineId. Refactor
|
||||
pageserver = { path = "../pageserver" }
|
||||
postgres_ffi = { path = "../postgres_ffi" }
|
||||
workspace_hack = { path = "../workspace_hack" }
|
||||
|
||||
22
workspace_hack/Cargo.toml
Normal file
22
workspace_hack/Cargo.toml
Normal file
@@ -0,0 +1,22 @@
|
||||
[package]
|
||||
name = "workspace_hack"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
|
||||
[target.'cfg(all())'.dependencies]
|
||||
libc = { version = "0.2", features = ["default", "extra_traits", "std"] }
|
||||
memchr = { version = "2", features = ["default", "std", "use_std"] }
|
||||
num-integer = { version = "0.1", default-features = false, features = ["std"] }
|
||||
num-traits = { version = "0.2", default-features = false, features = ["std"] }
|
||||
regex = { version = "1", features = ["aho-corasick", "default", "memchr", "perf", "perf-cache", "perf-dfa", "perf-inline", "perf-literal", "std", "unicode", "unicode-age", "unicode-bool", "unicode-case", "unicode-gencat", "unicode-perl", "unicode-script", "unicode-segment"] }
|
||||
regex-syntax = { version = "0.6", features = ["default", "unicode", "unicode-age", "unicode-bool", "unicode-case", "unicode-gencat", "unicode-perl", "unicode-script", "unicode-segment"] }
|
||||
serde = { version = "1", features = ["default", "derive", "serde_derive", "std"] }
|
||||
|
||||
[target.'cfg(all())'.build-dependencies]
|
||||
libc = { version = "0.2", features = ["default", "extra_traits", "std"] }
|
||||
memchr = { version = "2", features = ["default", "std", "use_std"] }
|
||||
proc-macro2 = { version = "1", features = ["default", "proc-macro"] }
|
||||
quote = { version = "1", features = ["default", "proc-macro"] }
|
||||
regex = { version = "1", features = ["aho-corasick", "default", "memchr", "perf", "perf-cache", "perf-dfa", "perf-inline", "perf-literal", "std", "unicode", "unicode-age", "unicode-bool", "unicode-case", "unicode-gencat", "unicode-perl", "unicode-script", "unicode-segment"] }
|
||||
regex-syntax = { version = "0.6", features = ["default", "unicode", "unicode-age", "unicode-bool", "unicode-case", "unicode-gencat", "unicode-perl", "unicode-script", "unicode-segment"] }
|
||||
syn = { version = "1", features = ["clone-impls", "default", "derive", "full", "parsing", "printing", "proc-macro", "quote", "visit", "visit-mut"] }
|
||||
23
workspace_hack/src/lib.rs
Normal file
23
workspace_hack/src/lib.rs
Normal file
@@ -0,0 +1,23 @@
|
||||
//! This crate contains no code.
|
||||
//!
|
||||
//! The workspace_hack crate exists only to pin down some dependencies,
|
||||
//! so that those dependencies always build with the same features,
|
||||
//! under a few different cases that can be problematic:
|
||||
//! - Running `cargo check` or `cargo build` from a crate sub-directory
|
||||
//! instead of the workspace root.
|
||||
//! - Running `cargo install`, which can only be done per-crate
|
||||
//!
|
||||
//! The dependency lists in Cargo.toml were automatically generated by
|
||||
//! a tool called
|
||||
//! [Hakari](https://github.com/facebookincubator/cargo-guppy/tree/main/tools/hakari).
|
||||
//!
|
||||
//! Hakari doesn't have a CLI yet; in the meantime the example code in
|
||||
//! their `README` file is enough to regenerate the dependencies.
|
||||
//! Hakari's output was pasted into Cargo.toml, except for the
|
||||
//! following manual edits:
|
||||
//! - `winapi` dependency was removed. This is probably just due to the
|
||||
//! fact that Hakari's target analysis is incomplete.
|
||||
//!
|
||||
//! There isn't any penalty to this data falling out of date; it just
|
||||
//! means that under the conditions above Cargo will rebuild more
|
||||
//! packages than strictly necessary.
|
||||
@@ -14,3 +14,4 @@ anyhow = "1.0"
|
||||
pageserver = { path = "../pageserver" }
|
||||
control_plane = { path = "../control_plane" }
|
||||
postgres_ffi = { path = "../postgres_ffi" }
|
||||
workspace_hack = { path = "../workspace_hack" }
|
||||
|
||||
Reference in New Issue
Block a user