build: decouple Cargo.toml: split crate and workspace definitions
TL;DR: cargo clippy|check|... now runs on whole workspace by default. ## Steps - add new workspace member `cloud-hypervisor` - move `./src` to new workspace member - move `./tests` to new workspace member - move relevant parts from Cargo.toml to new workspace member - kept necessary parts in main Cargo.toml, such as profile configurations ## About The main Cargo.toml historically mixes workspace and crate definitions for cloud-hypervisor and ch-remote. This makes it hard to read and requires `--workspace` to run cargo clippy or cargo test on all workspace members, which is counter-intuitive. This patch separates the workspace from the crate definition in the main Cargo.toml file. After this, cargo clippy, cargo test, etc., work on the whole workspace naturally, giving a smoother developer experience. The Cargo.toml without a package definition is also called a virtual workspace or virtual manifest by Cargo [0]. Backporting is not a concern: CHV no longer backports, but the affected files are rarely modified anyway. [0] https://doc.rust-lang.org/cargo/reference/workspaces.html#virtual-workspace Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de> On-behalf-of: SAP philipp.schuster@sap.com
This commit is contained in:
parent
f104bcdb6b
commit
3d049765bd
9 changed files with 75 additions and 69 deletions
74
Cargo.toml
74
Cargo.toml
|
|
@ -1,21 +1,6 @@
|
|||
[package]
|
||||
authors = ["The Cloud Hypervisor Authors"]
|
||||
build = "build.rs"
|
||||
default-run = "cloud-hypervisor"
|
||||
description = "Open source Virtual Machine Monitor (VMM) that runs on top of KVM & MSHV"
|
||||
edition = "2024"
|
||||
homepage = "https://github.com/cloud-hypervisor/cloud-hypervisor"
|
||||
license = "Apache-2.0 AND BSD-3-Clause"
|
||||
name = "cloud-hypervisor"
|
||||
version = "49.0.0"
|
||||
# Minimum buildable version:
|
||||
# Keep in sync with version in .github/workflows/build.yaml
|
||||
# Policy on MSRV (see #4318):
|
||||
# Can only be bumped if satisfying any of the following:
|
||||
# a.) A dependency requires it,
|
||||
# b.) If we want to use a new feature and that MSRV is at least 6 months old,
|
||||
# c.) There is a security issue that is addressed by the toolchain update.
|
||||
rust-version = "1.89.0"
|
||||
# Cloud Hypervisor Workspace
|
||||
#
|
||||
# The main crate producing the binaries is in `./cloud-hypervisor`.
|
||||
|
||||
[profile.release]
|
||||
codegen-units = 1
|
||||
|
|
@ -28,62 +13,12 @@ debug = true
|
|||
inherits = "release"
|
||||
strip = false
|
||||
|
||||
[dependencies]
|
||||
anyhow = { workspace = true }
|
||||
api_client = { path = "api_client" }
|
||||
clap = { workspace = true, features = ["string"] }
|
||||
dhat = { workspace = true, optional = true }
|
||||
env_logger = { workspace = true }
|
||||
epoll = { workspace = true }
|
||||
event_monitor = { path = "event_monitor" }
|
||||
hypervisor = { path = "hypervisor" }
|
||||
libc = { workspace = true }
|
||||
log = { workspace = true, features = ["std"] }
|
||||
option_parser = { path = "option_parser" }
|
||||
seccompiler = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
signal-hook = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
tpm = { path = "tpm" }
|
||||
tracer = { path = "tracer" }
|
||||
vm-memory = { workspace = true }
|
||||
vmm = { path = "vmm" }
|
||||
vmm-sys-util = { workspace = true }
|
||||
zbus = { version = "5.7.1", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
dirs = { workspace = true }
|
||||
net_util = { path = "net_util" }
|
||||
serde_json = { workspace = true }
|
||||
test_infra = { path = "test_infra" }
|
||||
wait-timeout = { workspace = true }
|
||||
|
||||
# Please adjust `vmm::feature_list()` accordingly when changing the
|
||||
# feature list below
|
||||
[features]
|
||||
dbus_api = ["vmm/dbus_api", "zbus"]
|
||||
default = ["io_uring", "kvm"]
|
||||
dhat-heap = ["dhat", "vmm/dhat-heap"] # For heap profiling
|
||||
fw_cfg = ["vmm/fw_cfg"]
|
||||
guest_debug = ["vmm/guest_debug"]
|
||||
igvm = ["mshv", "vmm/igvm"]
|
||||
io_uring = ["vmm/io_uring"]
|
||||
ivshmem = ["vmm/ivshmem"]
|
||||
kvm = ["vmm/kvm"]
|
||||
mshv = ["vmm/mshv"]
|
||||
pvmemcontrol = ["vmm/pvmemcontrol"]
|
||||
sev_snp = ["igvm", "mshv", "vmm/sev_snp"]
|
||||
tdx = ["vmm/tdx"]
|
||||
tracing = ["tracer/tracing", "vmm/tracing"]
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[workspace]
|
||||
members = [
|
||||
"api_client",
|
||||
"arch",
|
||||
"block",
|
||||
"cloud-hypervisor",
|
||||
"devices",
|
||||
"event_monitor",
|
||||
"hypervisor",
|
||||
|
|
@ -106,6 +41,7 @@ members = [
|
|||
"vmm",
|
||||
]
|
||||
package.edition = "2024"
|
||||
resolver = "3"
|
||||
|
||||
[workspace.dependencies]
|
||||
# rust-vmm crates
|
||||
|
|
|
|||
69
cloud-hypervisor/Cargo.toml
Normal file
69
cloud-hypervisor/Cargo.toml
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
[package]
|
||||
authors = ["The Cloud Hypervisor Authors"]
|
||||
build = "build.rs"
|
||||
default-run = "cloud-hypervisor"
|
||||
description = "Open source Virtual Machine Monitor (VMM) that runs on top of KVM & MSHV"
|
||||
edition = "2024"
|
||||
homepage = "https://github.com/cloud-hypervisor/cloud-hypervisor"
|
||||
license = "Apache-2.0 AND BSD-3-Clause"
|
||||
name = "cloud-hypervisor"
|
||||
version = "49.0.0"
|
||||
# Minimum buildable version:
|
||||
# Keep in sync with version in .github/workflows/build.yaml
|
||||
# Policy on MSRV (see #4318):
|
||||
# Can only be bumped if satisfying any of the following:
|
||||
# a.) A dependency requires it,
|
||||
# b.) If we want to use a new feature and that MSRV is at least 6 months old,
|
||||
# c.) There is a security issue that is addressed by the toolchain update.
|
||||
rust-version = "1.89.0"
|
||||
|
||||
[dependencies]
|
||||
anyhow = { workspace = true }
|
||||
api_client = { path = "../api_client" }
|
||||
clap = { workspace = true, features = ["string"] }
|
||||
dhat = { workspace = true, optional = true }
|
||||
env_logger = { workspace = true }
|
||||
epoll = { workspace = true }
|
||||
event_monitor = { path = "../event_monitor" }
|
||||
hypervisor = { path = "../hypervisor" }
|
||||
libc = { workspace = true }
|
||||
log = { workspace = true, features = ["std"] }
|
||||
option_parser = { path = "../option_parser" }
|
||||
seccompiler = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
signal-hook = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
tpm = { path = "../tpm" }
|
||||
tracer = { path = "../tracer" }
|
||||
vm-memory = { workspace = true }
|
||||
vmm = { path = "../vmm" }
|
||||
vmm-sys-util = { workspace = true }
|
||||
zbus = { version = "5.7.1", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
dirs = { workspace = true }
|
||||
net_util = { path = "../net_util" }
|
||||
serde_json = { workspace = true }
|
||||
test_infra = { path = "../test_infra" }
|
||||
wait-timeout = { workspace = true }
|
||||
|
||||
# Please adjust `vmm::feature_list()` accordingly when changing the
|
||||
# feature list below
|
||||
[features]
|
||||
dbus_api = ["vmm/dbus_api", "zbus"]
|
||||
default = ["io_uring", "kvm"]
|
||||
dhat-heap = ["dhat", "vmm/dhat-heap"] # For heap profiling
|
||||
fw_cfg = ["vmm/fw_cfg"]
|
||||
guest_debug = ["vmm/guest_debug"]
|
||||
igvm = ["mshv", "vmm/igvm"]
|
||||
io_uring = ["vmm/io_uring"]
|
||||
ivshmem = ["vmm/ivshmem"]
|
||||
kvm = ["vmm/kvm"]
|
||||
mshv = ["vmm/mshv"]
|
||||
pvmemcontrol = ["vmm/pvmemcontrol"]
|
||||
sev_snp = ["igvm", "mshv", "vmm/sev_snp"]
|
||||
tdx = ["vmm/tdx"]
|
||||
tracing = ["tracer/tracing", "vmm/tracing"]
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
1
tests/readme.md
Normal file
1
tests/readme.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
The integration tests have been moved to `./cloud-hypervisor/tests`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue