Move ProtoClient to RPC crate, behind feature flag disabled in collab (#17908)

This fixes a bug where we accidentally added a `gpui` transitive
dependency in `collab`.

Release Notes:

- N/A
This commit is contained in:
Max Brunsfeld 2024-09-16 14:50:30 -07:00 committed by GitHub
parent ca2cce79ed
commit 01bb10f518
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
21 changed files with 31 additions and 42 deletions

4
Cargo.lock generated
View File

@ -418,6 +418,7 @@ dependencies = [
"regex",
"release_channel",
"rope",
"rpc",
"schemars",
"search",
"semantic_index",
@ -8553,9 +8554,6 @@ version = "0.1.0"
dependencies = [
"anyhow",
"collections",
"futures 0.3.30",
"gpui",
"parking_lot",
"prost",
"prost-build",
"serde",

View File

@ -65,6 +65,7 @@ proto.workspace = true
regex.workspace = true
release_channel.workspace = true
rope.workspace = true
rpc.workspace = true
schemars.workspace = true
search.workspace = true
semantic_index.workspace = true

View File

@ -2,7 +2,6 @@ use crate::{
prompts::PromptBuilder, Context, ContextEvent, ContextId, ContextOperation, ContextVersion,
SavedContext, SavedContextMetadata,
};
use ::proto::AnyProtoClient;
use anyhow::{anyhow, Context as _, Result};
use client::{proto, telemetry::Telemetry, Client, TypedEnvelope};
use clock::ReplicaId;
@ -16,6 +15,7 @@ use language::LanguageRegistry;
use paths::contexts_dir;
use project::Project;
use regex::Regex;
use rpc::AnyProtoClient;
use std::{
cmp::Reverse,
ffi::OsStr,

View File

@ -5,8 +5,8 @@ use collections::HashMap;
use gpui::{AppContext, AsyncAppContext, Context, EventEmitter, Model, ModelContext, Task};
use language::proto::serialize_version;
use rpc::{
proto::{self, AnyProtoClient, PeerId},
TypedEnvelope,
proto::{self, PeerId},
AnyProtoClient, TypedEnvelope,
};
use std::{sync::Arc, time::Duration};
use text::BufferId;

View File

@ -11,7 +11,7 @@ use gpui::{
AppContext, AsyncAppContext, Context, EventEmitter, Model, ModelContext, Task, WeakModel,
};
use rand::prelude::*;
use rpc::proto::AnyProtoClient;
use rpc::AnyProtoClient;
use std::{
ops::{ControlFlow, Range},
sync::Arc,

View File

@ -34,7 +34,7 @@ parking_lot.workspace = true
postage.workspace = true
rand.workspace = true
release_channel.workspace = true
rpc.workspace = true
rpc = { workspace = true, features = ["gpui"] }
schemars.workspace = true
serde.workspace = true
serde_json.workspace = true

View File

@ -22,7 +22,6 @@ use gpui::{actions, AppContext, AsyncAppContext, Global, Model, Task, WeakModel}
use http_client::{AsyncBody, HttpClient, HttpClientWithUrl};
use parking_lot::RwLock;
use postage::watch;
use proto::{AnyProtoClient, EntityMessageSubscriber, ProtoClient, ProtoMessageHandlerSet};
use rand::prelude::*;
use release_channel::{AppVersion, ReleaseChannel};
use rpc::proto::{AnyTypedEnvelope, EnvelopedMessage, PeerId, RequestMessage};

View File

@ -17,10 +17,7 @@ use language::{
proto::{deserialize_line_ending, deserialize_version, serialize_version, split_operations},
Buffer, Capability, Event as BufferEvent, File as _, Language, Operation,
};
use rpc::{
proto::{self, AnyProtoClient},
ErrorExt as _, TypedEnvelope,
};
use rpc::{proto, AnyProtoClient, ErrorExt as _, TypedEnvelope};
use smol::channel::Receiver;
use std::{io, path::Path, str::FromStr as _, sync::Arc, time::Instant};
use text::BufferId;

View File

@ -49,7 +49,7 @@ use parking_lot::{Mutex, RwLock};
use postage::watch;
use rand::prelude::*;
use rpc::proto::AnyProtoClient;
use rpc::AnyProtoClient;
use serde::Serialize;
use settings::{Settings, SettingsLocation, SettingsStore};
use sha2::{Digest, Sha256};

View File

@ -62,10 +62,7 @@ use paths::{local_tasks_file_relative_path, local_vscode_tasks_file_relative_pat
use prettier_support::{DefaultPrettier, PrettierInstance};
use project_settings::{LspSettings, ProjectSettings, SettingsObserver};
use remote::SshSession;
use rpc::{
proto::{AnyProtoClient, SSH_PROJECT_ID},
ErrorCode,
};
use rpc::{proto::SSH_PROJECT_ID, AnyProtoClient, ErrorCode};
use search::{SearchInputKind, SearchQuery, SearchResult};
use search_history::SearchHistory;
use settings::{watch_config_file, Settings, SettingsLocation, SettingsStore};

View File

@ -2,10 +2,7 @@ use collections::HashMap;
use fs::Fs;
use gpui::{AppContext, AsyncAppContext, BorrowAppContext, Model, ModelContext};
use paths::local_settings_file_relative_path;
use rpc::{
proto::{self, AnyProtoClient},
TypedEnvelope,
};
use rpc::{proto, AnyProtoClient, TypedEnvelope};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use settings::{Settings, SettingsSources, SettingsStore};

View File

@ -17,8 +17,8 @@ use gpui::{
};
use postage::oneshot;
use rpc::{
proto::{self, AnyProtoClient, SSH_PROJECT_ID},
TypedEnvelope,
proto::{self, SSH_PROJECT_ID},
AnyProtoClient, TypedEnvelope,
};
use smol::{
channel::{Receiver, Sender},

View File

@ -19,11 +19,8 @@ doctest = false
[dependencies]
anyhow.workspace = true
collections.workspace = true
futures.workspace = true
parking_lot.workspace = true
prost.workspace = true
serde.workspace = true
gpui.workspace = true
[build-dependencies]
prost-build.workspace = true

View File

@ -2,11 +2,9 @@
pub mod error;
mod macros;
mod proto_client;
mod typed_envelope;
pub use error::*;
pub use proto_client::*;
pub use typed_envelope::*;
use collections::HashMap;

View File

@ -26,7 +26,7 @@ gpui.workspace = true
log.workspace = true
parking_lot.workspace = true
prost.workspace = true
rpc.workspace = true
rpc = { workspace = true, features = ["gpui"] }
serde.workspace = true
serde_json.workspace = true
smol.workspace = true

View File

@ -13,9 +13,9 @@ use futures::{
};
use gpui::{AppContext, AsyncAppContext, Model, SemanticVersion};
use parking_lot::Mutex;
use rpc::proto::{
self, build_typed_envelope, EntityMessageSubscriber, Envelope, EnvelopedMessage, PeerId,
ProtoClient, ProtoMessageHandlerSet, RequestMessage,
use rpc::{
proto::{self, build_typed_envelope, Envelope, EnvelopedMessage, PeerId, RequestMessage},
EntityMessageSubscriber, ProtoClient, ProtoMessageHandlerSet,
};
use smol::{
fs,

View File

@ -8,8 +8,8 @@ use project::{
};
use remote::SshSession;
use rpc::{
proto::{self, AnyProtoClient, SSH_PEER_ID, SSH_PROJECT_ID},
TypedEnvelope,
proto::{self, SSH_PEER_ID, SSH_PROJECT_ID},
AnyProtoClient, TypedEnvelope,
};
use smol::stream::StreamExt;
use std::{

View File

@ -14,6 +14,7 @@ path = "src/rpc.rs"
doctest = false
[features]
gpui = ["dep:gpui"]
test-support = ["collections/test-support", "gpui/test-support", "proto/test-support"]
[dependencies]
@ -39,7 +40,6 @@ zstd = "0.11"
[target.'cfg(target_os = "linux")'.dependencies]
zstd = { version = "0.11", features = [ "pkg-config" ] }
[dev-dependencies]
collections = { workspace = true, features = ["test-support"] }
env_logger.workspace = true

View File

@ -1,7 +1,3 @@
use crate::{
error::ErrorExt as _, AnyTypedEnvelope, EntityMessage, Envelope, EnvelopedMessage,
RequestMessage, TypedEnvelope,
};
use anyhow::anyhow;
use collections::HashMap;
use futures::{
@ -9,7 +5,11 @@ use futures::{
Future, FutureExt as _,
};
use gpui::{AnyModel, AnyWeakModel, AsyncAppContext, Model};
pub use prost::Message;
// pub use prost::Message;
use proto::{
error::ErrorExt as _, AnyTypedEnvelope, EntityMessage, Envelope, EnvelopedMessage,
RequestMessage, TypedEnvelope,
};
use std::{any::TypeId, sync::Arc};
#[derive(Clone)]

View File

@ -14,4 +14,9 @@ pub use peer::*;
pub use proto::{error::*, Receipt, TypedEnvelope};
mod macros;
#[cfg(feature = "gpui")]
mod proto_client;
#[cfg(feature = "gpui")]
pub use proto_client::*;
pub const PROTOCOL_VERSION: u32 = 68;

View File

@ -36,7 +36,7 @@ use postage::{
prelude::{Sink as _, Stream as _},
watch,
};
use rpc::proto::{self, AnyProtoClient};
use rpc::{proto, AnyProtoClient};
pub use settings::WorktreeId;
use settings::{Settings, SettingsLocation, SettingsStore};
use smallvec::{smallvec, SmallVec};