Skip to content

Commit

Permalink
xtask: Enforce most dependencies are specified in the workspace (#79)
Browse files Browse the repository at this point in the history
We add an `xtask` that checks that all dependencies are specified in the
root `Cargo.toml`. This will help keep things clean as we go forward.

The only exception is for architecture-specific dependencies, which
might have arch-specific feature flags.

This cleans up our existing `Cargo.toml` files to be in line with this,
and removes some unnecessary dependencies.
  • Loading branch information
swenson authored Jan 3, 2025
1 parent 8a7b2b3 commit ebb25ae
Show file tree
Hide file tree
Showing 24 changed files with 201 additions and 100 deletions.
4 changes: 1 addition & 3 deletions Cargo.lock

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

85 changes: 61 additions & 24 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ edition = "2021"
authors = ["Caliptra contributors"]

[workspace.dependencies]
arrayref = "0.3.6"
bitfield = "0.14.0"
bit-vec = "0.6.3"
chrono = {version = "0.4.38", features = ["serde"]}
clap = { version = "4.5.23", features = [
"cargo",
"derive",
Expand All @@ -71,46 +71,83 @@ clap = { version = "4.5.23", features = [
"unicode",
"wrap_help",
] }
caliptra-api-types = { git = "https://github.com/chipsalliance/caliptra-sw.git", rev = "2f6de531e321b7bb24b17b1bd02b43d2854aef3a" }
caliptra-emu-bus = { git = "https://github.com/chipsalliance/caliptra-sw.git", rev = "2f6de531e321b7bb24b17b1bd02b43d2854aef3a" }
caliptra-emu-cpu = { git = "https://github.com/chipsalliance/caliptra-sw.git", rev = "2f6de531e321b7bb24b17b1bd02b43d2854aef3a" }
caliptra-emu-periph = { git = "https://github.com/chipsalliance/caliptra-sw.git", rev = "2f6de531e321b7bb24b17b1bd02b43d2854aef3a" }
caliptra-hw-model = { git = "https://github.com/chipsalliance/caliptra-sw.git", rev = "2f6de531e321b7bb24b17b1bd02b43d2854aef3a" }
caliptra-registers = { git = "https://github.com/chipsalliance/caliptra-sw.git", rev = "2f6de531e321b7bb24b17b1bd02b43d2854aef3a" }
clap_derive = "4.5.11"
crc = "3.2.1"
crc32fast = "1.4.2"
critical-section = "1.1.2"
crossterm = "0.28.1"
ctrlc = "3.4.5"
elf = "0.7.4"
emulator-bus = { path = "emulator/bus" }
emulator-caliptra = { "path" = "emulator/caliptra" }
emulator-cpu = { path = "emulator/cpu" }
emulator-derive = { path = "emulator/derive" }
emulator-periph = { path = "emulator/periph" }
emulator-registers-generated = { path = "registers/generated-emulator" }
emulator-types = { path = "emulator/types" }
embassy-executor = { version = "0.6.3", features = ["nightly"] }
embedded-alloc = "0.5.1"
gdbstub = "0.6.3"
gdbstub_arch = "0.2.4"
getrandom = "0.2"
hex = "0.4.3"
i3c-driver = { path = "runtime/i3c" }
flash-driver = { path = "runtime/flash" }
capsules-runtime = { path = "runtime/capsules" }
lazy_static = "1.4.0"
num-derive = "0.4.2"
num_enum = "0.7.2"
num-derive = "0.4.2"
num-traits = "0.2"
portable-atomic = "1.7.0"
proc-macro2 = "1.0.66"
romtime = { path = "romtime" }
quote = "1.0"
registers-generated = { path = "registers/generated-firmware" }
registers-generator = { path = "registers/generator" }
registers-systemrdl = { path = "registers/systemrdl" }
semver = "1.0.23"
serde = { version = "1.0.209", features = ["alloc", "derive", "serde_derive"] }
serde_json = { version = "1.0.127", features = ["alloc"] }
strum = "0.24"
strum_macros = "0.24"
syn = "1.0.107"
tock-registers = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }
tempfile = "3.14.0"
toml = "0.8.19"
uuid = { version = "1.10.0", features = ["serde"]}
walkdir = "2.5.0"
zerocopy = { version = "0.8.7", features = ["derive"] }
crc = "3.2.1"

# local dependencies
capsules-runtime = { path = "runtime/capsules" }
emulator-bus = { path = "emulator/bus" }
emulator-caliptra = { "path" = "emulator/caliptra" }
emulator-cpu = { path = "emulator/cpu" }
emulator-derive = { path = "emulator/derive" }
emulator-periph = { path = "emulator/periph" }
emulator-registers-generated = { path = "registers/generated-emulator" }
emulator-types = { path = "emulator/types" }
flash-driver = { path = "runtime/flash" }
i3c-driver = { path = "runtime/i3c" }
libtockasync = { path = "runtime/apps/libtockasync" }
registers-generated = { path = "registers/generated-firmware" }
registers-generator = { path = "registers/generator" }
registers-systemrdl = { path = "registers/systemrdl" }
romtime = { path = "romtime" }

# libtock dependencies
libtock = { path = "runtime/apps/libtock" }
libtock_alarm = { path = "runtime/apps/libtock/apis/peripherals/alarm" }
libtock_console = { path = "runtime/apps/libtock/apis/interface/console" }
libtock_debug_panic = { path = "runtime/apps/libtock/panic_handlers/debug_panic" }
libtock_platform = { path = "runtime/apps/libtock/platform" }
libtock_runtime = { path = "runtime/apps/libtock/runtime" }
libtock_unittest = { path = "runtime/apps/libtock/unittest" }

# caliptra dependencies; keep git revs in sync
caliptra-api-types = { git = "https://github.com/chipsalliance/caliptra-sw.git", rev = "2f6de531e321b7bb24b17b1bd02b43d2854aef3a" }
caliptra-emu-bus = { git = "https://github.com/chipsalliance/caliptra-sw.git", rev = "2f6de531e321b7bb24b17b1bd02b43d2854aef3a" }
caliptra-emu-cpu = { git = "https://github.com/chipsalliance/caliptra-sw.git", rev = "2f6de531e321b7bb24b17b1bd02b43d2854aef3a" }
caliptra-emu-periph = { git = "https://github.com/chipsalliance/caliptra-sw.git", rev = "2f6de531e321b7bb24b17b1bd02b43d2854aef3a" }
caliptra-hw-model = { git = "https://github.com/chipsalliance/caliptra-sw.git", rev = "2f6de531e321b7bb24b17b1bd02b43d2854aef3a" }
caliptra-registers = { git = "https://github.com/chipsalliance/caliptra-sw.git", rev = "2f6de531e321b7bb24b17b1bd02b43d2854aef3a" }

# tock dependencies; keep git revs in sync
capsules-core = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }
capsules-extra = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }
capsules-system = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }
components = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }
kernel = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }
riscv = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }
riscv-csr = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }
rv32i = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }
tock-registers = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }


