collab: Remove dependency on X11 (#19079)

collab: Remove dependency on X11

I'm not sure if this is the best solution (perhaps pulling
`LanguageName` into a separate `language_types` crate would be
better...?) - but it massively reduces build time / dependencies / size
and means that the collab server no longer requires X11 libraries to be
installed.

tl;dr: `telemetry_events` requires the `language` crate, and the
language crate requires a whole ton of extra stuff. Since
telemetry_events only uses `language` for a single type definition
(`LanguageName`, aka `String`), we can cut all of these out by using the
base `String` type (This doesn't seem too terrible, given that all other
telemetry fields are using basic datatypes like String as opposed to
more strongly-typed variants).


FYI the dependency tree for "why does collab need X11 libraries??" looks
like this:

```
collab
 \- telemetry_events
     \- language
         |- gpui
         |- fuzzy
         |   \- gpui
         |- git
         |   \- gpui
         |- lsp
         |   |- gpui
         |   \- release_channel
         |       \- gpui
         |- settings
         |   |- fs
         |   |   \- gpui
         |   \- gpui
         |- task
         |   \- gpui
         \- theme
             \- gpui
```

Release Notes:

- N/A
This commit is contained in:
Shish 2024-10-11 18:28:34 +01:00 committed by GitHub
parent 84b61c8b1a
commit f1c45d988e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 6 additions and 30 deletions

1
Cargo.lock generated
View file

@ -11346,7 +11346,6 @@ dependencies = [
name = "telemetry_events" name = "telemetry_events"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"language",
"semantic_version", "semantic_version",
"serde", "serde",
] ]

View file

@ -13,30 +13,9 @@ ARG GITHUB_SHA
ENV GITHUB_SHA=$GITHUB_SHA ENV GITHUB_SHA=$GITHUB_SHA
# At some point in the past 3 weeks, additional dependencies on `xkbcommon` and
# `xkbcommon-x11` were introduced into collab.
#
# A `git bisect` points to this commit as being the culprit: `b8e6098f60e5dabe98fe8281f993858dacc04a55`.
#
# Now when we try to build collab for the Docker image, it fails with the following
# error:
#
# ```
# 985.3 = note: /usr/bin/ld: cannot find -lxkbcommon: No such file or directory
# 985.3 /usr/bin/ld: cannot find -lxkbcommon-x11: No such file or directory
# 985.3 collect2: error: ld returned 1 exit status
# ```
#
# The last successful deploys were at:
# - Staging: `4f408ec65a3867278322a189b4eb20f1ab51f508`
# - Production: `fc4c533d0a8c489e5636a4249d2b52a80039fbd7`
#
# Also add `cmake`, since we need it to build `wasmtime`. # Also add `cmake`, since we need it to build `wasmtime`.
#
# Installing these as a temporary workaround, but I think ideally we'd want to figure
# out what caused them to be included in the first place.
RUN apt-get update; \ RUN apt-get update; \
apt-get install -y --no-install-recommends libxkbcommon-dev libxkbcommon-x11-dev cmake apt-get install -y --no-install-recommends cmake
RUN --mount=type=cache,target=./script/node_modules \ RUN --mount=type=cache,target=./script/node_modules \
--mount=type=cache,target=/usr/local/cargo/registry \ --mount=type=cache,target=/usr/local/cargo/registry \

View file

@ -2160,7 +2160,7 @@ impl Context {
model_provider: model.provider_id().to_string(), model_provider: model.provider_id().to_string(),
response_latency, response_latency,
error_message, error_message,
language_name, language_name: language_name.map(|name| name.to_proto()),
}); });
} }

View file

@ -267,7 +267,7 @@ impl InlineAssistant {
model_provider: model.provider_id().to_string(), model_provider: model.provider_id().to_string(),
response_latency: None, response_latency: None,
error_message: None, error_message: None,
language_name: buffer.language().map(|language| language.name()), language_name: buffer.language().map(|language| language.name().to_proto()),
}); });
} }
} }
@ -788,7 +788,7 @@ impl InlineAssistant {
model_provider: model.provider_id().to_string(), model_provider: model.provider_id().to_string(),
response_latency: None, response_latency: None,
error_message: None, error_message: None,
language_name, language_name: language_name.map(|name| name.to_proto()),
}); });
} }
} }
@ -2954,7 +2954,7 @@ impl CodegenAlternative {
model_provider: model_provider_id.to_string(), model_provider: model_provider_id.to_string(),
response_latency, response_latency,
error_message, error_message,
language_name, language_name: language_name.map(|name| name.to_proto()),
}); });
} }

View file

@ -12,6 +12,5 @@ workspace = true
path = "src/telemetry_events.rs" path = "src/telemetry_events.rs"
[dependencies] [dependencies]
language.workspace = true
semantic_version.workspace = true semantic_version.workspace = true
serde.workspace = true serde.workspace = true

View file

@ -1,6 +1,5 @@
//! See [Telemetry in Zed](https://zed.dev/docs/telemetry) for additional information. //! See [Telemetry in Zed](https://zed.dev/docs/telemetry) for additional information.
use language::LanguageName;
use semantic_version::SemanticVersion; use semantic_version::SemanticVersion;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::{fmt::Display, sync::Arc, time::Duration}; use std::{fmt::Display, sync::Arc, time::Duration};
@ -150,7 +149,7 @@ pub struct AssistantEvent {
pub model_provider: String, pub model_provider: String,
pub response_latency: Option<Duration>, pub response_latency: Option<Duration>,
pub error_message: Option<String>, pub error_message: Option<String>,
pub language_name: Option<LanguageName>, pub language_name: Option<String>,
} }
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]