From 13fff3be70cf063dc40c9b920f28ba2a748fd8a1 Mon Sep 17 00:00:00 2001 From: Austin Seipp Date: Sat, 5 Aug 2023 11:14:11 -0500 Subject: [PATCH] cargo: unify dependency versions through workspace deps Summary: This moves all dependencies across the jj-lib and jj-cli crates into the top-level Cargo file; with that, we can change each crate instead to just inherit the workspace version, with the toggled features enabled, by setting a dependency such as: dep.workspace = true in the relevant Cargo.toml file. This doesn't actually change any of the build semantics (from what I can tell) nor the lockfile, and seems to respond normally. There are more cleanups that can follow. Two notes: - Dependabot seems to work fine, based on what I've seen in other repos. - `cargo add` doesn't seem to know how to add packages to a top-level `workspace.dependencies` field; instead you can `cargo add -p jj-cli` and move the entries, at least. Signed-off-by: Austin Seipp Change-Id: I307827e5f15c0d8ea8e2a80ec793d3c7 --- Cargo.toml | 77 ++++++++++++++++++++++++++++++++++++ cli/Cargo.toml | 80 ++++++++++++++++++------------------- lib/Cargo.toml | 83 ++++++++++++++++++--------------------- lib/gen-protos/Cargo.toml | 2 +- lib/testutils/Cargo.toml | 12 +++--- 5 files changed, 162 insertions(+), 92 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 01685b96e..db6c616b0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,83 @@ cargo-features = [] resolver = "2" members = ["cli", "lib", "lib/testutils", "lib/gen-protos"] +[workspace.dependencies] +anyhow = "1.0.72" +assert_cmd = "2.0.8" +assert_matches = "1.5.0" +backoff = "0.4.0" +blake2 = "0.10.6" +byteorder = "1.4.3" +bytes = "1.4.0" +cargo_metadata = "0.17.0" +clap = { version = "4.3.19", features = ["derive", "deprecated"] } +clap_complete = "4.3.2" +clap_mangen = "0.2.10" +chrono = { version = "0.4.26", default-features = false, features = [ + "std", + "clock", +] } +config = { version = "0.13.2", default-features = false, features = ["toml"] } +criterion = "0.5.1" +crossterm = { version = "0.26", default-features = false } +digest = "0.10.7" +dirs = "5.0.1" +esl01-renderdag = "0.3.0" +glob = "0.3.1" +git2 = "0.17.2" +hex = "0.4.3" +itertools = "0.11.0" +indexmap = "2.0.0" +libc = { version = "0.2.147" } +insta = { version = "1.31.0", features = ["filters"] } +maplit = "1.0.2" +num_cpus = "1.16.0" +once_cell = "1.18.0" +pest = "2.7.2" +pest_derive = "2.7.2" +prost = "0.11.9" +prost-build = "0.11.9" +rand = "0.8.5" +rand_chacha = "0.3.1" +rayon = "1.7.0" +regex = "1.9.1" +rpassword = "7.2.0" +rustix = { version = "0.38.6", features = ["fs"] } +smallvec = { version = "1.11.0", features = [ + "const_generics", + "const_new", + "union", +] } +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0.104" +slab = "0.4.8" +strsim = "0.10.0" +tempfile = "3.7.0" +test-case = "3.1.0" +textwrap = "0.16.0" +thiserror = "1.0.44" +timeago = { version = "0.4.1", default-features = false } +toml_edit = { version = "0.19.14", features = ["serde"] } +tracing = "0.1.37" +tracing-chrome = "0.7.1" +tracing-subscriber = { version = "0.3.17", default-features = false, features = [ + "std", + "ansi", + "env-filter", + "fmt", +] } +tokio = { version = "1.29.1" } +watchman_client = { version = "0.8.0" } +whoami = "1.4.1" +version_check = "0.9.4" +zstd = "0.12.4" + +# put all inter-workspace libraries, i.e. those that use 'path = ...' here in +# their own (alphabetically sorted) block + +jj-lib = { path = "lib" } +testutils = { path = "lib/testutils" } + [profile.release] strip = "debuginfo" codegen-units = 1 diff --git a/cli/Cargo.toml b/cli/Cargo.toml index af9d460b7..ce8adc05a 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -3,7 +3,7 @@ name = "jj-cli" version = "0.8.0" authors = ["Martin von Zweigbergk "] edition = "2021" -rust-version = "1.71" # Remember to update CI, and contributing.md +rust-version = "1.71" # Remember to update CI, and contributing.md license = "Apache-2.0" description = "Jujutsu (an experimental VCS)" homepage = "https://github.com/martinvonz/jj" @@ -27,51 +27,51 @@ name = "fake-diff-editor" path = "testing/fake-diff-editor.rs" [build-dependencies] -cargo_metadata = "0.17.0" +cargo_metadata.workspace = true [dependencies] -chrono = { version = "0.4.26", default-features = false, features = ["std", "clock"] } -clap = { version = "4.3.19", features = ["derive", "deprecated"] } -clap_complete = "4.3.2" -clap_mangen = "0.2.10" -config = { version = "0.13.3", default-features = false, features = ["toml"] } -criterion = {version = "0.5.1", optional = true } -crossterm = { version = "0.26", default-features = false } -dirs = "5.0.1" -esl01-renderdag = "0.3.0" -git2 = "0.17.2" -glob = "0.3.1" -hex = "0.4.3" -indexmap = "2.0.0" -itertools = "0.11.0" -jj-lib = { version = "=0.8.0", path = "../lib", default-features = false } -maplit = "1.0.2" -once_cell = "1.18.0" -pest = "2.7.2" -pest_derive = "2.7.2" -regex = "1.9.1" -rpassword = "7.2.0" -serde = { version = "1.0", features = ["derive"] } -slab = "0.4.8" -tempfile = "3.7.0" -textwrap = "0.16.0" -thiserror = "1.0.44" -timeago = { version = "0.4.1", default-features = false } -toml_edit = { version = "0.19.14", features = ["serde"] } -tracing = "0.1.37" -tracing-chrome = "0.7.1" -tracing-subscriber = { version = "0.3.17", default-features = false, features = ["std", "ansi", "env-filter", "fmt"] } +chrono.workspace = true +clap.workspace = true +clap_complete.workspace = true +clap_mangen.workspace = true +config.workspace = true +criterion = { workspace = true, optional = true } +crossterm.workspace = true +dirs.workspace = true +esl01-renderdag.workspace = true +git2.workspace = true +glob.workspace = true +hex.workspace = true +indexmap.workspace = true +itertools.workspace = true +jj-lib.workspace = true +maplit.workspace = true +once_cell.workspace = true +pest.workspace = true +pest_derive.workspace = true +regex.workspace = true +rpassword.workspace = true +serde.workspace = true +slab.workspace = true +tempfile.workspace = true +textwrap.workspace = true +thiserror.workspace = true +timeago.workspace = true +toml_edit.workspace = true +tracing.workspace = true +tracing-chrome.workspace = true +tracing-subscriber.workspace = true [target.'cfg(unix)'.dependencies] -libc = { version = "0.2.147" } +libc.workspace = true [dev-dependencies] -anyhow = "1.0.72" -assert_cmd = "2.0.8" -assert_matches = "1.5.0" -insta = { version = "1.31.0", features = ["filters"] } -test-case = "3.1.0" -testutils = { path = "../lib/testutils" } +anyhow.workspace = true +assert_cmd.workspace = true +assert_matches.workspace = true +insta.workspace = true +test-case.workspace = true +testutils.workspace = true [features] default = [] diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 0dfdc4c0b..38399c1c1 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -18,57 +18,50 @@ name = "diff_bench" harness = false [build-dependencies] -version_check = "0.9.4" +version_check.workspace = true [dependencies] -backoff = "0.4.0" -blake2 = "0.10.6" -byteorder = "1.4.3" -bytes = "1.4.0" -chrono = { version = "0.4.26", default-features = false, features = [ - "std", - "clock", -] } -config = { version = "0.13.3", default-features = false, features = ["toml"] } -digest = "0.10.7" -git2 = "0.17.2" -hex = "0.4.3" -itertools = "0.11.0" -maplit = "1.0.2" -once_cell = "1.18.0" -pest = "2.7.2" -pest_derive = "2.7.2" -prost = "0.11.9" -rand = "0.8.5" -rand_chacha = "0.3.1" -rayon = "1.7.0" -regex = "1.9.1" -serde_json = "1.0.104" -smallvec = { version = "1.11.0", features = [ - "const_generics", - "const_new", - "union", -] } -strsim = "0.10.0" -tempfile = "3.7.0" -thiserror = "1.0.44" -tokio = { version = "1.29.1", optional = true } -tracing = "0.1.37" -watchman_client = { version = "0.8.0", optional = true } -whoami = "1.4.1" -zstd = "0.12.4" +backoff.workspace = true +blake2.workspace = true +byteorder.workspace = true +bytes.workspace = true +chrono.workspace = true +config.workspace = true +digest.workspace = true +git2.workspace = true +hex.workspace = true +itertools.workspace = true +maplit.workspace = true +once_cell.workspace = true +pest.workspace = true +pest_derive.workspace = true +prost.workspace = true +rand.workspace = true +rand_chacha.workspace = true +rayon.workspace = true +regex.workspace = true +serde_json.workspace = true +smallvec.workspace = true +strsim.workspace = true +tempfile.workspace = true +thiserror.workspace = true +tokio = { workspace = true, optional = true } +tracing.workspace = true +watchman_client = { workspace = true, optional = true } +whoami.workspace = true +zstd.workspace = true [target.'cfg(unix)'.dependencies] -rustix = { version = "0.38.6", features = ["fs"] } +rustix.workspace = true [dev-dependencies] -assert_matches = "1.5.0" -criterion = "0.5.1" -esl01-renderdag = "0.3.0" -insta = "1.31.0" -num_cpus = "1.16.0" -test-case = "3.1.0" -testutils = { path = "testutils" } +assert_matches.workspace = true +criterion.workspace = true +esl01-renderdag.workspace = true +insta.workspace = true +num_cpus.workspace = true +test-case.workspace = true +testutils.workspace = true [features] default = [] diff --git a/lib/gen-protos/Cargo.toml b/lib/gen-protos/Cargo.toml index 2123e294a..4b6a10efc 100644 --- a/lib/gen-protos/Cargo.toml +++ b/lib/gen-protos/Cargo.toml @@ -6,4 +6,4 @@ license = "Apache-2.0" publish = false [dependencies] -prost-build = "0.11.9" +prost-build.workspace = true diff --git a/lib/testutils/Cargo.toml b/lib/testutils/Cargo.toml index c2859be9a..85e748b26 100644 --- a/lib/testutils/Cargo.toml +++ b/lib/testutils/Cargo.toml @@ -15,9 +15,9 @@ publish = false # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -config = { version = "0.13.2", default-features = false, features = ["toml"] } -git2 = "0.17.2" -itertools = "0.11.0" -jj-lib = { path = ".." } -rand = "0.8.5" -tempfile = "3.7.0" +config.workspace = true +git2.workspace = true +itertools.workspace = true +jj-lib.workspace = true +rand.workspace = true +tempfile.workspace = true