From f5a35c8887c581cacbdedbe05013b354a194973b Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Fri, 7 Apr 2023 17:08:23 +0000 Subject: [PATCH] this doesn't work just yet --- Cargo.toml | 6 ++---- app/buck2/Cargo.toml | 4 +++- app/buck2/bin/buck2.rs | 2 +- app/buck2_build_api/Cargo.toml | 4 ++-- app/buck2_client_ctx/Cargo.toml | 2 +- app/buck2_client_ctx/src/build_count.rs | 2 +- app/buck2_client_ctx/src/daemon/client/mod.rs | 2 +- app/buck2_protoc_dev/src/lib.rs | 9 +++++---- app/buck2_server/Cargo.toml | 4 ++-- app/buck2_server/src/net_io.rs | 4 ++-- shim/third-party/rust/Cargo.toml | 10 ++++++---- starlark-rust/starlark/Cargo.toml | 2 +- 12 files changed, 27 insertions(+), 24 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e78af1bea01..d1032b78bd5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -124,7 +124,7 @@ faccess = "0.2.3" fancy-regex = "0.10.0" flate2 = "1.0.22" fnv = "1.0.7" -fs2 = "0.4.3" +fs4 = { version = "0.6", features = ["sync"] } futures = { version = "0.3.24", features = ["async-await", "compat"] } futures-intrusive = "0.4" glob = "0.3.0" @@ -144,8 +144,7 @@ internment = { version = "0.7", features = ["arc"] } inventory = "0.1.9" is_proc_translated = "0.1.1" itertools = "0.10.3" -jemalloc-ctl = "0.5.0" -jemallocator = { version = "0.5.0", features = ["profiling"] } + libc = "0.2.132" linked-hash-map = { version = "0.5", features = ["serde_impl"] } log = "0.4" @@ -176,7 +175,6 @@ prost-build = "0.11.6" prost-derive = "0.11.6" prost-types = "0.11.6" protoc-bin-vendored = "3.0.0" -psutil = "3.2" quote = "1.0.3" rand = { version = "0.8.4", features = ["small_rng"] } rand_chacha = "0.3" diff --git a/app/buck2/Cargo.toml b/app/buck2/Cargo.toml index 4af3aa19f38..e5018b56d6c 100644 --- a/app/buck2/Cargo.toml +++ b/app/buck2/Cargo.toml @@ -60,8 +60,10 @@ buck2_test_runner = { workspace = true } buck2_cli_proto = { workspace = true } buck2_util = { workspace = true } +[target.'cfg(all(unix, not(illumos)))'.dependencies] +jemallocator = { version = "0.5.0", features = ["profiling"] } + [target.'cfg(unix)'.dependencies] -jemallocator = { workspace = true } nix = { workspace = true } [target.'cfg(windows)'.dependencies] diff --git a/app/buck2/bin/buck2.rs b/app/buck2/bin/buck2.rs index ad58af6a96a..43e7efbfac4 100644 --- a/app/buck2/bin/buck2.rs +++ b/app/buck2/bin/buck2.rs @@ -30,7 +30,7 @@ use fbinit::FacebookInit; // So when we set our own allocator, buck build buck2 or buck2 build buck2 often breaks. // Making jemalloc the default only when we do a cargo build. #[cfg_attr(all(unix, not(fbcode_build), not(buck_oss_build)), global_allocator)] -#[cfg(all(unix, not(fbcode_build), not(buck_oss_build)))] +#[cfg(all(unix, not(fbcode_build), not(buck_oss_build)), not(illumos))] static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; fn init_logging(_fb: FacebookInit) -> anyhow::Result> { diff --git a/app/buck2_build_api/Cargo.toml b/app/buck2_build_api/Cargo.toml index 384ec735a74..645be930475 100644 --- a/app/buck2_build_api/Cargo.toml +++ b/app/buck2_build_api/Cargo.toml @@ -73,8 +73,8 @@ buck2_cli_proto = { workspace = true } buck2_util = { workspace = true } buck2_critical_path = { workspace = true } -[target.'cfg(unix)'.dependencies] -jemallocator = { workspace = true } +[target.'cfg(all(unix, not(illumos)))'.dependencies] +jemallocator = { version = "0.5.0", features = ["profiling"] } [dev-dependencies] maplit = { workspace = true } diff --git a/app/buck2_client_ctx/Cargo.toml b/app/buck2_client_ctx/Cargo.toml index 36c092997a8..fa5a997526b 100644 --- a/app/buck2_client_ctx/Cargo.toml +++ b/app/buck2_client_ctx/Cargo.toml @@ -16,7 +16,7 @@ chrono = { workspace = true } crossterm = { workspace = true } derivative = { workspace = true } derive_more = { workspace = true } -fs2 = { workspace = true } +fs4 = { workspace = true } futures = { workspace = true } hex = { workspace = true } httparse = { workspace = true } diff --git a/app/buck2_client_ctx/src/build_count.rs b/app/buck2_client_ctx/src/build_count.rs index 0c3bf718041..e18eda173fe 100644 --- a/app/buck2_client_ctx/src/build_count.rs +++ b/app/buck2_client_ctx/src/build_count.rs @@ -15,7 +15,7 @@ use anyhow::Context; use buck2_common::client_utils; use buck2_core::fs::paths::abs_norm_path::AbsNormPathBuf; use buck2_core::fs::paths::file_name::FileName; -use fs2::FileExt; +use fs4::FileExt; use serde::Deserialize; use serde::Serialize; use tokio::io::AsyncReadExt; diff --git a/app/buck2_client_ctx/src/daemon/client/mod.rs b/app/buck2_client_ctx/src/daemon/client/mod.rs index 0488e9ae36e..9f7faeeff3d 100644 --- a/app/buck2_client_ctx/src/daemon/client/mod.rs +++ b/app/buck2_client_ctx/src/daemon/client/mod.rs @@ -19,7 +19,7 @@ use buck2_cli_proto::*; use buck2_common::daemon_dir::DaemonDir; use buck2_core::fs::fs_util; use buck2_core::fs::paths::abs_norm_path::AbsNormPathBuf; -use fs2::FileExt; +use fs4::FileExt; use futures::future::BoxFuture; use futures::pin_mut; use futures::stream; diff --git a/app/buck2_protoc_dev/src/lib.rs b/app/buck2_protoc_dev/src/lib.rs index 753411927b8..919ad6abaac 100644 --- a/app/buck2_protoc_dev/src/lib.rs +++ b/app/buck2_protoc_dev/src/lib.rs @@ -18,8 +18,7 @@ fn get_env(key: &str) -> Option { } #[cfg(not(buck2_build))] -fn set_var(var: &str, override_var: &str, path: &Path) { - assert!(path.exists(), "Path does not exist: `{}`", path.display()); +fn set_var(var: &str, override_var: &str, path: Option<&Path>) { let path_buf; let path = if let Some(override_var_value) = env::var_os(override_var) { @@ -27,6 +26,8 @@ fn set_var(var: &str, override_var: &str, path: &Path) { path_buf = std::path::PathBuf::from(override_var_value); &path_buf } else { + let path = path.unwrap(); + assert!(path.exists(), "Path does not exist: `{}`", path.display()); path }; @@ -50,7 +51,7 @@ fn maybe_set_protoc() { set_var( "PROTOC", "BUCK2_BUILD_PROTOC", - &protoc_bin_vendored::protoc_bin_path().unwrap(), + protoc_bin_vendored::protoc_bin_path(), ); } } @@ -62,7 +63,7 @@ fn maybe_set_protoc_include() { set_var( "PROTOC_INCLUDE", "BUCK2_BUILD_PROTOC_INCLUDE", - &protoc_bin_vendored::include_path().unwrap(), + protoc_bin_vendored::include_path(), ); } } diff --git a/app/buck2_server/Cargo.toml b/app/buck2_server/Cargo.toml index 14d7b0ece5c..a79e6412241 100644 --- a/app/buck2_server/Cargo.toml +++ b/app/buck2_server/Cargo.toml @@ -66,8 +66,8 @@ buck2_events = { workspace = true } buck2_util = { workspace = true } host_sharing = { workspace = true } -[target.'cfg(unix)'.dependencies] -psutil = { workspace = true } +[target.'cfg(all(unix, not(illumos)))'.dependencies] +psutil = "3.2" [dev-dependencies] assert_matches = { workspace = true } diff --git a/app/buck2_server/src/net_io.rs b/app/buck2_server/src/net_io.rs index 048a53e3158..5451100ccca 100644 --- a/app/buck2_server/src/net_io.rs +++ b/app/buck2_server/src/net_io.rs @@ -13,7 +13,7 @@ pub struct Counters { pub bytes_recv: u64, } -#[cfg(unix)] +#[cfg(all(unix, not(illumos))] mod collector { use std::collections::HashMap; use std::sync::Arc; @@ -67,7 +67,7 @@ mod collector { } // psutil network stats aren't implemented on windows. -#[cfg(not(unix))] +#[cfg(any(not(unix), illumos))] mod collector { use std::collections::HashMap; diff --git a/shim/third-party/rust/Cargo.toml b/shim/third-party/rust/Cargo.toml index bb63b98e756..a08af633e61 100644 --- a/shim/third-party/rust/Cargo.toml +++ b/shim/third-party/rust/Cargo.toml @@ -71,7 +71,7 @@ faccess = "0.2.3" fancy-regex = "0.10.0" flate2 = "1.0.22" fnv = "1.0.7" -fs2 = "0.4.3" +fs4 = { version = "0.6", features = ["sync"] } futures = { version = "0.3.24", features = ["async-await", "compat"] } futures-intrusive = "0.4" glob = "0.3.0" @@ -91,8 +91,6 @@ internment = { version = "0.7", features = ["arc"] } inventory = "0.1.9" is_proc_translated = "0.1.1" itertools = "0.10.3" -jemalloc-ctl = "0.3.3" -jemallocator = { version = "0.3.2", features = ["profiling"] } lalrpop = { version = "0.19.7", artifact = "bin" } lalrpop-util = "0.19.7" libc = "0.2.132" @@ -126,7 +124,6 @@ prost = "0.11.6" prost-build = "0.11.6" prost-derive = "0.11.6" prost-types = "0.11.6" -psutil = "3.2" quote = "1.0.3" rand = { version = "0.8.4", features = ["small_rng"] } rand_chacha = "0.3" @@ -186,6 +183,11 @@ xattr = "0.2.2" zip = "0.5" zstd = "=0.11.1" +[target.'cfg(all(unix, not(illumos)))'.dependencies] +jemalloc-ctl = "0.3.3" +jemallocator = { version = "0.3.2", features = ["profiling"] } +psutil = "3.2" + [patch.crates-io] # For https://github.com/tokio-rs/prost/pull/802 prost = { git = "https://github.com/krallin/prost.git", rev = "90b7e204c66f6baed0b1426ce456fb70d16b1cdb", version = "0.11.6"} diff --git a/starlark-rust/starlark/Cargo.toml b/starlark-rust/starlark/Cargo.toml index a0f3df0ecff..bd2986fcf6f 100644 --- a/starlark-rust/starlark/Cargo.toml +++ b/starlark-rust/starlark/Cargo.toml @@ -42,7 +42,7 @@ walkdir = "2.3" serde = { version = "1.0", features = ["derive"] } logos = "0.12" serde_json = "1.0" -rustyline = "7.1" +rustyline = "9.1" maplit = "1.0.2" lsp-server = "0.5" lsp-types = "0.93.0"