diff --git a/Cargo.lock b/Cargo.lock index 92443d0bc0..06d1b6772f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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]] diff --git a/Cargo.toml b/Cargo.toml index d242faaaee..8a9230c159 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,4 +7,5 @@ members = [ "control_plane", "postgres_ffi", "zenith_utils", + "workspace_hack", ] diff --git a/control_plane/Cargo.toml b/control_plane/Cargo.toml index 71fdf918d0..48ed1ae8c1 100644 --- a/control_plane/Cargo.toml +++ b/control_plane/Cargo.toml @@ -25,3 +25,4 @@ thiserror = "1" pageserver = { path = "../pageserver" } walkeeper = { path = "../walkeeper" } postgres_ffi = { path = "../postgres_ffi" } +workspace_hack = { path = "../workspace_hack" } diff --git a/pageserver/Cargo.toml b/pageserver/Cargo.toml index 9ab4fee716..4ccb748e73 100644 --- a/pageserver/Cargo.toml +++ b/pageserver/Cargo.toml @@ -42,3 +42,4 @@ parse_duration = "2.1.1" postgres_ffi = { path = "../postgres_ffi" } zenith_utils = { path = "../zenith_utils" } +workspace_hack = { path = "../workspace_hack" } diff --git a/postgres_ffi/Cargo.toml b/postgres_ffi/Cargo.toml index 6f1a03d437..f14b3f8954 100644 --- a/postgres_ffi/Cargo.toml +++ b/postgres_ffi/Cargo.toml @@ -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" diff --git a/walkeeper/Cargo.toml b/walkeeper/Cargo.toml index b36fa9e5bc..5e2d96f9fc 100644 --- a/walkeeper/Cargo.toml +++ b/walkeeper/Cargo.toml @@ -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" } diff --git a/workspace_hack/Cargo.toml b/workspace_hack/Cargo.toml new file mode 100644 index 0000000000..7a4a229d27 --- /dev/null +++ b/workspace_hack/Cargo.toml @@ -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"] } diff --git a/workspace_hack/src/lib.rs b/workspace_hack/src/lib.rs new file mode 100644 index 0000000000..ceba3d145d --- /dev/null +++ b/workspace_hack/src/lib.rs @@ -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. diff --git a/zenith/Cargo.toml b/zenith/Cargo.toml index 876ce80fec..452ba6c5a5 100644 --- a/zenith/Cargo.toml +++ b/zenith/Cargo.toml @@ -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" }