Skip to content

Commit

Permalink
Move shared crates to workspace
Browse files Browse the repository at this point in the history
Rather than have the same entry multiple times over the different
crates, or even worse, accidentally having different versions /
features, which would cause more code to be compiled, let's have this in
a workspace.dependencies section and refer to it in the various crates.

The build times are pretty much the same

* Before: 72.4s (1m 12.4s)
* After: 73.1s (1m 13.1s)

Test Plan
=========

CI
  • Loading branch information
javierhonduco committed Oct 29, 2024
1 parent 61d3cea commit 585d859
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 109 deletions.
73 changes: 5 additions & 68 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 33 additions & 17 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,51 +11,67 @@ members = [
"lightswitch-object"
]

[dependencies]
gimli = "0.31.0"
object = "0.36.4"
[workspace.dependencies]
memmap2 = "0.9.5"
lazy_static = "1.5.0"
anyhow = "1.0.89"
thiserror = "1.0.63"
object = "0.36.4"
# TODO: Move to a release.
libbpf-rs = { git = "https://github.com/libbpf/libbpf-rs", rev="4ebf2ac7cd509e9442aff9b9f92164f252adf2a3", features = ["static"] }
perf-event-open-sys = "4.0.0"
tracing = "0.1.40"
thiserror = "1.0.63"
errno = "0.3.9"
plain = "0.2.3"
perf-event-open-sys = "4.0.0"
procfs = "0.16.0"
nix = { version = "0.29.0" }
# workspace dev dependencies have to be defined here
rand = "0.8.5"
# workspace build dependencies have to be defined here
libbpf-cargo = "0.23.3"
glob = "0.3.1"

[dependencies]
gimli = "0.31.0"
lazy_static = "1.5.0"
plain = "0.2.3"
page_size = "0.6.0"
clap = { version = "4.5.18", features = ["derive", "string"] }
blazesym = "0.2.0-rc.1"
tracing = "0.1.40"
tracing-subscriber = "0.3.18"
inferno = "0.11.21"
primal = "0.3.3"
nix = { version = "0.29.0", features = ["user"] }
prost = "0.13" # Needed to encode protocol buffers to bytes.
reqwest = { version = "0.12", features = ["blocking"] }
lightswitch-metadata-provider = {path = "./lightswitch-metadata-provider"}
lightswitch-proto = { path = "./lightswitch-proto"}
lightswitch-capabilities = {path = "./lightswitch-capabilities"}
lightswitch-object = {path = "./lightswitch-object"}
ctrlc = "3.4.5"
crossbeam-channel = "0.5.13"
libbpf-sys = "1.4.3"
itertools = "0.13.0"
lightswitch-metadata-provider = {path = "lightswitch-metadata-provider"}
lightswitch-proto = { path = "lightswitch-proto"}
lightswitch-capabilities = {path = "lightswitch-capabilities"}
lightswitch-object = {path = "lightswitch-object"}
memmap2 = { workspace = true }
anyhow = { workspace = true }
object = { workspace = true }
libbpf-rs = { workspace = true }
tracing = { workspace = true }
perf-event-open-sys = { workspace = true }
thiserror = { workspace = true }
errno = { workspace = true }
procfs = { workspace = true }
nix = { workspace = true, features = ["user"] }

[dev-dependencies]
assert_cmd = { version = "2.0.16" }
insta = { version = "1.40.0", features = ["yaml"] }
rstest = "0.23.0"
tempdir = "0.3.7"
rand = "0.8.5"
rand = { workspace = true }
criterion = "0.5.1"
tempfile = "3.13.0"

[build-dependencies]
libbpf-cargo = { workspace = true }
glob = { workspace = true }
bindgen = "0.70.1"
libbpf-cargo = "0.23.3"
glob = "0.3.1"

[profile.dev.package."*"]
opt-level = 3
Expand Down
9 changes: 6 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,17 @@
nativeBuildInputs = nativeBuildInputs;
buildInputs = buildInputs ++ [
rust-toolchain
# Debugging
# Debugging tools
strace
gdb
# Other tools
# Upload container image to registry
skopeo
# Cargo subcommand tools
## To upgrade deps
cargo-edit
# snapshot testing plugin binary
## Snapshot testing
cargo-insta
# Commented out because this is typically not cached and it's rarely used
# ocamlPackages.magic-trace
];
hardeningDisable = [ "all" ];
Expand Down
18 changes: 9 additions & 9 deletions lightswitch-capabilities/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ version = "0.1.0"
edition = "2021"

[dependencies]
anyhow = "1.0.89"
thiserror = "1.0.64"
libbpf-rs = { version = "0.23.3", features = ["static"] }
perf-event-open-sys = "4.0.0"
libc = "0.2.159"
errno = "0.3.9"
tracing = "0.1.40"
nix = { version = "0.29.0", features = ["user"] }
anyhow = { workspace = true}
thiserror = { workspace = true}
libbpf-rs = { workspace = true}
perf-event-open-sys = { workspace = true}
errno = { workspace = true}
tracing = { workspace = true}
nix = { workspace = true}

[build-dependencies]
libbpf-cargo = "0.23.3"
glob = "0.3.1"
libbpf-cargo = { workspace = true}
glob = { workspace = true}
10 changes: 5 additions & 5 deletions lightswitch-metadata-provider/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ version = "0.1.0"
edition = "2021"

[dependencies]
anyhow = "1.0.86"
lru = "0.12.4"
nix = { version = "0.29.0", features = ["user", "process"] }
procfs = "0.16.0"
tracing = "0.1.40"
thiserror = "1.0.63"
nix = { workspace = true, features = ["user", "process"] }
anyhow = { workspace = true }
procfs = { workspace = true }
tracing = { workspace = true }
thiserror = { workspace = true }
8 changes: 4 additions & 4 deletions lightswitch-object/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ version = "0.1.0"
edition = "2021"

[dependencies]
memmap2 = "0.9.5"
object = "0.36.4"
data-encoding = "2.6.0"
ring = "0.17.8"
anyhow = "*"
data-encoding = "*"
memmap2 = { workspace = true }
object = { workspace = true }
anyhow = { workspace = true }
6 changes: 3 additions & 3 deletions lightswitch-proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ edition = "2021"

[dependencies]
prost = "0.13"
anyhow = "1.0.89"
anyhow = { workspace = true }

[dev-dependencies]
rand = "0.8.5"
rand = { workspace = true }

[build-dependencies]
prost-build = "0.13.3"
prost-build = "0.13.3"

0 comments on commit 585d859

Please sign in to comment.