From 3769ad9c0dcb7cd06b92ac3d997ca9862ad5169b Mon Sep 17 00:00:00 2001 From: Ruoqing He Date: Wed, 9 Apr 2025 03:50:30 +0000 Subject: [PATCH] runtime-rs: Group local dependencies Judging by the layout of the `Cargo.toml` files, local dependencies are intentionally separated from other dependencies, let's enforce it workspace-wise. Signed-off-by: Ruoqing He --- src/runtime-rs/crates/agent/Cargo.toml | 3 +- src/runtime-rs/crates/hypervisor/Cargo.toml | 34 +++++++++---------- .../crates/hypervisor/ch-config/Cargo.toml | 5 +-- src/runtime-rs/crates/persist/Cargo.toml | 8 +++-- src/runtime-rs/crates/resource/Cargo.toml | 7 ++-- src/runtime-rs/crates/runtimes/Cargo.toml | 5 +-- .../crates/runtimes/common/Cargo.toml | 4 ++- .../runtimes/linux_container/Cargo.toml | 1 + .../crates/runtimes/virt_container/Cargo.toml | 5 +-- .../crates/runtimes/wasm_container/Cargo.toml | 1 + src/runtime-rs/crates/service/Cargo.toml | 5 +-- src/runtime-rs/crates/shim-ctl/Cargo.toml | 5 +-- src/runtime-rs/crates/shim/Cargo.toml | 5 ++- src/runtime-rs/tests/utils/Cargo.toml | 2 ++ 14 files changed, 54 insertions(+), 36 deletions(-) diff --git a/src/runtime-rs/crates/agent/Cargo.toml b/src/runtime-rs/crates/agent/Cargo.toml index 0213a65a26..8d92a5db0a 100644 --- a/src/runtime-rs/crates/agent/Cargo.toml +++ b/src/runtime-rs/crates/agent/Cargo.toml @@ -22,10 +22,11 @@ tokio = { version = "1.38.0", features = ["fs", "rt"] } tracing = "0.1.36" url = "2.2.2" nix = "0.24.2" +oci-spec = { version = "0.6.8", features = ["runtime"] } +# Local dependencies kata-types = { path = "../../../libs/kata-types"} logging = { path = "../../../libs/logging"} -oci-spec = { version = "0.6.8", features = ["runtime"] } protocols = { path = "../../../libs/protocols", features=["async"] } [features] diff --git a/src/runtime-rs/crates/hypervisor/Cargo.toml b/src/runtime-rs/crates/hypervisor/Cargo.toml index d655d01629..84a14adde0 100644 --- a/src/runtime-rs/crates/hypervisor/Cargo.toml +++ b/src/runtime-rs/crates/hypervisor/Cargo.toml @@ -14,7 +14,6 @@ async-trait = "0.1.48" go-flag = "0.1.0" libc = ">=0.2.39" nix = "0.24.2" -persist = { path = "../persist" } rust-ini = "0.18.0" seccompiler = "0.2.0" serde = { version = "1.0.138", features = ["derive"] } @@ -30,26 +29,28 @@ lazy_static = "1.4" tracing = "0.1.36" ttrpc = { version = "0.8.4", features = ["async"] } protobuf = "=3.7.1" +oci-spec = { version = "0.6.8", features = ["runtime"] } +futures = "0.3.25" +safe-path = "0.1.0" +crossbeam-channel = "0.5.6" +tempdir = "0.3.7" +qapi = { version = "0.14", features = ["qmp", "async-tokio-all"] } +qapi-spec = "0.3.1" +qapi-qmp = "0.14.0" +hyperlocal = "0.8.0" +hyper = { version = "0.14.18", features = ["client"] } +# Local dependencies kata-sys-util = { path = "../../../libs/kata-sys-util" } kata-types = { path = "../../../libs/kata-types" } logging = { path = "../../../libs/logging" } protocols = { path = "../../../libs/protocols", features = ["async"] } shim-interface = { path = "../../../libs/shim-interface" } -oci-spec = { version = "0.6.8", features = ["runtime"] } - +persist = { path = "../persist" } ch-config = { path = "ch-config", optional = true } tests_utils = { path = "../../tests/utils" } -futures = "0.3.25" -safe-path = "0.1.0" -crossbeam-channel = "0.5.6" -tempdir = "0.3.7" - -qapi = { version = "0.14", features = ["qmp", "async-tokio-all"] } -qapi-spec = "0.3.1" -qapi-qmp = "0.14.0" - +# Local dependencies: Dragonball dragonball = { path = "../../../dragonball", features = [ "atomic-guest-memory", "virtio-vsock", @@ -65,8 +66,6 @@ dragonball = { path = "../../../dragonball", features = [ "host-device", ], optional = true } dbs-utils = { path = "../../../dragonball/dbs_utils" } -hyperlocal = "0.8.0" -hyper = { version = "0.14.18", features = ["client"] } [features] default = [] @@ -77,15 +76,14 @@ dragonball = ["dep:dragonball"] cloud-hypervisor = ["ch-config"] [dev-dependencies] +serial_test = "2.0.0" + +# Local dev-dependencies # Force the CH tests to run, even when the feature is not enabled for # a normal build. hypervisor = { path = ".", features = ["cloud-hypervisor"] } - test-utils = { path = "../../../libs/test-utils" } -serial_test = "2.0.0" - - [build-dependencies] ttrpc-codegen = "0.4.2" diff --git a/src/runtime-rs/crates/hypervisor/ch-config/Cargo.toml b/src/runtime-rs/crates/hypervisor/ch-config/Cargo.toml index 7761faadff..0ec956ab65 100644 --- a/src/runtime-rs/crates/hypervisor/ch-config/Cargo.toml +++ b/src/runtime-rs/crates/hypervisor/ch-config/Cargo.toml @@ -14,6 +14,8 @@ anyhow = "1.0.68" serde = { version = "1.0.145", features = ["rc", "derive"] } serde_json = "1.0.91" tokio = { version = "1.38.0", features = ["sync", "rt"] } +nix = "0.26.2" +thiserror = "1.0.38" # Cloud Hypervisor public HTTP API functions # Note that the version specified is not necessarily the version of CH @@ -21,7 +23,6 @@ tokio = { version = "1.38.0", features = ["sync", "rt"] } # which is relatively static. api_client = { git = "https://github.com/cloud-hypervisor/cloud-hypervisor", crate = "api_client", tag = "v27.0" } +# Local dependencies kata-types = { path = "../../../../libs/kata-types"} kata-sys-util = { path = "../../../../libs/kata-sys-util"} -nix = "0.26.2" -thiserror = "1.0.38" diff --git a/src/runtime-rs/crates/persist/Cargo.toml b/src/runtime-rs/crates/persist/Cargo.toml index 2454802473..e59ac05f11 100644 --- a/src/runtime-rs/crates/persist/Cargo.toml +++ b/src/runtime-rs/crates/persist/Cargo.toml @@ -8,10 +8,12 @@ license = "Apache-2.0" [dependencies] async-trait = "0.1.48" anyhow = "^1.0" -kata-sys-util = { path = "../../../libs/kata-sys-util"} -kata-types = { path = "../../../libs/kata-types" } -shim-interface = { path = "../../../libs/shim-interface" } libc = "0.2" serde = { version = "1.0.138", features = ["derive"] } serde_json = "1.0.82" + +# Local dependencies +kata-sys-util = { path = "../../../libs/kata-sys-util"} +kata-types = { path = "../../../libs/kata-types" } +shim-interface = { path = "../../../libs/shim-interface" } safe-path = { path = "../../../libs/safe-path"} diff --git a/src/runtime-rs/crates/resource/Cargo.toml b/src/runtime-rs/crates/resource/Cargo.toml index a8d750dcf1..cbbc6cba9f 100644 --- a/src/runtime-rs/crates/resource/Cargo.toml +++ b/src/runtime-rs/crates/resource/Cargo.toml @@ -6,9 +6,11 @@ edition = "2018" license = "Apache-2.0" [dev-dependencies] -test-utils = { path = "../../../libs/test-utils" } tempfile = "3.2.0" +# Local dev-dependencies +test-utils = { path = "../../../libs/test-utils" } + [dependencies] anyhow = "^1.0" actix-rt = "2.7.0" @@ -33,13 +35,14 @@ slog-scope = "4.4.0" tokio = { version = "1.38.0", features = ["process"] } tracing = "0.1.36" uuid = { version = "0.4", features = ["v4"] } +oci-spec = { version = "0.6.8", features = ["runtime"] } +# Local dependencies agent = { path = "../agent" } hypervisor = { path = "../hypervisor" } kata-types = { path = "../../../libs/kata-types" } kata-sys-util = { path = "../../../libs/kata-sys-util" } logging = { path = "../../../libs/logging" } -oci-spec = { version = "0.6.8", features = ["runtime"] } persist = { path = "../persist"} tests_utils = { path = "../../tests/utils" } diff --git a/src/runtime-rs/crates/runtimes/Cargo.toml b/src/runtime-rs/crates/runtimes/Cargo.toml index 1f1bd04176..21e807cff7 100644 --- a/src/runtime-rs/crates/runtimes/Cargo.toml +++ b/src/runtime-rs/crates/runtimes/Cargo.toml @@ -24,20 +24,21 @@ nix = "0.25.0" url = "2.3.1" procfs = "0.12.0" prometheus = { version = "0.13.0", features = ["process"] } +oci-spec = { version = "0.6.8", features = ["runtime"] } +# Local dependencies agent = { path = "../agent" } common = { path = "./common" } kata-types = { path = "../../../libs/kata-types" } kata-sys-util = { path = "../../../libs/kata-sys-util" } logging = { path = "../../../libs/logging"} runtime-spec = { path = "../../../libs/runtime-spec" } -oci-spec = { version = "0.6.8", features = ["runtime"] } shim-interface = { path = "../../../libs/shim-interface" } persist = { path = "../persist" } hypervisor = { path = "../hypervisor" } resource = { path = "../resource" } -# runtime handler +# Local dependencies: runtime handler linux_container = { path = "./linux_container", optional = true } virt_container = { path = "./virt_container", optional = true } wasm_container = { path = "./wasm_container", optional = true } diff --git a/src/runtime-rs/crates/runtimes/common/Cargo.toml b/src/runtime-rs/crates/runtimes/common/Cargo.toml index 55414c9950..ed3c6fc2c2 100644 --- a/src/runtime-rs/crates/runtimes/common/Cargo.toml +++ b/src/runtime-rs/crates/runtimes/common/Cargo.toml @@ -21,11 +21,13 @@ strum = { version = "0.24.0", features = ["derive"] } thiserror = "^1.0" tokio = { version = "1.38.0", features = ["rt-multi-thread", "process", "fs"] } ttrpc = "0.8.4" +oci-spec = { version = "0.6.8", features = ["runtime"] } + +# Local dependencies persist = { path = "../../persist" } agent = { path = "../../agent" } kata-sys-util = { path = "../../../../libs/kata-sys-util" } kata-types = { path = "../../../../libs/kata-types" } runtime-spec = { path = "../../../../libs/runtime-spec" } -oci-spec = { version = "0.6.8", features = ["runtime"] } resource = { path = "../../resource" } protocols = { path = "../../../../libs/protocols"} diff --git a/src/runtime-rs/crates/runtimes/linux_container/Cargo.toml b/src/runtime-rs/crates/runtimes/linux_container/Cargo.toml index 235087a712..80499f7514 100644 --- a/src/runtime-rs/crates/runtimes/linux_container/Cargo.toml +++ b/src/runtime-rs/crates/runtimes/linux_container/Cargo.toml @@ -9,6 +9,7 @@ anyhow = "^1.0" async-trait = "0.1.48" tokio = { version = "1.38.0" } +# Local dependencies common = { path = "../common" } kata-types = { path = "../../../../libs/kata-types" } resource = { path = "../../resource" } diff --git a/src/runtime-rs/crates/runtimes/virt_container/Cargo.toml b/src/runtime-rs/crates/runtimes/virt_container/Cargo.toml index a2e47e16f7..c1080f6247 100644 --- a/src/runtime-rs/crates/runtimes/virt_container/Cargo.toml +++ b/src/runtime-rs/crates/runtimes/virt_container/Cargo.toml @@ -26,7 +26,10 @@ toml = "0.4.2" url = "2.1.1" async-std = "1.12.0" tracing = "0.1.36" +oci-spec = { version = "0.6.8", features = ["runtime"] } +strum = { version = "0.24.0", features = ["derive"] } +# Local dependencies agent = { path = "../../agent" } common = { path = "../common" } hypervisor = { path = "../../hypervisor", features = ["cloud-hypervisor"] } @@ -34,10 +37,8 @@ kata-sys-util = { path = "../../../../libs/kata-sys-util" } kata-types = { path = "../../../../libs/kata-types" } logging = { path = "../../../../libs/logging"} runtime-spec = { path = "../../../../libs/runtime-spec" } -oci-spec = { version = "0.6.8", features = ["runtime"] } persist = { path = "../../persist"} resource = { path = "../../resource" } -strum = { version = "0.24.0", features = ["derive"] } [features] default = ["cloud-hypervisor"] diff --git a/src/runtime-rs/crates/runtimes/wasm_container/Cargo.toml b/src/runtime-rs/crates/runtimes/wasm_container/Cargo.toml index 4775b5a727..e40fa311ad 100644 --- a/src/runtime-rs/crates/runtimes/wasm_container/Cargo.toml +++ b/src/runtime-rs/crates/runtimes/wasm_container/Cargo.toml @@ -9,6 +9,7 @@ anyhow = "^1.0" async-trait = "0.1.48" tokio = { version = "1.38.0" } +# Local dependencies common = { path = "../common" } kata-types = { path = "../../../../libs/kata-types" } resource = { path = "../../resource" } diff --git a/src/runtime-rs/crates/service/Cargo.toml b/src/runtime-rs/crates/service/Cargo.toml index 03caee1740..780e9911b9 100644 --- a/src/runtime-rs/crates/service/Cargo.toml +++ b/src/runtime-rs/crates/service/Cargo.toml @@ -13,10 +13,11 @@ slog-scope = "4.4.0" tokio = { version = "1.38.0", features = ["rt-multi-thread"] } tracing = "0.1.36" ttrpc = "0.8.4" - -common = { path = "../runtimes/common" } containerd-shim-protos = { version = "0.6.0", features = ["async", "sandbox"] } containerd-shim = { version = "0.6.0", features = ["async"] } + +# Local dependencies +common = { path = "../runtimes/common" } logging = { path = "../../../libs/logging" } kata-types = { path = "../../../libs/kata-types" } runtimes = { path = "../runtimes" } diff --git a/src/runtime-rs/crates/shim-ctl/Cargo.toml b/src/runtime-rs/crates/shim-ctl/Cargo.toml index c1d05f4dc9..52ace58ed0 100644 --- a/src/runtime-rs/crates/shim-ctl/Cargo.toml +++ b/src/runtime-rs/crates/shim-ctl/Cargo.toml @@ -7,8 +7,9 @@ edition = "2021" [dependencies] anyhow = "^1.0" +tokio = { version = "1.38.0", features = [ "rt", "rt-multi-thread" ] } + +# Local dependencies common = { path = "../runtimes/common" } logging = { path = "../../../libs/logging"} runtimes = { path = "../runtimes" } -tokio = { version = "1.38.0", features = [ "rt", "rt-multi-thread" ] } - diff --git a/src/runtime-rs/crates/shim/Cargo.toml b/src/runtime-rs/crates/shim/Cargo.toml index e5adf3f151..4657e712ec 100644 --- a/src/runtime-rs/crates/shim/Cargo.toml +++ b/src/runtime-rs/crates/shim/Cargo.toml @@ -31,12 +31,13 @@ tokio = { version = "1.38.0", features = [ "rt", "rt-multi-thread" ] } unix_socket2 = "0.5.4" tracing = "0.1.36" tracing-opentelemetry = "0.18.0" +oci-spec = { version = "0.6.8", features = ["runtime"] } +# Local dependencies kata-types = { path = "../../../libs/kata-types"} kata-sys-util = { path = "../../../libs/kata-sys-util"} logging = { path = "../../../libs/logging"} runtime-spec = { path = "../../../libs/runtime-spec" } -oci-spec = { version = "0.6.8", features = ["runtime"] } service = { path = "../service" } runtimes = { path = "../runtimes" } @@ -44,4 +45,6 @@ runtimes = { path = "../runtimes" } tempfile = "3.2.0" rand = "0.8.4" serial_test = "0.5.1" + +# Local dev-dependencies tests_utils = { path = "../../tests/utils"} diff --git a/src/runtime-rs/tests/utils/Cargo.toml b/src/runtime-rs/tests/utils/Cargo.toml index d35892da5d..24f934bd89 100644 --- a/src/runtime-rs/tests/utils/Cargo.toml +++ b/src/runtime-rs/tests/utils/Cargo.toml @@ -10,4 +10,6 @@ license = "Apache-2.0" [dependencies] anyhow = "^1.0" rand = "0.8.4" + +# Local dependencies kata-types = { path = "../../../libs/kata-types" }