Browse Source

cargo: Define dependencies on the workspace level

This way we will avoid version mismatches and make differences in
features across our crates clearer.
Mike Rostecki 1 year ago
parent
commit
96fa08bd82

+ 42 - 0
Cargo.toml

@@ -40,6 +40,48 @@ default-members = [
     # CARGO_CFG_BPF_TARGET_ARCH={x86_64,aarch64,arm,riscv64}
 ]
 
+# NOTE(vadorovsky): Neither cargo-udeps nor cargo-machete are able to detect
+# unused crates defined in this section. It would be nice to teach either of
+# them to do that, but in the meantime we need to be careful.
+[workspace.dependencies]
+anyhow = { version = "1", default-features = false }
+assert_matches = { version = "1.5.0", default-features = false }
+async-io = { version = "1.3", default-features = false }
+aya = { path = "aya", version = "0.11.0", default-features = false }
+aya-bpf = { path = "bpf/aya-bpf", default-features = false }
+aya-log = { path = "aya-log", default-features = false }
+aya-log-common = { path = "aya-log-common", version = "0.1.13", default-features = false }
+aya-log-parser = { path = "aya-log-parser", default-features = false }
+aya-obj = { path = "aya-obj", version = "0.1.0", default-features = false }
+aya-tool = { path = "aya-tool", default-features = false }
+bindgen = { version = "0.66", default-features = false }
+bitflags = { version = "2.2.1", default-features = false }
+bytes = { version = "1", default-features = false }
+cargo_metadata = { version = "0.15.4", default-features = false }
+clap = { version = "4", default-features = false }
+core-error = { version = "0.0.0", default-features = false }
+env_logger = { version = "0.10", default-features = false }
+futures = { version = "0.3.12", default-features = false }
+hashbrown = { version = "0.14", default-features = false }
+indoc = { version = "2.0", default-features = false }
+integration-ebpf = { path = "test/integration-ebpf", default-features = false }
+lazy_static = { version = "1", default-features = false }
+libc = { version = "0.2.105", default-features = false }
+log = { version = "0.4", default-features = false }
+num_enum = { version = "0.6", default-features = false }
+object = { version = "0.31", default-features = false }
+parking_lot = { version = "0.12.0", default-features = false }
+proc-macro2 = { version = "1", default-features = false }
+quote = { version = "1", default-features = false }
+rbpf = { version = "0.2.0", default-features = false }
+syn = { version = "2", default-features = false }
+tempfile = { version = "3", default-features = false }
+testing_logger = { version = "0.1.1", default-features = false }
+thiserror = { version = "1", default-features = false }
+tokio = { version = "1.24.0", default-features = false }
+which = { version = "4.4.0", default-features = false }
+xtask = { path = "xtask", default-features = false }
+
 [profile.dev]
 panic = "abort"
 

+ 4 - 4
aya-bpf-macros/Cargo.toml

@@ -8,9 +8,9 @@ edition = "2021"
 proc-macro = true
 
 [dependencies]
-proc-macro2 = "1.0"
-quote = "1.0"
-syn = { version = "2.0", features = ["full"] }
+proc-macro2 = { workspace = true }
+quote = { workspace = true }
+syn = { workspace = true, default-features = true, features = ["full"] }
 
 [dev-dependencies]
-aya-bpf = { path = "../bpf/aya-bpf" }
+aya-bpf = { workspace = true }

+ 1 - 1
aya-log-common/Cargo.toml

@@ -10,7 +10,7 @@ documentation = "https://docs.rs/aya-log"
 edition = "2021"
 
 [dependencies]
-num_enum = { version = "0.6", default-features = false }
+num_enum = { workspace = true }
 
 [lib]
 path = "src/lib.rs"

+ 5 - 5
aya-log-ebpf-macros/Cargo.toml

@@ -4,11 +4,11 @@ version = "0.1.0"
 edition = "2021"
 
 [dependencies]
-aya-log-common = { path = "../aya-log-common" }
-aya-log-parser = { path = "../aya-log-parser" }
-proc-macro2 = "1.0"
-quote = "1.0"
-syn = "2.0"
+aya-log-common = { workspace = true }
+aya-log-parser = { workspace = true }
+proc-macro2 = { workspace = true }
+quote = { workspace = true }
+syn = { workspace = true }
 
 [lib]
 proc-macro = true

+ 1 - 1
aya-log-parser/Cargo.toml

@@ -4,7 +4,7 @@ version = "0.1.11-dev.0"
 edition = "2021"
 
 [dependencies]
-aya-log-common = { path = "../aya-log-common" }
+aya-log-common = { workspace = true }
 
 [lib]
 path = "src/lib.rs"

+ 8 - 8
aya-log/Cargo.toml

@@ -11,16 +11,16 @@ documentation = "https://docs.rs/aya-log"
 edition = "2021"
 
 [dependencies]
-aya = { path = "../aya", version = "0.11.0", features = ["async_tokio"] }
-aya-log-common = { path = "../aya-log-common", version = "0.1.13" }
-thiserror = "1"
-log = "0.4"
-bytes = "1.1"
-tokio = { version = "1.24" }
+aya = { workspace = true, features = ["async_tokio"] }
+aya-log-common = { workspace = true }
+bytes = { workspace = true }
+log = { workspace = true }
+thiserror = { workspace = true }
+tokio = { workspace = true, features = ["rt"] }
 
 [dev-dependencies]
-env_logger = "0.10"
-testing_logger = "0.1.1"
+env_logger = { workspace = true }
+testing_logger = { workspace = true }
 
 [lib]
 path = "src/lib.rs"

+ 8 - 8
aya-obj/Cargo.toml

