Skip to content

Commit

Permalink
rust: create a cargo workspace
Browse files Browse the repository at this point in the history
Workspaces allows tracking dependencies for multiple crates at once,
by having a single Cargo.lock file at the top of the rust/ tree.
Because QEMU's Cargo.lock files have to be synchronized with the versions
of crates in subprojects/, using a workspace avoids the need to copy
over the Cargo.lock file when adding a new device (and thus a new crate)
under rust/hw/.

In addition, workspaces let cargo download and build dependencies just
once.  While right now we have one leaf crate (hw/char/pl011), this
will not be the case once more devices are added.

Reviewed-by: Zhao Liu <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
  • Loading branch information
bonzini committed Nov 5, 2024
1 parent 907d2bb commit 39c8fae
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 110 deletions.
File renamed without changes.
7 changes: 7 additions & 0 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[workspace]
resolver = "2"
members = [
"qemu-api-macros",
"qemu-api",
"hw/char/pl011",
]
3 changes: 0 additions & 3 deletions rust/hw/char/pl011/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,3 @@ bilge = { version = "0.2.0" }
bilge-impl = { version = "0.2.0" }
qemu_api = { path = "../../../qemu-api" }
qemu_api_macros = { path = "../../../qemu-api-macros" }

# Do not include in any global workspace
[workspace]
47 changes: 0 additions & 47 deletions rust/qemu-api-macros/Cargo.lock

This file was deleted.

3 changes: 0 additions & 3 deletions rust/qemu-api-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,3 @@ proc-macro = true
proc-macro2 = "1"
quote = "1"
syn = "2"

# Do not include in any global workspace
[workspace]
54 changes: 0 additions & 54 deletions rust/qemu-api/Cargo.lock

This file was deleted.

3 changes: 0 additions & 3 deletions rust/qemu-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,5 @@ qemu_api_macros = { path = "../qemu-api-macros" }
default = []
allocator = []

# Do not include in any global workspace
[workspace]

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(MESON)', 'cfg(HAVE_GLIB_WITH_ALIGNED_ALLOC)'] }

0 comments on commit 39c8fae

Please sign in to comment.