# Always optimize the emulator during tests, as it is a major bottleneck for
# test speed.
Expand Down
8 changes: 4 additions & 4 deletions emulator/app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ edition = "2021"

[dependencies]
caliptra-emu-cpu.workspace = true
bitfield.workspace = true
caliptra-emu-periph.workspace = true
clap.workspace = true
crc.workspace = true
crossterm.workspace = true
ctrlc.workspace = true
elf.workspace = true
Expand All @@ -23,12 +25,10 @@ emulator-types.workspace = true
gdbstub_arch.workspace = true
gdbstub.workspace = true
hex.workspace = true
strum_macros.workspace = true
strum.workspace = true
tock-registers.workspace = true
zerocopy.workspace = true
bitfield.workspace = true
crc.workspace = true
strum = "0.24"
strum_macros = "0.24"

[features]
default = []
Expand Down
6 changes: 3 additions & 3 deletions emulator/bmc/pldm-fw-pkg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ name = "pldm-fw-pkg"
path = "src/main.rs"

[dependencies]
chrono = {version = "0.4.38", features = ["serde"]}
toml = "0.8.19"
uuid = { version = "1.10.0", features = ["serde"]}
chrono.workspace = true
toml.workspace = true
uuid.workspace = true
serde.workspace = true
crc.workspace = true
clap.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion emulator/caliptra/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ caliptra-emu-periph.workspace = true
caliptra-hw-model.workspace = true
caliptra-registers.workspace = true
clap.workspace = true
ctrlc.workspace = true
elf.workspace = true
gdbstub_arch.workspace = true
gdbstub.workspace = true
hex.workspace = true
tock-registers.workspace = true
ctrlc.workspace = true
2 changes: 1 addition & 1 deletion emulator/compliance-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
clap.workspace = true
emulator-bus.workspace = true
emulator-cpu.workspace = true
emulator-types.workspace = true
clap.workspace = true
getrandom.workspace = true
2 changes: 1 addition & 1 deletion emulator/cpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bitfield.workspace = true
bit-vec.workspace = true
bitfield.workspace = true
emulator-bus.workspace = true
emulator-derive.workspace = true
emulator-types.workspace = true
Expand Down
4 changes: 0 additions & 4 deletions emulator/periph/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
arrayref.workspace = true
bitfield.workspace = true
emulator-bus.workspace = true
emulator-cpu.workspace = true
Expand All @@ -23,9 +22,6 @@ serde.workspace = true
tock-registers.workspace = true
zerocopy.workspace = true

[dev-dependencies]
libc = "0.2"

[features]
default = []
test-i3c-constant-writes = []
Expand Down
2 changes: 0 additions & 2 deletions emulator/periph/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ Abstract:
File contains exports for for Caliptra Emulator Peripheral library.
--*/
extern crate arrayref;

mod emu_ctrl;
mod flash_ctrl;
mod i3c;
Expand Down
2 changes: 1 addition & 1 deletion registers/generated-emulator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ authors.workspace = true

