chore: Clean up util dependencies. (#9247)

This allows this crate to start building sooner + it reduces our total
build graph size by 13 units (1104 -> 1091).

Release Notes:

- N.A
This commit is contained in:
Piotr Osiewicz 2024-03-13 00:10:49 +01:00 committed by GitHub
parent c09fe1ce8a
commit 34f09bae4f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 63 additions and 81 deletions

106
Cargo.lock generated
View file

@ -99,7 +99,7 @@ dependencies = [
"log", "log",
"matrixmultiply", "matrixmultiply",
"ordered-float 2.10.0", "ordered-float 2.10.0",
"parking_lot 0.11.2", "parking_lot",
"parse_duration", "parse_duration",
"postage", "postage",
"rand 0.8.5", "rand 0.8.5",
@ -122,7 +122,7 @@ dependencies = [
"libc", "libc",
"log", "log",
"miow 0.6.0", "miow 0.6.0",
"parking_lot 0.12.1", "parking_lot",
"piper", "piper",
"polling 3.3.2", "polling 3.3.2",
"regex-automata 0.4.5", "regex-automata 0.4.5",
@ -382,7 +382,7 @@ checksum = "6d26004fe83b2d1cd3a97609b21e39f9a31535822210fe83205d2ce48866ea61"
dependencies = [ dependencies = [
"event-listener 2.5.3", "event-listener 2.5.3",
"futures-core", "futures-core",
"parking_lot 0.12.1", "parking_lot",
] ]
[[package]] [[package]]
@ -823,7 +823,7 @@ dependencies = [
"collections", "collections",
"derive_more", "derive_more",
"gpui", "gpui",
"parking_lot 0.11.2", "parking_lot",
"rodio", "rodio",
"util", "util",
] ]
@ -2120,7 +2120,7 @@ dependencies = [
"lazy_static", "lazy_static",
"log", "log",
"once_cell", "once_cell",
"parking_lot 0.11.2", "parking_lot",
"postage", "postage",
"rand 0.8.5", "rand 0.8.5",
"release_channel", "release_channel",
@ -2157,7 +2157,7 @@ name = "clock"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"chrono", "chrono",
"parking_lot 0.11.2", "parking_lot",
"smallvec", "smallvec",
] ]
@ -2253,7 +2253,7 @@ dependencies = [
"nanoid", "nanoid",
"node_runtime", "node_runtime",
"notifications", "notifications",
"parking_lot 0.11.2", "parking_lot",
"pretty_assertions", "pretty_assertions",
"project", "project",
"prometheus", "prometheus",
@ -2311,7 +2311,7 @@ dependencies = [
"lazy_static", "lazy_static",
"menu", "menu",
"notifications", "notifications",
"parking_lot 0.11.2", "parking_lot",
"picker", "picker",
"pretty_assertions", "pretty_assertions",
"project", "project",
@ -2475,7 +2475,7 @@ dependencies = [
"language", "language",
"lsp", "lsp",
"node_runtime", "node_runtime",
"parking_lot 0.11.2", "parking_lot",
"rpc", "rpc",
"serde", "serde",
"settings", "settings",
@ -2641,7 +2641,7 @@ dependencies = [
"ndk-context", "ndk-context",
"oboe", "oboe",
"once_cell", "once_cell",
"parking_lot 0.12.1", "parking_lot",
"wasm-bindgen", "wasm-bindgen",
"wasm-bindgen-futures", "wasm-bindgen-futures",
"web-sys", "web-sys",
@ -2970,7 +2970,7 @@ dependencies = [
"hashbrown 0.14.0", "hashbrown 0.14.0",
"lock_api", "lock_api",
"once_cell", "once_cell",
"parking_lot_core 0.9.8", "parking_lot_core",
] ]
[[package]] [[package]]
@ -3279,7 +3279,7 @@ dependencies = [
"lsp", "lsp",
"multi_buffer", "multi_buffer",
"ordered-float 2.10.0", "ordered-float 2.10.0",
"parking_lot 0.11.2", "parking_lot",
"project", "project",
"rand 0.8.5", "rand 0.8.5",
"release_channel", "release_channel",
@ -3528,7 +3528,7 @@ dependencies = [
"log", "log",
"lsp", "lsp",
"node_runtime", "node_runtime",
"parking_lot 0.11.2", "parking_lot",
"project", "project",
"schemars", "schemars",
"serde", "serde",
@ -3909,7 +3909,7 @@ dependencies = [
"libc", "libc",
"log", "log",
"notify", "notify",
"parking_lot 0.11.2", "parking_lot",
"rope", "rope",
"serde", "serde",
"serde_derive", "serde_derive",
@ -3940,7 +3940,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"bitflags 2.4.2", "bitflags 2.4.2",
"fsevent-sys 3.1.0", "fsevent-sys 3.1.0",
"parking_lot 0.11.2", "parking_lot",
"tempfile", "tempfile",
] ]
@ -4050,7 +4050,7 @@ checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"lock_api", "lock_api",
"parking_lot 0.12.1", "parking_lot",
] ]
[[package]] [[package]]
@ -4378,7 +4378,7 @@ dependencies = [
"oo7", "oo7",
"open", "open",
"parking", "parking",
"parking_lot 0.11.2", "parking_lot",
"pathfinder_geometry", "pathfinder_geometry",
"postage", "postage",
"profiling", "profiling",
@ -5187,7 +5187,7 @@ dependencies = [
"lazy_static", "lazy_static",
"log", "log",
"lsp", "lsp",
"parking_lot 0.11.2", "parking_lot",
"postage", "postage",
"pulldown-cmark", "pulldown-cmark",
"rand 0.8.5", "rand 0.8.5",
@ -5275,7 +5275,7 @@ dependencies = [
"log", "log",
"lsp", "lsp",
"node_runtime", "node_runtime",
"parking_lot 0.11.2", "parking_lot",
"project", "project",
"regex", "regex",
"rope", "rope",
@ -5508,7 +5508,7 @@ dependencies = [
"log", "log",
"media", "media",
"nanoid", "nanoid",
"parking_lot 0.11.2", "parking_lot",
"postage", "postage",
"serde", "serde",
"serde_json", "serde_json",
@ -5566,7 +5566,7 @@ dependencies = [
"gpui", "gpui",
"log", "log",
"lsp-types", "lsp-types",
"parking_lot 0.11.2", "parking_lot",
"postage", "postage",
"release_channel", "release_channel",
"serde", "serde",
@ -5915,7 +5915,7 @@ dependencies = [
"gpui", "gpui",
"language", "language",
"log", "log",
"parking_lot 0.11.2", "parking_lot",
"rand 0.8.5", "rand 0.8.5",
"settings", "settings",
"sum_tree", "sum_tree",
@ -6706,17 +6706,6 @@ version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae"
[[package]]
name = "parking_lot"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"
dependencies = [
"instant",
"lock_api",
"parking_lot_core 0.8.6",
]
[[package]] [[package]]
name = "parking_lot" name = "parking_lot"
version = "0.12.1" version = "0.12.1"
@ -6724,21 +6713,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
dependencies = [ dependencies = [
"lock_api", "lock_api",
"parking_lot_core 0.9.8", "parking_lot_core",
]
[[package]]
name = "parking_lot_core"
version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc"
dependencies = [
"cfg-if 1.0.0",
"instant",
"libc",
"redox_syscall 0.2.16",
"smallvec",
"winapi 0.3.9",
] ]
[[package]] [[package]]
@ -7058,7 +7033,7 @@ dependencies = [
"crossbeam-queue", "crossbeam-queue",
"futures 0.3.28", "futures 0.3.28",
"log", "log",
"parking_lot 0.12.1", "parking_lot",
"pin-project", "pin-project",
"pollster", "pollster",
"static_assertions", "static_assertions",
@ -7083,7 +7058,7 @@ dependencies = [
"log", "log",
"lsp", "lsp",
"node_runtime", "node_runtime",
"parking_lot 0.11.2", "parking_lot",
"serde", "serde",
"serde_json", "serde_json",
"util", "util",
@ -7212,7 +7187,7 @@ dependencies = [
"log", "log",
"lsp", "lsp",
"node_runtime", "node_runtime",
"parking_lot 0.11.2", "parking_lot",
"postage", "postage",
"prettier", "prettier",
"pretty_assertions", "pretty_assertions",
@ -7295,7 +7270,7 @@ dependencies = [
"fnv", "fnv",
"lazy_static", "lazy_static",
"memchr", "memchr",
"parking_lot 0.12.1", "parking_lot",
"protobuf", "protobuf",
"thiserror", "thiserror",
] ]
@ -7986,7 +7961,7 @@ dependencies = [
"env_logger", "env_logger",
"futures 0.3.28", "futures 0.3.28",
"gpui", "gpui",
"parking_lot 0.11.2", "parking_lot",
"prost 0.8.0", "prost 0.8.0",
"prost-build", "prost-build",
"rand 0.8.5", "rand 0.8.5",
@ -8556,7 +8531,7 @@ dependencies = [
"log", "log",
"ndarray", "ndarray",
"ordered-float 2.10.0", "ordered-float 2.10.0",
"parking_lot 0.11.2", "parking_lot",
"postage", "postage",
"pretty_assertions", "pretty_assertions",
"project", "project",
@ -9095,7 +9070,7 @@ dependencies = [
"indoc", "indoc",
"lazy_static", "lazy_static",
"libsqlite3-sys", "libsqlite3-sys",
"parking_lot 0.11.2", "parking_lot",
"smol", "smol",
"thread_local", "thread_local",
"util", "util",
@ -9802,7 +9777,7 @@ dependencies = [
"gpui", "gpui",
"lazy_static", "lazy_static",
"log", "log",
"parking_lot 0.11.2", "parking_lot",
"postage", "postage",
"rand 0.8.5", "rand 0.8.5",
"regex", "regex",
@ -9831,7 +9806,7 @@ dependencies = [
"gpui", "gpui",
"indexmap 1.9.3", "indexmap 1.9.3",
"palette", "palette",
"parking_lot 0.11.2", "parking_lot",
"refineable", "refineable",
"schemars", "schemars",
"serde", "serde",
@ -9936,7 +9911,7 @@ dependencies = [
"bstr", "bstr",
"fancy-regex", "fancy-regex",
"lazy_static", "lazy_static",
"parking_lot 0.12.1", "parking_lot",
"rustc-hash", "rustc-hash",
] ]
@ -10032,7 +10007,7 @@ dependencies = [
"libc", "libc",
"mio 0.8.11", "mio 0.8.11",
"num_cpus", "num_cpus",
"parking_lot 0.12.1", "parking_lot",
"pin-project-lite", "pin-project-lite",
"signal-hook-registry", "signal-hook-registry",
"socket2 0.5.4", "socket2 0.5.4",
@ -11030,22 +11005,21 @@ name = "util"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"backtrace", "async-fs 1.6.0",
"collections", "collections",
"dirs 3.0.2", "dirs 3.0.2",
"futures 0.3.28", "futures 0.3.28",
"futures-lite 1.13.0",
"git2", "git2",
"globset", "globset",
"isahc", "isahc",
"lazy_static", "lazy_static",
"log", "log",
"parking_lot 0.11.2",
"rand 0.8.5", "rand 0.8.5",
"regex", "regex",
"rust-embed", "rust-embed",
"serde", "serde",
"serde_json", "serde_json",
"smol",
"take-until", "take-until",
"tempfile", "tempfile",
"tendril", "tendril",
@ -11149,7 +11123,7 @@ dependencies = [
"log", "log",
"lsp", "lsp",
"nvim-rs", "nvim-rs",
"parking_lot 0.11.2", "parking_lot",
"regex", "regex",
"release_channel", "release_channel",
"schemars", "schemars",
@ -12458,7 +12432,7 @@ dependencies = [
"lazy_static", "lazy_static",
"log", "log",
"node_runtime", "node_runtime",
"parking_lot 0.11.2", "parking_lot",
"postage", "postage",
"project", "project",
"schemars", "schemars",
@ -12493,7 +12467,7 @@ dependencies = [
"language", "language",
"log", "log",
"lsp", "lsp",
"parking_lot 0.11.2", "parking_lot",
"postage", "postage",
"pretty_assertions", "pretty_assertions",
"rand 0.8.5", "rand 0.8.5",
@ -12832,7 +12806,7 @@ dependencies = [
"node_runtime", "node_runtime",
"notifications", "notifications",
"outline", "outline",
"parking_lot 0.11.2", "parking_lot",
"profiling", "profiling",
"project", "project",
"project_panel", "project_panel",

View file

@ -232,7 +232,7 @@ linkify = "0.10.0"
log = { version = "0.4.16", features = ["kv_unstable_serde"] } log = { version = "0.4.16", features = ["kv_unstable_serde"] }
ordered-float = "2.1.1" ordered-float = "2.1.1"
palette = { version = "0.7.5", default-features = false, features = ["std"] } palette = { version = "0.7.5", default-features = false, features = ["std"] }
parking_lot = "0.11.1" parking_lot = "0.12.1"
profiling = "1" profiling = "1"
postage = { version = "0.5", features = ["futures-traits"] } postage = { version = "0.5", features = ["futures-traits"] }
pretty_assertions = "1.3.0" pretty_assertions = "1.3.0"

View file

@ -17,7 +17,6 @@ test-support = ["tempfile", "git2"]
[dependencies] [dependencies]
anyhow.workspace = true anyhow.workspace = true
backtrace = "0.3"
collections.workspace = true collections.workspace = true
dirs = "3.0" dirs = "3.0"
futures.workspace = true futures.workspace = true
@ -26,13 +25,13 @@ globset.workspace = true
isahc.workspace = true isahc.workspace = true
lazy_static.workspace = true lazy_static.workspace = true
log.workspace = true log.workspace = true
parking_lot.workspace = true
rand.workspace = true rand.workspace = true
regex.workspace = true regex.workspace = true
rust-embed.workspace = true rust-embed.workspace = true
serde.workspace = true serde.workspace = true
serde_json.workspace = true serde_json.workspace = true
smol.workspace = true async-fs = "1.6"
futures-lite = "1.13"
take-until = "0.2.0" take-until = "0.2.0"
tempfile = { workspace = true, optional = true } tempfile = { workspace = true, optional = true }
unicase.workspace = true unicase.workspace = true

View file

@ -1,8 +1,8 @@
use std::path::Path; use std::path::Path;
use smol::{fs, stream::StreamExt};
use crate::ResultExt; use crate::ResultExt;
use async_fs as fs;
use futures_lite::StreamExt;
/// Removes all files and directories matching the given predicate /// Removes all files and directories matching the given predicate
pub async fn remove_matching<F>(dir: &Path, predicate: F) pub async fn remove_matching<F>(dir: &Path, predicate: F)

View file

@ -1,17 +1,19 @@
use crate::http_proxy_from_env; use crate::http_proxy_from_env;
pub use anyhow::{anyhow, Result}; pub use anyhow::{anyhow, Result};
use futures::future::BoxFuture; use futures::future::BoxFuture;
use futures_lite::FutureExt;
use isahc::config::{Configurable, RedirectPolicy}; use isahc::config::{Configurable, RedirectPolicy};
pub use isahc::{ pub use isahc::{
http::{Method, StatusCode, Uri}, http::{Method, StatusCode, Uri},
Error, Error,
}; };
pub use isahc::{AsyncBody, Request, Response}; pub use isahc::{AsyncBody, Request, Response};
use parking_lot::Mutex;
use smol::future::FutureExt;
#[cfg(feature = "test-support")] #[cfg(feature = "test-support")]
use std::fmt; use std::fmt;
use std::{sync::Arc, time::Duration}; use std::{
sync::{Arc, Mutex},
time::Duration,
};
pub use url::Url; pub use url::Url;
/// An [`HttpClient`] that has a base URL. /// An [`HttpClient`] that has a base URL.
@ -31,22 +33,30 @@ impl HttpClientWithUrl {
/// Returns the base URL. /// Returns the base URL.
pub fn base_url(&self) -> String { pub fn base_url(&self) -> String {
self.base_url.lock().clone() self.base_url
.lock()
.map_or_else(|_| Default::default(), |url| url.clone())
} }
/// Sets the base URL. /// Sets the base URL.
pub fn set_base_url(&self, base_url: impl Into<String>) { pub fn set_base_url(&self, base_url: impl Into<String>) {
*self.base_url.lock() = base_url.into(); let base_url = base_url.into();
self.base_url
.lock()
.map(|mut url| {
*url = base_url;
})
.ok();
} }
/// Builds a URL using the given path. /// Builds a URL using the given path.
pub fn build_url(&self, path: &str) -> String { pub fn build_url(&self, path: &str) -> String {
format!("{}{}", self.base_url.lock(), path) format!("{}{}", self.base_url(), path)
} }
/// Builds a Zed API URL using the given path. /// Builds a Zed API URL using the given path.
pub fn build_zed_api_url(&self, path: &str) -> String { pub fn build_zed_api_url(&self, path: &str) -> String {
let base_url = self.base_url.lock().clone(); let base_url = self.base_url();
let base_api_url = match base_url.as_ref() { let base_api_url = match base_url.as_ref() {
"https://zed.dev" => "https://api.zed.dev", "https://zed.dev" => "https://api.zed.dev",
"https://staging.zed.dev" => "https://api-staging.zed.dev", "https://staging.zed.dev" => "https://api-staging.zed.dev",

View file

@ -7,7 +7,6 @@ mod semantic_version;
#[cfg(any(test, feature = "test-support"))] #[cfg(any(test, feature = "test-support"))]
pub mod test; pub mod test;
pub use backtrace::Backtrace;
use futures::Future; use futures::Future;
use lazy_static::lazy_static; use lazy_static::lazy_static;
use rand::{seq::SliceRandom, Rng}; use rand::{seq::SliceRandom, Rng};
@ -32,7 +31,7 @@ macro_rules! debug_panic {
if cfg!(debug_assertions) { if cfg!(debug_assertions) {
panic!( $($fmt_arg)* ); panic!( $($fmt_arg)* );
} else { } else {
let backtrace = $crate::Backtrace::new(); let backtrace = std::backtrace::Backtrace::capture();
log::error!("{}\n{:?}", format_args!($($fmt_arg)*), backtrace); log::error!("{}\n{:?}", format_args!($($fmt_arg)*), backtrace);
} }
}; };