@@ -11,19 +11,19 @@ documentation = "https://docs.rs/aya-obj"
 edition = "2021"
 
 [dependencies]
-bytes = "1"
-log = "0.4"
-object = { version = "0.31", default-features = false, features = [
+bytes = { workspace = true }
+core-error = { workspace = true, default-features = true }
+hashbrown = { workspace = true, default-features = true }
+log = { workspace = true }
+object = { workspace = true, default-features = false, features = [
     "elf",
     "read_core",
 ] }
-hashbrown = { version = "0.14" }
-thiserror = { version = "1", default-features = false }
-core-error = { version = "0.0.0" }
+thiserror = { workspace = true, default-features = false }
 
 [dev-dependencies]
-assert_matches = "1.5.0"
-rbpf = "0.2.0"
+assert_matches = { workspace = true }
+rbpf = { workspace = true }
 
 [features]
 std = []

+ 5 - 5
aya-tool/Cargo.toml

@@ -5,8 +5,8 @@ authors = ["Alessandro Decina <[email protected]>"]
 edition = "2021"
 
 [dependencies]
-bindgen = "0.66"
-clap = { version = "4", features = ["derive"] }
-anyhow = "1"
-thiserror = "1"
-tempfile = "3"
+bindgen = { workspace = true, default-features = true }
+clap = { workspace = true, default-features = true, features = ["derive"] }
+anyhow = { workspace = true, default-features = true }
+thiserror = { workspace = true }
+tempfile = { workspace = true }

+ 14 - 14
aya/Cargo.toml

@@ -11,26 +11,26 @@ documentation = "https://docs.rs/aya"
 edition = "2021"
 
 [dependencies]
-async-io = { version = "1.3", optional = true }
-aya-obj = { path = "../aya-obj", version = "0.1.0", features = ["std"] }
-bitflags = "2.2.1"
-bytes = "1"
-lazy_static = "1"
-libc = { version = "0.2.105" }
-log = "0.4"
-object = { version = "0.31", default-features = false, features = [
+async-io = { workspace = true, optional = true }
+aya-obj = { workspace = true, features = ["std"] }
+bitflags = { workspace = true }
+bytes = { workspace = true }
+lazy_static = { workspace = true }
+libc = { workspace = true }
+log = { workspace = true }
+object = { workspace = true, default-features = false, features = [
     "elf",
     "read_core",
     "std",
 ] }
-parking_lot = { version = "0.12.0", features = ["send_guard"] }
-thiserror = "1"
-tokio = { version = "1.24.0", features = ["rt"], optional = true }
+parking_lot = { workspace = true }
+thiserror = { workspace = true }
+tokio = { workspace = true, features = ["rt"], optional = true }
 
 [dev-dependencies]
-assert_matches = "1.5.0"
-futures = { version = "0.3.12", default-features = false, features = ["std"] }
-tempfile = "3"
+assert_matches = { workspace = true }
+futures = { workspace = true }
+tempfile = { workspace = true }
 
 [features]
 default = []

+ 12 - 16
test/integration-test/Cargo.toml

@@ -5,26 +5,22 @@ edition = "2021"
 publish = false
 
 [dependencies]
-anyhow = "1"
-assert_matches = "1.5.0"
-aya = { path = "../../aya" }
-aya-log = { path = "../../aya-log" }
-aya-obj = { path = "../../aya-obj" }
-libc = { version = "0.2.105" }
-log = "0.4"
-object = { version = "0.31", default-features = false, features = [
-    "elf",
-    "read_core",
-    "std",
-] }
-rbpf = "0.2.0"
-tokio = { version = "1.24", default-features = false, features = [
+anyhow = { workspace = true, default-features = true }
+assert_matches = { workspace = true }
+aya = { workspace = true }
+aya-log = { workspace = true }
+aya-obj = { workspace = true }
+libc = { workspace = true }
+log = { workspace = true }
+object = { workspace = true }
+rbpf = { workspace = true }
+tokio = { workspace = true, default-features = false, features = [
     "macros",
     "time",
 ] }
 
 [build-dependencies]
-cargo_metadata = { version = "0.15.4", default-features = false }
+cargo_metadata = { workspace = true }
 # TODO(https://github.com/rust-lang/cargo/issues/12375): this should be an artifact dependency, but
 # it's not possible to tell cargo to use `-Z build-std` to build it. We cargo-in-cargo in the build
 # script to build this, but we want to teach cargo about the dependecy so that cache invalidation
@@ -38,4 +34,4 @@ cargo_metadata = { version = "0.15.4", default-features = false }
 # workflows with stable cargo; stable cargo outright refuses to load manifests that use unstable
 # features.
 integration-ebpf = { path = "../integration-ebpf" }
-xtask = { path = "../../xtask" }
+xtask = { workspace = true }

+ 10 - 10
xtask/Cargo.toml

@@ -5,13 +5,13 @@ authors = ["Alessandro Decina <[email protected]>"]
 edition = "2021"
 
 [dependencies]
-anyhow = "1"
-aya-tool = { path = "../aya-tool" }
-cargo_metadata = "0.15.4"
-clap = { version = "4", features = ["derive"] }
-indoc = "2.0"
-proc-macro2 = "1"
-quote = "1"
-syn = "2"
-tempfile = "3"
-which = { version = "4.4.0", default-features = false }
+anyhow = { workspace = true, default-features = true }
+aya-tool = { workspace = true }
+cargo_metadata = { workspace = true }
+clap = { workspace = true, default-features = true, features = ["derive"] }
+indoc = { workspace = true }
+proc-macro2 = { workspace = true }
+quote = { workspace = true }
+syn = { workspace = true }
+tempfile = { workspace = true }
+which = { workspace = true }