diff --git a/Cargo.lock b/Cargo.lock index f174d6a11b..e359b414d7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -418,6 +418,30 @@ dependencies = [ "winapi", ] +[[package]] +name = "cros_asyncv2" +version = "0.2.0" +dependencies = [ + "anyhow", + "async-task", + "base", + "data_model", + "futures", + "futures-executor", + "futures-util", + "intrusive-collections", + "io-uring", + "libc", + "memoffset 0.6.5", + "mio", + "once_cell", + "slab", + "smallvec", + "sync", + "tempfile", + "thiserror", +] + [[package]] name = "cros_fdt" version = "0.1.0" @@ -1055,6 +1079,16 @@ dependencies = [ "memoffset 0.5.6", ] +[[package]] +name = "io-uring" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00d78c9f2db2a9800dfd15c69543896dae2135112dde0d1944442e83da8ce23a" +dependencies = [ + "bitflags", + "libc", +] + [[package]] name = "io_uring" version = "0.1.1" @@ -1313,6 +1347,28 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" +[[package]] +name = "mio" +version = "0.7.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc" +dependencies = [ + "libc", + "log", + "miow", + "ntapi", + "winapi", +] + +[[package]] +name = "miow" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" +dependencies = [ + "winapi", +] + [[package]] name = "net_sys" version = "0.1.0" @@ -1366,6 +1422,15 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "ntapi" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f" +dependencies = [ + "winapi", +] + [[package]] name = "num-integer" version = "0.1.45" diff --git a/Cargo.toml b/Cargo.toml index 8149bcd985..4966c1f233 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,12 +34,9 @@ opt-level = "s" inherits = "chromeos" lto = true -# We currently need to exclude some crates from the workspace to allow -# these crates to be independently built by portage. These crates will -# eventually be moved into separate repositories. -# The only workspace members that need to be explicitly specified here are those -# that are not dependencies of the crosvm root crate. [workspace] +# Explicitly list all crates of crosvm as workspace members since not all of them may be referenced +# by dependencies. members = [ "aarch64", "acpi_tables", @@ -49,13 +46,21 @@ members = [ "base", "bit_field", "broker_ipc", + "common/audio_streams", + "common/balloon_control", + "common/cros_asyncv2", + "common/cros-fuzz", + "common/data_model", + "common/p9", + "common/sync", "crash_report", "cros_async", "cros_fdt", - "crosvm-fuzz", + "cros_tracing", "crosvm_cli", "crosvm_control", "crosvm_plugin", + "crosvm-fuzz", "devices", "disk", "fuse", @@ -65,14 +70,11 @@ members = [ "io_uring", "kernel_cmdline", "kernel_loader", - "kvm", "kvm_sys", + "kvm", + "libcras_stub", "linux_input_sys", - "media/cros-codecs", - "media/ffmpeg", - "media/libva", - "media/libvda", - "media/cros-codecs", + "metrics", "net_sys", "net_util", "power_monitor", @@ -83,9 +85,9 @@ members = [ "rutabaga_gfx", "serde_keyvalue", "system_api", - "tpm2", + "third_party/vmm_vhost", "tpm2-sys", - "cros_tracing", + "tpm2", "usb_sys", "usb_util", "vfio_sys", @@ -94,23 +96,17 @@ members = [ "vm_control", "vm_memory", "x86_64", - "third_party/vmm_vhost", ] + +# Exclude crates from crosvm builds completely. Avoid using this if possible as crates added here +# will not be tested in CI and may break at any time. exclude = [ - "common/audio_streams", - "common/balloon_control", - "common/cros-fuzz", - "common/cros_async", - "common/cros_asyncv2", - "common/data_model", - "common/io_uring", - "common/p9", - "common/sync", "sandbox", - "tube_transporter", - "win_util", - "tools/examples/baremetal", "tools/audio_streams_conformance_test", + "tools/examples/baremetal", + "tube_transporter", + "win_audio", + "win_util", ] [features] diff --git a/common/audio_streams/Cargo.lock b/common/audio_streams/Cargo.lock deleted file mode 100644 index 5774ffe85f..0000000000 --- a/common/audio_streams/Cargo.lock +++ /dev/null @@ -1,233 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "async-trait" -version = "0.1.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96cf8829f67d2eab0b2dfa42c5d0ef737e0724e4a82b01b3e292456202b19716" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "audio_streams" -version = "0.1.0" -dependencies = [ - "async-trait", - "futures", - "remain", - "serde", - "thiserror", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "futures" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f73fe65f54d1e12b726f517d3e2135ca3125a437b6d998caf1962961f7172d9e" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3" - -[[package]] -name = "futures-executor" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9420b90cfa29e327d0429f19be13e7ddb68fa1cccb09d65e5706b8c7a749b8a6" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-io" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b" - -[[package]] -name = "futures-macro" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "futures-sink" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21163e139fa306126e6eedaf49ecdb4588f939600f0b1e770f4205ee4b7fa868" - -[[package]] -name = "futures-task" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a" - -[[package]] -name = "futures-util" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - -[[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "pin-project-lite" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "proc-macro2" -version = "1.0.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c278e965f1d8cf32d6e0e96de3d3e79712178ae67986d9cf9151f51e95aac89b" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "remain" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c35270ea384ac1762895831cc8acb96f171468e52cec82ed9186f9416209fa4" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde" -version = "1.0.144" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f747710de3dcd43b88c9168773254e809d8ddbdf9653b84e2554ab219f17860" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.144" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94ed3a816fb1d101812f83e789f888322c34e291f894f19590dc310963e87a00" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "slab" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" -dependencies = [ - "autocfg", -] - -[[package]] -name = "syn" -version = "1.0.98" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "thiserror" -version = "1.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "unicode-ident" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15c61ba63f9235225a22310255a29b806b907c9b8c964bcbd0a2c70f3f2deea7" diff --git a/common/balloon_control/Cargo.lock b/common/balloon_control/Cargo.lock deleted file mode 100644 index 7c025f527f..0000000000 --- a/common/balloon_control/Cargo.lock +++ /dev/null @@ -1,65 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "balloon_control" -version = "0.1.0" -dependencies = [ - "serde", -] - -[[package]] -name = "proc-macro2" -version = "1.0.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c278e965f1d8cf32d6e0e96de3d3e79712178ae67986d9cf9151f51e95aac89b" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "serde" -version = "1.0.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc855a42c7967b7c369eb5860f7164ef1f6f81c20c7cc1141f2a604e18723b03" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f2122636b9fe3b81f1cb25099fcf2d3f542cdb1d45940d56c713158884a05da" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "syn" -version = "1.0.98" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "unicode-ident" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15c61ba63f9235225a22310255a29b806b907c9b8c964bcbd0a2c70f3f2deea7" diff --git a/common/cros-fuzz/Cargo.lock b/common/cros-fuzz/Cargo.lock deleted file mode 100644 index 2a941a7b7e..0000000000 --- a/common/cros-fuzz/Cargo.lock +++ /dev/null @@ -1,90 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "arbitrary" -version = "1.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f44124848854b941eafdb34f05b3bcf59472f643c7e151eba7c2b69daa469ed5" - -[[package]] -name = "cc" -version = "1.0.73" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" -dependencies = [ - "jobserver", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "cros_fuzz" -version = "0.1.0" -dependencies = [ - "libfuzzer-sys", - "rand_core", -] - -[[package]] -name = "getrandom" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "jobserver" -version = "0.1.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "068b1ee6743e4d11fb9c6a1e6064b3693a1b600e7f5f5988047d98b3dc9fb90b" -dependencies = [ - "libc", -] - -[[package]] -name = "libc" -version = "0.2.126" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" - -[[package]] -name = "libfuzzer-sys" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae185684fe19814afd066da15a7cc41e126886c21282934225d9fc847582da58" -dependencies = [ - "arbitrary", - "cc", - "once_cell", -] - -[[package]] -name = "once_cell" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1" - -[[package]] -name = "rand_core" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" -dependencies = [ - "getrandom", -] - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" diff --git a/common/cros-fuzz/Cargo.toml b/common/cros-fuzz/Cargo.toml index 518d228f54..c12d67a7ec 100644 --- a/common/cros-fuzz/Cargo.toml +++ b/common/cros-fuzz/Cargo.toml @@ -12,4 +12,4 @@ libfuzzer-sys = { version = "*", optional = true } [features] upstream-fuzz = ["dep:libfuzzer-sys"] -[workspace] + diff --git a/common/cros_asyncv2/Cargo.toml b/common/cros_asyncv2/Cargo.toml index 1c5ac9c351..e672df14fd 100644 --- a/common/cros_asyncv2/Cargo.toml +++ b/common/cros_asyncv2/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "cros_async" +name = "cros_asyncv2" version = "0.2.0" edition = "2021" @@ -30,5 +30,3 @@ futures = { version = "*", features = ["executor"] } futures-executor = { version = "0.3", features = ["thread-pool"] } futures-util = "0.3" tempfile = "3" - -[workspace] diff --git a/common/data_model/Cargo.lock b/common/data_model/Cargo.lock deleted file mode 100644 index 7ebdb98481..0000000000 --- a/common/data_model/Cargo.lock +++ /dev/null @@ -1,142 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "data_model" -version = "0.1.0" -dependencies = [ - "cfg-if", - "libc", - "remain", - "serde", - "static_assertions", - "thiserror", - "winapi", -] - -[[package]] -name = "libc" -version = "0.2.126" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" - -[[package]] -name = "proc-macro2" -version = "1.0.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c278e965f1d8cf32d6e0e96de3d3e79712178ae67986d9cf9151f51e95aac89b" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "remain" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c35270ea384ac1762895831cc8acb96f171468e52cec82ed9186f9416209fa4" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde" -version = "1.0.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc855a42c7967b7c369eb5860f7164ef1f6f81c20c7cc1141f2a604e18723b03" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f2122636b9fe3b81f1cb25099fcf2d3f542cdb1d45940d56c713158884a05da" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "syn" -version = "1.0.98" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "thiserror" -version = "1.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "unicode-ident" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15c61ba63f9235225a22310255a29b806b907c9b8c964bcbd0a2c70f3f2deea7" - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/common/data_model/Cargo.toml b/common/data_model/Cargo.toml index 7553ba15f2..f7ff39752a 100644 --- a/common/data_model/Cargo.toml +++ b/common/data_model/Cargo.toml @@ -19,4 +19,4 @@ winapi = { version = "*", features = ["everything", "std", "impl-default"] } [target.'cfg(unix)'.dependencies] libc = "*" -[workspace] + diff --git a/common/p9/Cargo.lock b/common/p9/Cargo.lock deleted file mode 100644 index c644de7b41..0000000000 --- a/common/p9/Cargo.lock +++ /dev/null @@ -1,82 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "libc" -version = "0.2.126" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" - -[[package]] -name = "p9" -version = "0.1.0" -dependencies = [ - "libc", - "serde", - "wire_format_derive", -] - -[[package]] -name = "proc-macro2" -version = "1.0.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c278e965f1d8cf32d6e0e96de3d3e79712178ae67986d9cf9151f51e95aac89b" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "serde" -version = "1.0.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc855a42c7967b7c369eb5860f7164ef1f6f81c20c7cc1141f2a604e18723b03" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f2122636b9fe3b81f1cb25099fcf2d3f542cdb1d45940d56c713158884a05da" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "syn" -version = "1.0.98" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "unicode-ident" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15c61ba63f9235225a22310255a29b806b907c9b8c964bcbd0a2c70f3f2deea7" - -[[package]] -name = "wire_format_derive" -version = "0.1.0" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] diff --git a/common/p9/Cargo.toml b/common/p9/Cargo.toml index 4e07453d7e..98bb3275d5 100644 --- a/common/p9/Cargo.toml +++ b/common/p9/Cargo.toml @@ -12,4 +12,4 @@ wire_format_derive = { path = "wire_format_derive", version = "*" } [features] trace = [] -[workspace] + diff --git a/common/p9/fuzz/Cargo.toml b/common/p9/fuzz/Cargo.toml index 76ccc60dcf..983da0bf4a 100644 --- a/common/p9/fuzz/Cargo.toml +++ b/common/p9/fuzz/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" p9 = { path = "../" } cros_fuzz = { path = "../../cros-fuzz" } # provided by ebuild -[workspace] + members = ["."] [[bin]] diff --git a/common/sync/Cargo.lock b/common/sync/Cargo.lock deleted file mode 100644 index 2af937dc72..0000000000 --- a/common/sync/Cargo.lock +++ /dev/null @@ -1,7 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "sync" -version = "0.1.99" diff --git a/common/sync/Cargo.toml b/common/sync/Cargo.toml index e92c2ce027..650505c9db 100644 --- a/common/sync/Cargo.toml +++ b/common/sync/Cargo.toml @@ -5,4 +5,4 @@ authors = ["The Chromium OS Authors"] edition = "2021" include = ["src/**/*", "Cargo.toml"] -[workspace] + diff --git a/tools/clippy b/tools/clippy index d5709ec031..a529f38587 100755 --- a/tools/clippy +++ b/tools/clippy @@ -43,14 +43,6 @@ def main(fix: bool = False, json: bool = False, locked: bool = False): *common_args, ).with_envs(triple.get_cargo_env()).fg() - for crate in CROSVM_ROOT.glob("common/*/Cargo.toml"): - if is_crate_excluded(crate.parent.name): - print("Skipping crate", crate.parent.relative_to(CROSVM_ROOT)) - else: - print("Clippy", crate.parent.relative_to(CROSVM_ROOT)) - with cwd(crate.parent): - clippy("--all-features", *common_args).fg() - if __name__ == "__main__": run_main(main) diff --git a/tools/contrib/cargo_refactor.py b/tools/contrib/cargo_refactor.py index 97af7bf9fd..a800cee696 100644 --- a/tools/contrib/cargo_refactor.py +++ b/tools/contrib/cargo_refactor.py @@ -79,18 +79,13 @@ def update_workspace_members(): members.append("members = [") for toml in sorted(Path().glob("*/Cargo.toml")): members.append(f' "{toml.parent}",') + for toml in sorted(Path().glob("common/*/Cargo.toml")): + members.append(f' "{toml.parent}",') members.append(' "third_party/vmm_vhost",') members.append("]") replace_in_file(Path("Cargo.toml"), re.compile(r"members = \[[^\]]+\]"), "\n".join(members)) - exclude: list[str] = [] - exclude.append("exclude = [") - for toml in sorted(Path().glob("common/*/Cargo.toml")): - exclude.append(f' "{toml.parent}",') - exclude.append("]") - replace_in_file(Path("Cargo.toml"), re.compile(r"exclude = \[[^\]]+\]"), "\n".join(exclude)) - @contextmanager def chdir(path: Union[Path, str]): @@ -130,85 +125,7 @@ fn main() { def main(): os.chdir(Path(__file__).parent.parent.parent) - - subprocess.check_call(["git", "checkout", "-f", "--", "base"]) - - # Move crates to base - move_crate(Path("common/win_util"), Path("win_util")) - copy_crate_src_to_module("common/win_sys_util/src", "base/src/windows") - Path("base/build.rs").write_text(BUILD_RS) - - # Load the added module - replace_in_file(Path("base/src/lib.rs"), "pub mod unix;", IMPORT) - - # Flatten all imports for easier replacements - subprocess.check_call( - ["rustfmt", "+nightly", "--config=imports_granularity=item", "base/src/lib.rs"] - ) - - # Update references to the above crates in base: - replace_in_files( - "base/src/**/*.rs", - [ - ("sys_util_core::", "crate::common::"), - ("win_sys_util::", "crate::platform::"), - ("crate::unix::", "crate::platform::"), - ("use poll_token_derive::", "use base_event_token_derive::"), - ], - ) - - # Fixup macros since they like to have special treatement. - macros = [ - "debug", - "error", - "handle_eintr_errno", - "info", - "ioctl_io_nr", - "ioctl_ior_nr", - "ioctl_iow_nr", - "ioctl_iowr_nr", - "syscall", - "warn", - "volatile_at_impl", - "volatile_impl", - "generate_scoped_event", - "syslog_lock", - "CHRONO_TIMESTAMP_FIXED_FMT", - ] - for macro in macros: - # Update use statments. #[macro_export] exports them on the crate scoped - replace_in_files( - "base/src/windows/**/*.rs", - [ - (f"crate::common::{macro}", f"crate::{macro}"), - (f"super::super::{macro}", f"crate::{macro}"), - (f"super::{macro}", f"crate::{macro}"), - ], - ) - - # Replace $crate:: with $crate::windows (unless it's a macro invocation..) - def replace_references_in_macros(match: re.Match[str]): - name = match.group(0) - if not name.endswith("!"): - return name.replace("$crate", f"$crate::platform") - return name - - replace_in_files( - f"base/src/windows/**/*.rs", - [ - ( - re.compile(r"([\w\*\_\$]+\:\:)+([\w\*\_\!]+)"), - replace_references_in_macros, - ) - ], - ) - - # Unflatten imports again - subprocess.check_call( - ["rustfmt", "+nightly", "--config=imports_granularity=crate", "base/src/lib.rs"] - ) - - subprocess.check_call(["git", "rm", "-r", "common/win_sys_util", "common/win_util"]) + update_workspace_members() main() diff --git a/tools/impl/test_runner.py b/tools/impl/test_runner.py index e1536283b7..0e53f5aa18 100644 --- a/tools/impl/test_runner.py +++ b/tools/impl/test_runner.py @@ -236,11 +236,6 @@ def cargo_build_executables( yield from cargo("test", cwd, ["--no-run", *flags], env) -def build_common_crate(build_env: Dict[str, str], crate: Crate): - print(f"Building tests for: common/{crate.name}") - return list(cargo_build_executables(["--all-features"], env=build_env, cwd=crate.path)) - - def build_all_binaries(target: TestTarget, crosvm_direct: bool, instrument_coverage: bool): """Discover all crates and build them.""" build_env = os.environ.copy() @@ -275,13 +270,6 @@ def build_all_binaries(target: TestTarget, crosvm_direct: bool, instrument_cover env=build_env, ) - with Pool(PARALLELISM) as pool: - for executables in pool.imap( - functools.partial(build_common_crate, build_env), - list_common_crates(target.build_triple), - ): - yield from executables - def get_test_timeout(target: TestTarget, executable: Executable): large = TestOption.LARGE in CRATE_OPTIONS.get(executable.crate_name, [])