diff --git a/.github/workflows/workspace-hack.yml b/.github/workflows/workspace-hack.yml new file mode 100644 index 000000000..a028830ac --- /dev/null +++ b/.github/workflows/workspace-hack.yml @@ -0,0 +1,35 @@ +name: Workspace hack + +on: + push: + branches: + - main + pull_request: + branches: + - main + +env: + CARGO_TERM_COLOR: always + +jobs: + test: + name: Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions-rust-lang/setup-rust-toolchain@v1 + # Check https://docs.rs/cargo-hakari/0.9.29/cargo_hakari/#installation + # to learn how to install cargo-hakari locally + - name: Install cargo-hakari + uses: taiki-e/install-action@v2 + with: + tool: cargo-hakari + - name: Verify workspace-hack + run: | + cd libs + # Check that my-workspace-hack's Cargo.toml is up-to-date + # If this fails, run `cargo hakari generate` to fix it + cargo hakari generate --diff + # Check that all workspace crates depend on my-workspace-hack + # If this fails, run `cargo hakari manage-deps` to fix it + cargo hakari manage-deps --dry-run diff --git a/libs/.config/hakari.toml b/libs/.config/hakari.toml new file mode 100644 index 000000000..8dc80e7d6 --- /dev/null +++ b/libs/.config/hakari.toml @@ -0,0 +1,25 @@ +# This file contains settings for `cargo hakari`. +# See https://docs.rs/cargo-hakari/latest/cargo_hakari/config for a full list of options. + +hakari-package = "workspace_hack" + +# Format version for hakari's output. Version 4 requires cargo-hakari 0.9.22 or above. +dep-format-version = "4" + +# Setting workspace.resolver = "2" in the root Cargo.toml is HIGHLY recommended. +# Hakari works much better with the new feature resolver. +# For more about the new feature resolver, see: +# https://blog.rust-lang.org/2021/03/25/Rust-1.51.0.html#cargos-new-feature-resolver +resolver = "2" + +# Add triples corresponding to platforms commonly used by developers here. +# https://doc.rust-lang.org/rustc/platform-support.html +platforms = [ + # "x86_64-unknown-linux-gnu", + # "x86_64-apple-darwin", + # "aarch64-apple-darwin", + # "x86_64-pc-windows-msvc", +] + +# Write out exact versions rather than a semver range. (Defaults to false.) +# exact-versions = true diff --git a/libs/Cargo.lock b/libs/Cargo.lock index aeb1e6fb6..f6aeefd17 100644 --- a/libs/Cargo.lock +++ b/libs/Cargo.lock @@ -931,6 +931,7 @@ dependencies = [ "toml", "tracing", "walkdir", + "workspace_hack", ] [[package]] @@ -1933,6 +1934,7 @@ dependencies = [ "tracing", "ubyte", "uuid", + "workspace_hack", ] [[package]] @@ -1941,6 +1943,7 @@ version = "0.1.30" dependencies = [ "pavex_reflection", "serde", + "workspace_hack", ] [[package]] @@ -1982,6 +1985,7 @@ dependencies = [ "ureq", "vergen", "windows-sys 0.52.0", + "workspace_hack", "xdg-home", "xz2", "zip", @@ -1994,6 +1998,7 @@ dependencies = [ "anyhow", "pavex", "thiserror", + "workspace_hack", ] [[package]] @@ -2006,6 +2011,7 @@ dependencies = [ "serde", "syn", "trybuild", + "workspace_hack", ] [[package]] @@ -2026,6 +2032,7 @@ dependencies = [ "terminal_size", "textwrap", "unicode-width", + "workspace_hack", ] [[package]] @@ -2033,6 +2040,7 @@ name = "pavex_reflection" version = "0.1.30" dependencies = [ "serde", + "workspace_hack", ] [[package]] @@ -2060,6 +2068,7 @@ dependencies = [ "toml", "tracing-subscriber", "walkdir", + "workspace_hack", ] [[package]] @@ -2068,6 +2077,7 @@ version = "0.1.30" dependencies = [ "pavex", "tracing", + "workspace_hack", ] [[package]] @@ -2114,6 +2124,7 @@ dependencies = [ "toml_edit 0.21.1", "tracing", "vergen", + "workspace_hack", "xdg-home", ] @@ -2140,6 +2151,7 @@ dependencies = [ "tracing-chrome", "tracing-subscriber", "vergen", + "workspace_hack", ] [[package]] @@ -2149,6 +2161,7 @@ dependencies = [ "anyhow", "pavex", "thiserror", + "workspace_hack", ] [[package]] @@ -2177,6 +2190,7 @@ dependencies = [ "fs-err", "sha2", "tracing", + "workspace_hack", ] [[package]] @@ -3921,6 +3935,50 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "workspace_hack" +version = "0.1.0" +dependencies = [ + "ahash", + "aho-corasick", + "bitflags 2.5.0", + "cc", + "clap", + "clap_builder", + "console", + "crossbeam-utils", + "crypto-common", + "deranged", + "digest", + "fixedbitset", + "getrandom", + "hashbrown 0.14.3", + "hmac", + "indexmap", + "log", + "memchr", + "miette", + "petgraph", + "proc-macro2", + "quote", + "regex", + "regex-automata 0.4.6", + "regex-syntax 0.8.3", + "serde", + "serde_json", + "sha2", + "smallvec", + "subtle", + "syn", + "time", + "time-macros", + "tokio", + "toml", + "tracing-core", + "uuid", + "zeroize", +] + [[package]] name = "xattr" version = "1.3.1" diff --git a/libs/Cargo.toml b/libs/Cargo.toml index 673ad8855..d70b40e98 100644 --- a/libs/Cargo.toml +++ b/libs/Cargo.toml @@ -1,5 +1,5 @@ [workspace] -members = ["./pavex*", "generate_from_path", "persist_if_changed"] +members = ["./pavex*", "generate_from_path", "persist_if_changed", "workspace_hack"] resolver = "2" [workspace.package] diff --git a/libs/generate_from_path/Cargo.toml b/libs/generate_from_path/Cargo.toml index 84d2d6c52..d3bd837f4 100644 --- a/libs/generate_from_path/Cargo.toml +++ b/libs/generate_from_path/Cargo.toml @@ -20,3 +20,4 @@ indicatif = "0.17.7" walkdir = "2.4.0" sanitize-filename = "0.5" regex = "1.10.2" +workspace_hack = { version = "0.1", path = "../workspace_hack" } diff --git a/libs/pavex/Cargo.toml b/libs/pavex/Cargo.toml index 57c95ef21..dbf6121b2 100644 --- a/libs/pavex/Cargo.toml +++ b/libs/pavex/Cargo.toml @@ -66,6 +66,7 @@ hyper = { version = "1", features = ["full"], optional = true } hyper-util = { version = "0.1", features = ["tokio", "server", "server-auto"], optional = true } socket2 = { version = "0.5.3", optional = true } smallvec = "1" +workspace_hack = { version = "0.1", path = "../workspace_hack" } [dev-dependencies] tokio = { version = "1", features = ["macros"] } diff --git a/libs/pavex_bp_schema/Cargo.toml b/libs/pavex_bp_schema/Cargo.toml index 6718adc75..32bfbf553 100644 --- a/libs/pavex_bp_schema/Cargo.toml +++ b/libs/pavex_bp_schema/Cargo.toml @@ -10,3 +10,4 @@ license.workspace = true [dependencies] serde = { version = "1", features = ["derive"] } pavex_reflection = { path = "../pavex_reflection", version = "=0.1.30" } +workspace_hack = { version = "0.1", path = "../workspace_hack" } diff --git a/libs/pavex_cli/Cargo.toml b/libs/pavex_cli/Cargo.toml index a3bb9e664..ee09c6c93 100644 --- a/libs/pavex_cli/Cargo.toml +++ b/libs/pavex_cli/Cargo.toml @@ -54,6 +54,7 @@ secrecy = { version = "0.8.0", features = ["serde"] } clap-stdin = "0.4.0" owo-colors = "4.0.0" anstyle = "1.0.6" +workspace_hack = { version = "0.1", path = "../workspace_hack" } [dev-dependencies] pavex_test_runner = { path = "../pavex_test_runner" } diff --git a/libs/pavex_cli_client/Cargo.toml b/libs/pavex_cli_client/Cargo.toml index bceecb44d..b22d50dfd 100644 --- a/libs/pavex_cli_client/Cargo.toml +++ b/libs/pavex_cli_client/Cargo.toml @@ -11,3 +11,4 @@ license.workspace = true anyhow = "1" pavex = { path = "../pavex", version = "0.1.30" } thiserror = "1.0.56" +workspace_hack = { version = "0.1", path = "../workspace_hack" } diff --git a/libs/pavex_macros/Cargo.toml b/libs/pavex_macros/Cargo.toml index 4be88f6fc..f769f98b8 100644 --- a/libs/pavex_macros/Cargo.toml +++ b/libs/pavex_macros/Cargo.toml @@ -14,6 +14,7 @@ proc-macro = true proc-macro2 = "1.0" quote = "1.0" syn = "2.0" +workspace_hack = { version = "0.1", path = "../workspace_hack" } [dev-dependencies] trybuild = "1.0" diff --git a/libs/pavex_miette/Cargo.toml b/libs/pavex_miette/Cargo.toml index 0c71a8e69..081305b7b 100644 --- a/libs/pavex_miette/Cargo.toml +++ b/libs/pavex_miette/Cargo.toml @@ -16,3 +16,4 @@ supports-hyperlinks = { version = "3.0.0" } supports-color = { version = "3.0.0" } supports-unicode = { version = "3.0.0" } terminal_size = { version = "0.3" } +workspace_hack = { version = "0.1", path = "../workspace_hack" } diff --git a/libs/pavex_reflection/Cargo.toml b/libs/pavex_reflection/Cargo.toml index 184e41ad8..4774c4417 100644 --- a/libs/pavex_reflection/Cargo.toml +++ b/libs/pavex_reflection/Cargo.toml @@ -9,3 +9,4 @@ license.workspace = true [dependencies] serde = { version = "1", features = ["derive"] } +workspace_hack = { version = "0.1", path = "../workspace_hack" } diff --git a/libs/pavex_test_runner/Cargo.toml b/libs/pavex_test_runner/Cargo.toml index be3ffaae8..d1d820081 100644 --- a/libs/pavex_test_runner/Cargo.toml +++ b/libs/pavex_test_runner/Cargo.toml @@ -37,3 +37,4 @@ globwalk = "0.9.1" tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt"] } regex = "1.10.2" once_cell = "1.19.0" +workspace_hack = { version = "0.1", path = "../workspace_hack" } diff --git a/libs/pavex_tracing/Cargo.toml b/libs/pavex_tracing/Cargo.toml index 7fc2cd81f..a2dc99d36 100644 --- a/libs/pavex_tracing/Cargo.toml +++ b/libs/pavex_tracing/Cargo.toml @@ -12,3 +12,4 @@ readme = "README.md" [dependencies] tracing = { version = "0.1", default-features = false, features = ["std"] } pavex = { version = "0.1.30", path = "../pavex" } +workspace_hack = { version = "0.1", path = "../workspace_hack" } diff --git a/libs/pavexc/Cargo.toml b/libs/pavexc/Cargo.toml index fa13340f8..4e228d333 100644 --- a/libs/pavexc/Cargo.toml +++ b/libs/pavexc/Cargo.toml @@ -60,3 +60,4 @@ r2d2 = "0.8" bincode = "1" rayon = "1.7" num_cpus = "1.15.0" +workspace_hack = { version = "0.1", path = "../workspace_hack" } diff --git a/libs/pavexc_cli/Cargo.toml b/libs/pavexc_cli/Cargo.toml index add1dec1c..6a9e972cb 100644 --- a/libs/pavexc_cli/Cargo.toml +++ b/libs/pavexc_cli/Cargo.toml @@ -31,6 +31,7 @@ ron = "0.8" generate_from_path = { path = "../generate_from_path", version = "0.1.30" } tempfile = "3.9.0" better-panic = "0.3.0" +workspace_hack = { version = "0.1", path = "../workspace_hack" } [build-dependencies] vergen = { workspace = true } diff --git a/libs/pavexc_cli_client/Cargo.toml b/libs/pavexc_cli_client/Cargo.toml index b3782db3e..32593ed80 100644 --- a/libs/pavexc_cli_client/Cargo.toml +++ b/libs/pavexc_cli_client/Cargo.toml @@ -11,3 +11,4 @@ license.workspace = true anyhow = "1" pavex = { path = "../pavex", version = "0.1.30" } thiserror = "1.0.56" +workspace_hack = { version = "0.1", path = "../workspace_hack" } diff --git a/libs/persist_if_changed/Cargo.toml b/libs/persist_if_changed/Cargo.toml index f7e1cd295..bdac1b244 100644 --- a/libs/persist_if_changed/Cargo.toml +++ b/libs/persist_if_changed/Cargo.toml @@ -12,3 +12,4 @@ tracing = "0.1" fs-err = "2.7" sha2 = "0.10" anyhow = "1" +workspace_hack = { version = "0.1", path = "../workspace_hack" } diff --git a/libs/workspace_hack/.gitattributes b/libs/workspace_hack/.gitattributes new file mode 100644 index 000000000..3e9dba4b6 --- /dev/null +++ b/libs/workspace_hack/.gitattributes @@ -0,0 +1,4 @@ +# Avoid putting conflict markers in the generated Cargo.toml file, since their presence breaks +# Cargo. +# Also do not check out the file as CRLF on Windows, as that's what hakari needs. +Cargo.toml merge=binary -crlf diff --git a/libs/workspace_hack/Cargo.toml b/libs/workspace_hack/Cargo.toml new file mode 100644 index 000000000..4f238d008 --- /dev/null +++ b/libs/workspace_hack/Cargo.toml @@ -0,0 +1,95 @@ +# This file is generated by `cargo hakari`. +# To regenerate, run: +# cargo hakari generate + +[package] +name = "workspace_hack" +version = "0.1.0" +description = "workspace-hack package, managed by hakari" +license.workspace = true +# You can choose to publish this crate: see https://docs.rs/cargo-hakari/latest/cargo_hakari/publishing. +publish = false + +# The parts of the file between the BEGIN HAKARI SECTION and END HAKARI SECTION comments +# are managed by hakari. + +### BEGIN HAKARI SECTION +[dependencies] +ahash = { version = "0.8" } +aho-corasick = { version = "1" } +bitflags = { version = "2", default-features = false, features = ["serde"] } +clap = { version = "4", features = ["derive", "env"] } +clap_builder = { version = "4", default-features = false, features = ["color", "env", "help", "std", "suggestions", "usage"] } +console = { version = "0.15" } +crossbeam-utils = { version = "0.8" } +crypto-common = { version = "0.1", default-features = false, features = ["getrandom", "std"] } +deranged = { version = "0.3", default-features = false, features = ["powerfmt", "serde", "std"] } +digest = { version = "0.10", features = ["mac", "std"] } +fixedbitset = { version = "0.4" } +getrandom = { version = "0.2", default-features = false, features = ["std"] } +hashbrown = { version = "0.14", features = ["raw"] } +hmac = { version = "0.12", default-features = false, features = ["reset"] } +indexmap = { version = "2", features = ["serde"] } +log = { version = "0.4", default-features = false, features = ["std"] } +memchr = { version = "2" } +miette = { version = "6", features = ["fancy"] } +petgraph = { version = "0.6", default-features = false, features = ["graphmap", "stable_graph"] } +proc-macro2 = { version = "1", features = ["span-locations"] } +quote = { version = "1" } +regex = { version = "1" } +regex-automata = { version = "0.4", default-features = false, features = ["dfa-onepass", "hybrid", "meta", "nfa", "perf", "unicode"] } +regex-syntax = { version = "0.8" } +serde = { version = "1", features = ["alloc", "derive"] } +serde_json = { version = "1", features = ["unbounded_depth"] } +sha2 = { version = "0.10" } +smallvec = { version = "1", default-features = false, features = ["const_new"] } +subtle = { version = "2" } +syn = { version = "2", features = ["extra-traits", "full", "visit", "visit-mut"] } +time = { version = "0.3", features = ["formatting", "local-offset", "macros", "parsing", "serde"] } +tokio = { version = "1", features = ["io-util", "macros", "net", "rt", "sync", "time"] } +toml = { version = "0.8", features = ["preserve_order"] } +tracing-core = { version = "0.1" } +uuid = { version = "1", features = ["fast-rng", "v4", "v7"] } +zeroize = { version = "1" } + +[build-dependencies] +ahash = { version = "0.8" } +aho-corasick = { version = "1" } +bitflags = { version = "2", default-features = false, features = ["serde"] } +cc = { version = "1", default-features = false, features = ["parallel"] } +clap = { version = "4", features = ["derive", "env"] } +clap_builder = { version = "4", default-features = false, features = ["color", "env", "help", "std", "suggestions", "usage"] } +console = { version = "0.15" } +crossbeam-utils = { version = "0.8" } +crypto-common = { version = "0.1", default-features = false, features = ["getrandom", "std"] } +deranged = { version = "0.3", default-features = false, features = ["powerfmt", "serde", "std"] } +digest = { version = "0.10", features = ["mac", "std"] } +fixedbitset = { version = "0.4" } +getrandom = { version = "0.2", default-features = false, features = ["std"] } +hashbrown = { version = "0.14", features = ["raw"] } +hmac = { version = "0.12", default-features = false, features = ["reset"] } +indexmap = { version = "2", features = ["serde"] } +log = { version = "0.4", default-features = false, features = ["std"] } +memchr = { version = "2" } +miette = { version = "6", features = ["fancy"] } +petgraph = { version = "0.6", default-features = false, features = ["graphmap", "stable_graph"] } +proc-macro2 = { version = "1", features = ["span-locations"] } +quote = { version = "1" } +regex = { version = "1" } +regex-automata = { version = "0.4", default-features = false, features = ["dfa-onepass", "hybrid", "meta", "nfa", "perf", "unicode"] } +regex-syntax = { version = "0.8" } +serde = { version = "1", features = ["alloc", "derive"] } +serde_json = { version = "1", features = ["unbounded_depth"] } +sha2 = { version = "0.10" } +smallvec = { version = "1", default-features = false, features = ["const_new"] } +subtle = { version = "2" } +syn = { version = "2", features = ["extra-traits", "full", "visit", "visit-mut"] } +time = { version = "0.3", features = ["formatting", "local-offset", "macros", "parsing", "serde"] } +time-macros = { version = "0.2", default-features = false, features = ["formatting", "parsing", "serde"] } +tokio = { version = "1", features = ["io-util", "macros", "net", "rt", "sync", "time"] } +toml = { version = "0.8", features = ["preserve_order"] } +tracing-core = { version = "0.1" } +uuid = { version = "1", features = ["fast-rng", "v4", "v7"] } +zeroize = { version = "1" } + +### END HAKARI SECTION diff --git a/libs/workspace_hack/build.rs b/libs/workspace_hack/build.rs new file mode 100644 index 000000000..92518ef04 --- /dev/null +++ b/libs/workspace_hack/build.rs @@ -0,0 +1,2 @@ +// A build script is required for cargo to consider build dependencies. +fn main() {} diff --git a/libs/workspace_hack/src/lib.rs b/libs/workspace_hack/src/lib.rs new file mode 100644 index 000000000..22489f632 --- /dev/null +++ b/libs/workspace_hack/src/lib.rs @@ -0,0 +1 @@ +// This is a stub lib.rs.