[dependencies]
emulator-bus.workspace = true
registers-generated.workspace = true
emulator-types.workspace = true
registers-generated.workspace = true
tock-registers.workspace = true
4 changes: 2 additions & 2 deletions registers/generator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
registers-systemrdl.workspace = true
quote.workspace = true
proc-macro2.workspace = true
quote.workspace = true
registers-systemrdl.workspace = true
4 changes: 2 additions & 2 deletions rom/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ authors.workspace = true
edition.workspace = true

[target.'cfg(target_arch = "riscv32")'.dependencies]
riscv-csr = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }
rv32i = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }
riscv-csr.workspace = true
rv32i.workspace = true
20 changes: 11 additions & 9 deletions runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,23 @@ authors.workspace = true
edition.workspace = true

[dependencies]
capsules-core = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }
capsules-extra = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }
capsules-core.workspace = true
capsules-extra.workspace = true
capsules-runtime.workspace = true
capsules-system = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }
components = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }
i3c-driver.workspace = true
capsules-system.workspace = true
components.workspace = true
flash-driver.workspace = true
kernel = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }
i3c-driver.workspace = true
kernel.workspace = true
registers-generated.workspace = true
riscv = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }
riscv-csr = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }
romtime.workspace = true
rv32i = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }
tock-registers.workspace = true

[target.'cfg(target_arch = "riscv32")'.dependencies]
riscv-csr.workspace = true
riscv.workspace = true
rv32i.workspace = true

[features]
default = []
test-i3c-simple = []
Expand Down
26 changes: 13 additions & 13 deletions runtime/apps/example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ authors.workspace = true
edition.workspace = true

[dependencies]
critical-section = "1.1.2"
embassy-executor = { version = "0.6.3", features = ["nightly"] }
libtock = { path = "../libtock" }
libtock_alarm = { path = "../libtock/apis/peripherals/alarm" }
libtock_console = { path = "../libtock/apis/interface/console" }
libtock_debug_panic = { path = "../libtock/panic_handlers/debug_panic" }
libtock_platform = { path = "../libtock/platform" }
libtock_runtime = { path = "../libtock/runtime" }
libtockasync = { path = "../libtockasync" }
portable-atomic = "1.7.0"
critical-section.workspace = true
embassy-executor.workspace = true
libtock_alarm.workspace = true
libtock_console.workspace = true
libtock_debug_panic.workspace = true
libtock_platform.workspace = true
libtock_runtime.workspace = true
libtock.workspace = true
libtockasync.workspace = true
portable-atomic.workspace = true

[target.'cfg(not(target_arch = "riscv32"))'.dependencies]
embassy-executor = { version = "0.6.3", features = ["arch-riscv32", "nightly"] }
libtock_unittest = { path = "../libtock/unittest" }
libtock_unittest.workspace = true

[target.'cfg(target_arch = "riscv32")'.dependencies]
embedded-alloc = "0.5.1"
embassy-executor = { version = "0.6.3", features = ["arch-riscv32", "nightly"] }
embedded-alloc.workspace = true
23 changes: 11 additions & 12 deletions runtime/apps/libtockasync/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,18 @@ authors.workspace = true
edition.workspace = true

[dependencies]
critical-section = "1.1.2"
embassy-executor = { version = "0.6.3", features = ["nightly"] }
libtock = { path = "../libtock" }
libtock_alarm = { path = "../libtock/apis/peripherals/alarm" }
libtock_console = { path = "../libtock/apis/interface/console" }
libtock_debug_panic = { path = "../libtock/panic_handlers/debug_panic" }
libtock_platform = { path = "../libtock/platform" }
libtock_runtime = { path = "../libtock/runtime" }
portable-atomic = "1.7.0"
critical-section.workspace = true
embassy-executor.workspace = true
libtock.workspace = true
libtock_console.workspace = true
libtock_debug_panic.workspace = true
libtock_platform.workspace = true
libtock_runtime.workspace = true
portable-atomic.workspace = true

[target.'cfg(not(target_arch = "riscv32"))'.dependencies]
embassy-executor = { version = "0.6.3", features = ["arch-riscv32", "nightly"] }
libtock_unittest = { path = "../libtock/unittest" }
libtock_unittest.workspace = true

[target.'cfg(target_arch = "riscv32")'.dependencies]
embedded-alloc = "0.5.1"
embassy-executor = { version = "0.6.3", features = ["arch-riscv32", "nightly"] }
embedded-alloc.workspace = true
11 changes: 5 additions & 6 deletions runtime/capsules/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ authors.workspace = true
edition.workspace = true

[dependencies]
kernel = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }

capsules-extra = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }
i3c-driver.workspace = true
flash-driver.workspace = true
zerocopy.workspace = true
bitfield.workspace = true
capsules-extra.workspace = true
flash-driver.workspace = true
i3c-driver.workspace = true
kernel.workspace = true
romtime.workspace = true
zerocopy.workspace = true
3 changes: 1 addition & 2 deletions runtime/dma/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ authors.workspace = true
edition.workspace = true

[dependencies]
kernel = { git = "https://github.com/tock/tock.git", rev = "b128ae817b86706c8c4e39d27fae5c54b98659f1" }

kernel.workspace = true
Loading

0 comments on commit ebb25ae

Please sign in to comment.