Detailed changes
@@ -129,8 +129,9 @@ jobs:
run: |
cargo build --workspace --bins --all-features
cargo check -p gpui --features "macos-blade"
- cargo check -p workspace --features "livekit-cross-platform"
+ cargo check -p workspace
cargo build -p remote_server
+ script/check-rust-livekit-macos
linux_tests:
timeout-minutes: 60
@@ -162,8 +163,10 @@ jobs:
- name: Run tests
uses: ./.github/actions/run_tests
- - name: Build Zed
- run: cargo build -p zed
+ - name: Build other binaries and features
+ run: |
+ cargo build -p zed
+ cargo check -p workspace
build_remote_server:
timeout-minutes: 60
@@ -21,8 +21,6 @@ test-support = [
"project/test-support",
"util/test-support"
]
-livekit-macos = ["livekit_client_macos"]
-livekit-cross-platform = ["livekit_client"]
[dependencies]
anyhow.workspace = true
@@ -42,8 +40,12 @@ serde.workspace = true
serde_derive.workspace = true
settings.workspace = true
util.workspace = true
-livekit_client_macos = { workspace = true, optional = true }
-livekit_client = { workspace = true, optional = true }
+
+[target.'cfg(target_os = "macos")'.dependencies]
+livekit_client_macos = { workspace = true }
+
+[target.'cfg(not(target_os = "macos"))'.dependencies]
+livekit_client = { workspace = true }
[dev-dependencies]
client = { workspace = true, features = ["test-support"] }
@@ -1,41 +1,13 @@
pub mod call_settings;
-#[cfg(any(
- all(target_os = "macos", feature = "livekit-macos"),
- all(
- not(target_os = "macos"),
- feature = "livekit-macos",
- not(feature = "livekit-cross-platform")
- )
-))]
+#[cfg(target_os = "macos")]
mod macos;
-#[cfg(any(
- all(target_os = "macos", feature = "livekit-macos"),
- all(
- not(target_os = "macos"),
- feature = "livekit-macos",
- not(feature = "livekit-cross-platform")
- )
-))]
+#[cfg(target_os = "macos")]
pub use macos::*;
-#[cfg(any(
- all(
- target_os = "macos",
- feature = "livekit-cross-platform",
- not(feature = "livekit-macos"),
- ),
- all(not(target_os = "macos"), feature = "livekit-cross-platform"),
-))]
+#[cfg(not(target_os = "macos"))]
mod cross_platform;
-#[cfg(any(
- all(
- target_os = "macos",
- feature = "livekit-cross-platform",
- not(feature = "livekit-macos"),
- ),
- all(not(target_os = "macos"), feature = "livekit-cross-platform"),
-))]
+#[cfg(not(target_os = "macos"))]
pub use cross_platform::*;
@@ -24,8 +24,6 @@ test-support = [
"gpui/test-support",
"fs/test-support",
]
-livekit-macos = ["call/livekit-macos"]
-livekit-cross-platform = ["call/livekit-cross-platform"]
[dependencies]
anyhow.workspace = true
@@ -1,282 +1,11 @@
-#[cfg(any(
- all(
- target_os = "macos",
- feature = "livekit-cross-platform",
- not(feature = "livekit-macos"),
- ),
- all(not(target_os = "macos"), feature = "livekit-cross-platform"),
-))]
-mod cross_platform {
- use crate::{
- item::{Item, ItemEvent},
- ItemNavHistory, WorkspaceId,
- };
- use call::{RemoteVideoTrack, RemoteVideoTrackView};
- use client::{proto::PeerId, User};
- use gpui::{
- div, AppContext, EventEmitter, FocusHandle, FocusableView, InteractiveElement,
- ParentElement, Render, SharedString, Styled, View, ViewContext, VisualContext,
- WindowContext,
- };
- use std::sync::Arc;
- use ui::{prelude::*, Icon, IconName};
+#[cfg(target_os = "macos")]
+mod macos;
- pub enum Event {
- Close,
- }
-
- pub struct SharedScreen {
- pub peer_id: PeerId,
- user: Arc<User>,
- nav_history: Option<ItemNavHistory>,
- view: View<RemoteVideoTrackView>,
- focus: FocusHandle,
- }
-
- impl SharedScreen {
- pub fn new(
- track: RemoteVideoTrack,
- peer_id: PeerId,
- user: Arc<User>,
- cx: &mut ViewContext<Self>,
- ) -> Self {
- let view = cx.new_view(|cx| RemoteVideoTrackView::new(track.clone(), cx));
- cx.subscribe(&view, |_, _, ev, cx| match ev {
- call::RemoteVideoTrackViewEvent::Close => cx.emit(Event::Close),
- })
- .detach();
- Self {
- view,
- peer_id,
- user,
- nav_history: Default::default(),
- focus: cx.focus_handle(),
- }
- }
- }
-
- impl EventEmitter<Event> for SharedScreen {}
-
- impl FocusableView for SharedScreen {
- fn focus_handle(&self, _: &AppContext) -> FocusHandle {
- self.focus.clone()
- }
- }
- impl Render for SharedScreen {
- fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
- div()
- .bg(cx.theme().colors().editor_background)
- .track_focus(&self.focus)
- .key_context("SharedScreen")
- .size_full()
- .child(self.view.clone())
- }
- }
-
- impl Item for SharedScreen {
- type Event = Event;
-
- fn tab_tooltip_text(&self, _: &AppContext) -> Option<SharedString> {
- Some(format!("{}'s screen", self.user.github_login).into())
- }
-
- fn deactivated(&mut self, cx: &mut ViewContext<Self>) {
- if let Some(nav_history) = self.nav_history.as_mut() {
- nav_history.push::<()>(None, cx);
- }
- }
-
- fn tab_icon(&self, _cx: &WindowContext) -> Option<Icon> {
- Some(Icon::new(IconName::Screen))
- }
-
- fn tab_content_text(&self, _cx: &WindowContext) -> Option<SharedString> {
- Some(format!("{}'s screen", self.user.github_login).into())
- }
-
- fn telemetry_event_text(&self) -> Option<&'static str> {
- None
- }
-
- fn set_nav_history(&mut self, history: ItemNavHistory, _: &mut ViewContext<Self>) {
- self.nav_history = Some(history);
- }
-
- fn clone_on_split(
- &self,
- _workspace_id: Option<WorkspaceId>,
- cx: &mut ViewContext<Self>,
- ) -> Option<View<Self>> {
- Some(cx.new_view(|cx| Self {
- view: self.view.update(cx, |view, cx| view.clone(cx)),
- peer_id: self.peer_id,
- user: self.user.clone(),
- nav_history: Default::default(),
- focus: cx.focus_handle(),
- }))
- }
+#[cfg(target_os = "macos")]
+pub use macos::*;
- fn to_item_events(event: &Self::Event, mut f: impl FnMut(ItemEvent)) {
- match event {
- Event::Close => f(ItemEvent::CloseItem),
- }
- }
- }
-}
+#[cfg(not(target_os = "macos"))]
+mod cross_platform;
-#[cfg(any(
- all(
- target_os = "macos",
- feature = "livekit-cross-platform",
- not(feature = "livekit-macos"),
- ),
- all(not(target_os = "macos"), feature = "livekit-cross-platform"),
-))]
+#[cfg(not(target_os = "macos"))]
pub use cross_platform::*;
-
-#[cfg(any(
- all(target_os = "macos", feature = "livekit-macos"),
- all(
- not(target_os = "macos"),
- feature = "livekit-macos",
- not(feature = "livekit-cross-platform")
- )
-))]
-mod macos {
- use crate::{
- item::{Item, ItemEvent},
- ItemNavHistory, WorkspaceId,
- };
- use anyhow::Result;
- use call::participant::{Frame, RemoteVideoTrack};
- use client::{proto::PeerId, User};
- use futures::StreamExt;
- use gpui::{
- div, surface, AppContext, EventEmitter, FocusHandle, FocusableView, InteractiveElement,
- ParentElement, Render, SharedString, Styled, Task, View, ViewContext, VisualContext,
- WindowContext,
- };
- use std::sync::{Arc, Weak};
- use ui::{prelude::*, Icon, IconName};
-
- pub enum Event {
- Close,
- }
-
- pub struct SharedScreen {
- track: Weak<RemoteVideoTrack>,
- frame: Option<Frame>,
- pub peer_id: PeerId,
- user: Arc<User>,
- nav_history: Option<ItemNavHistory>,
- _maintain_frame: Task<Result<()>>,
- focus: FocusHandle,
- }
-
- impl SharedScreen {
- pub fn new(
- track: Arc<RemoteVideoTrack>,
- peer_id: PeerId,
- user: Arc<User>,
- cx: &mut ViewContext<Self>,
- ) -> Self {
- cx.focus_handle();
- let mut frames = track.frames();
- Self {
- track: Arc::downgrade(&track),
- frame: None,
- peer_id,
- user,
- nav_history: Default::default(),
- _maintain_frame: cx.spawn(|this, mut cx| async move {
- while let Some(frame) = frames.next().await {
- this.update(&mut cx, |this, cx| {
- this.frame = Some(frame);
- cx.notify();
- })?;
- }
- this.update(&mut cx, |_, cx| cx.emit(Event::Close))?;
- Ok(())
- }),
- focus: cx.focus_handle(),
- }
- }
- }
-
- impl EventEmitter<Event> for SharedScreen {}
-
- impl FocusableView for SharedScreen {
- fn focus_handle(&self, _: &AppContext) -> FocusHandle {
- self.focus.clone()
- }
- }
- impl Render for SharedScreen {
- fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
- div()
- .bg(cx.theme().colors().editor_background)
- .track_focus(&self.focus)
- .key_context("SharedScreen")
- .size_full()
- .children(
- self.frame
- .as_ref()
- .map(|frame| surface(frame.image()).size_full()),
- )
- }
- }
-
- impl Item for SharedScreen {
- type Event = Event;
-
- fn tab_tooltip_text(&self, _: &AppContext) -> Option<SharedString> {
- Some(format!("{}'s screen", self.user.github_login).into())
- }
-
- fn deactivated(&mut self, cx: &mut ViewContext<Self>) {
- if let Some(nav_history) = self.nav_history.as_mut() {
- nav_history.push::<()>(None, cx);
- }
- }
-
- fn tab_icon(&self, _cx: &WindowContext) -> Option<Icon> {
- Some(Icon::new(IconName::Screen))
- }
-
- fn tab_content_text(&self, _cx: &WindowContext) -> Option<SharedString> {
- Some(format!("{}'s screen", self.user.github_login).into())
- }
-
- fn telemetry_event_text(&self) -> Option<&'static str> {
- None
- }
-
- fn set_nav_history(&mut self, history: ItemNavHistory, _: &mut ViewContext<Self>) {
- self.nav_history = Some(history);
- }
-
- fn clone_on_split(
- &self,
- _workspace_id: Option<WorkspaceId>,
- cx: &mut ViewContext<Self>,
- ) -> Option<View<Self>> {
- let track = self.track.upgrade()?;
- Some(cx.new_view(|cx| Self::new(track, self.peer_id, self.user.clone(), cx)))
- }
-
- fn to_item_events(event: &Self::Event, mut f: impl FnMut(ItemEvent)) {
- match event {
- Event::Close => f(ItemEvent::CloseItem),
- }
- }
- }
-}
-
-#[cfg(any(
- all(target_os = "macos", feature = "livekit-macos"),
- all(
- not(target_os = "macos"),
- feature = "livekit-macos",
- not(feature = "livekit-cross-platform")
- )
-))]
-pub use macos::*;
@@ -0,0 +1,114 @@
+use crate::{
+ item::{Item, ItemEvent},
+ ItemNavHistory, WorkspaceId,
+};
+use call::{RemoteVideoTrack, RemoteVideoTrackView};
+use client::{proto::PeerId, User};
+use gpui::{
+ div, AppContext, EventEmitter, FocusHandle, FocusableView, InteractiveElement, ParentElement,
+ Render, SharedString, Styled, View, ViewContext, VisualContext, WindowContext,
+};
+use std::sync::Arc;
+use ui::{prelude::*, Icon, IconName};
+
+pub enum Event {
+ Close,
+}
+
+pub struct SharedScreen {
+ pub peer_id: PeerId,
+ user: Arc<User>,
+ nav_history: Option<ItemNavHistory>,
+ view: View<RemoteVideoTrackView>,
+ focus: FocusHandle,
+}
+
+impl SharedScreen {
+ pub fn new(
+ track: RemoteVideoTrack,
+ peer_id: PeerId,
+ user: Arc<User>,
+ cx: &mut ViewContext<Self>,
+ ) -> Self {
+ let view = cx.new_view(|cx| RemoteVideoTrackView::new(track.clone(), cx));
+ cx.subscribe(&view, |_, _, ev, cx| match ev {
+ call::RemoteVideoTrackViewEvent::Close => cx.emit(Event::Close),
+ })
+ .detach();
+ Self {
+ view,
+ peer_id,
+ user,
+ nav_history: Default::default(),
+ focus: cx.focus_handle(),
+ }
+ }
+}
+
+impl EventEmitter<Event> for SharedScreen {}
+
+impl FocusableView for SharedScreen {
+ fn focus_handle(&self, _: &AppContext) -> FocusHandle {
+ self.focus.clone()
+ }
+}
+impl Render for SharedScreen {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
+ div()
+ .bg(cx.theme().colors().editor_background)
+ .track_focus(&self.focus)
+ .key_context("SharedScreen")
+ .size_full()
+ .child(self.view.clone())
+ }
+}
+
+impl Item for SharedScreen {
+ type Event = Event;
+
+ fn tab_tooltip_text(&self, _: &AppContext) -> Option<SharedString> {
+ Some(format!("{}'s screen", self.user.github_login).into())
+ }
+
+ fn deactivated(&mut self, cx: &mut ViewContext<Self>) {
+ if let Some(nav_history) = self.nav_history.as_mut() {
+ nav_history.push::<()>(None, cx);
+ }
+ }
+
+ fn tab_icon(&self, _cx: &WindowContext) -> Option<Icon> {
+ Some(Icon::new(IconName::Screen))
+ }
+
+ fn tab_content_text(&self, _cx: &WindowContext) -> Option<SharedString> {
+ Some(format!("{}'s screen", self.user.github_login).into())
+ }
+
+ fn telemetry_event_text(&self) -> Option<&'static str> {
+ None
+ }
+
+ fn set_nav_history(&mut self, history: ItemNavHistory, _: &mut ViewContext<Self>) {
+ self.nav_history = Some(history);
+ }
+
+ fn clone_on_split(
+ &self,
+ _workspace_id: Option<WorkspaceId>,
+ cx: &mut ViewContext<Self>,
+ ) -> Option<View<Self>> {
+ Some(cx.new_view(|cx| Self {
+ view: self.view.update(cx, |view, cx| view.clone(cx)),
+ peer_id: self.peer_id,
+ user: self.user.clone(),
+ nav_history: Default::default(),
+ focus: cx.focus_handle(),
+ }))
+ }
+
+ fn to_item_events(event: &Self::Event, mut f: impl FnMut(ItemEvent)) {
+ match event {
+ Event::Close => f(ItemEvent::CloseItem),
+ }
+ }
+}
@@ -0,0 +1,126 @@
+use crate::{
+ item::{Item, ItemEvent},
+ ItemNavHistory, WorkspaceId,
+};
+use anyhow::Result;
+use call::participant::{Frame, RemoteVideoTrack};
+use client::{proto::PeerId, User};
+use futures::StreamExt;
+use gpui::{
+ div, surface, AppContext, EventEmitter, FocusHandle, FocusableView, InteractiveElement,
+ ParentElement, Render, SharedString, Styled, Task, View, ViewContext, VisualContext,
+ WindowContext,
+};
+use std::sync::{Arc, Weak};
+use ui::{prelude::*, Icon, IconName};
+
+pub enum Event {
+ Close,
+}
+
+pub struct SharedScreen {
+ track: Weak<RemoteVideoTrack>,
+ frame: Option<Frame>,
+ pub peer_id: PeerId,
+ user: Arc<User>,
+ nav_history: Option<ItemNavHistory>,
+ _maintain_frame: Task<Result<()>>,
+ focus: FocusHandle,
+}
+
+impl SharedScreen {
+ pub fn new(
+ track: Arc<RemoteVideoTrack>,
+ peer_id: PeerId,
+ user: Arc<User>,
+ cx: &mut ViewContext<Self>,
+ ) -> Self {
+ cx.focus_handle();
+ let mut frames = track.frames();
+ Self {
+ track: Arc::downgrade(&track),
+ frame: None,
+ peer_id,
+ user,
+ nav_history: Default::default(),
+ _maintain_frame: cx.spawn(|this, mut cx| async move {
+ while let Some(frame) = frames.next().await {
+ this.update(&mut cx, |this, cx| {
+ this.frame = Some(frame);
+ cx.notify();
+ })?;
+ }
+ this.update(&mut cx, |_, cx| cx.emit(Event::Close))?;
+ Ok(())
+ }),
+ focus: cx.focus_handle(),
+ }
+ }
+}
+
+impl EventEmitter<Event> for SharedScreen {}
+
+impl FocusableView for SharedScreen {
+ fn focus_handle(&self, _: &AppContext) -> FocusHandle {
+ self.focus.clone()
+ }
+}
+impl Render for SharedScreen {
+ fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
+ div()
+ .bg(cx.theme().colors().editor_background)
+ .track_focus(&self.focus)
+ .key_context("SharedScreen")
+ .size_full()
+ .children(
+ self.frame
+ .as_ref()
+ .map(|frame| surface(frame.image()).size_full()),
+ )
+ }
+}
+
+impl Item for SharedScreen {
+ type Event = Event;
+
+ fn tab_tooltip_text(&self, _: &AppContext) -> Option<SharedString> {
+ Some(format!("{}'s screen", self.user.github_login).into())
+ }
+
+ fn deactivated(&mut self, cx: &mut ViewContext<Self>) {
+ if let Some(nav_history) = self.nav_history.as_mut() {
+ nav_history.push::<()>(None, cx);
+ }
+ }
+
+ fn tab_icon(&self, _cx: &WindowContext) -> Option<Icon> {
+ Some(Icon::new(IconName::Screen))
+ }
+
+ fn tab_content_text(&self, _cx: &WindowContext) -> Option<SharedString> {
+ Some(format!("{}'s screen", self.user.github_login).into())
+ }
+
+ fn telemetry_event_text(&self) -> Option<&'static str> {
+ None
+ }
+
+ fn set_nav_history(&mut self, history: ItemNavHistory, _: &mut ViewContext<Self>) {
+ self.nav_history = Some(history);
+ }
+
+ fn clone_on_split(
+ &self,
+ _workspace_id: Option<WorkspaceId>,
+ cx: &mut ViewContext<Self>,
+ ) -> Option<View<Self>> {
+ let track = self.track.upgrade()?;
+ Some(cx.new_view(|cx| Self::new(track, self.peer_id, self.user.clone(), cx)))
+ }
+
+ fn to_item_events(event: &Self::Event, mut f: impl FnMut(ItemEvent)) {
+ match event {
+ Event::Close => f(ItemEvent::CloseItem),
+ }
+ }
+}
@@ -127,12 +127,6 @@ welcome.workspace = true
workspace.workspace = true
zed_actions.workspace = true
-[target.'cfg(target_os = "macos")'.dependencies]
-workspace = { workspace = true, features = ["livekit-macos"] }
-
-[target.'cfg(not(target_os = "macos"))'.dependencies]
-workspace = { workspace = true, features = ["livekit-cross-platform"] }
-
[target.'cfg(target_os = "windows")'.dependencies]
windows.workspace = true
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+
+set -exuo pipefail
+
+git apply script/patches/use-cross-platform-livekit.patch
+
+# Re-enable error skipping for this check, so that we can unapply the patch
+set +e
+
+cargo check -p workspace
+exit_code=$?
+
+# Disable error skipping again
+set -e
+
+git apply -R script/patches/use-cross-platform-livekit.patch
+
+exit "$exit_code"
@@ -0,0 +1,59 @@
+diff --git a/crates/call/Cargo.toml b/crates/call/Cargo.toml
+index 9ba10e56ba..bb69440691 100644
+--- a/crates/call/Cargo.toml
++++ b/crates/call/Cargo.toml
+@@ -41,10 +41,10 @@ serde_derive.workspace = true
+ settings.workspace = true
+ util.workspace = true
+
+-[target.'cfg(target_os = "macos")'.dependencies]
++[target.'cfg(any())'.dependencies]
+ livekit_client_macos = { workspace = true }
+
+-[target.'cfg(not(target_os = "macos"))'.dependencies]
++[target.'cfg(all())'.dependencies]
+ livekit_client = { workspace = true }
+
+ [dev-dependencies]
+diff --git a/crates/call/src/call.rs b/crates/call/src/call.rs
+index 5e212d35b7..a8f9e8f43e 100644
+--- a/crates/call/src/call.rs
++++ b/crates/call/src/call.rs
+@@ -1,13 +1,13 @@
+ pub mod call_settings;
+
+-#[cfg(target_os = "macos")]
++#[cfg(any())]
+ mod macos;
+
+-#[cfg(target_os = "macos")]
++#[cfg(any())]
+ pub use macos::*;
+
+-#[cfg(not(target_os = "macos"))]
++#[cfg(all())]
+ mod cross_platform;
+
+-#[cfg(not(target_os = "macos"))]
++#[cfg(all())]
+ pub use cross_platform::*;
+diff --git a/crates/workspace/src/shared_screen.rs b/crates/workspace/src/shared_screen.rs
+index 1d17cfa145..f845234987 100644
+--- a/crates/workspace/src/shared_screen.rs
++++ b/crates/workspace/src/shared_screen.rs
+@@ -1,11 +1,11 @@
+-#[cfg(target_os = "macos")]
++#[cfg(any())]
+ mod macos;
+
+-#[cfg(target_os = "macos")]
++#[cfg(any())]
+ pub use macos::*;
+
+-#[cfg(not(target_os = "macos"))]
++#[cfg(all())]
+ mod cross_platform;
+
+-#[cfg(not(target_os = "macos"))]
++#[cfg(all())]
+ pub use cross_platform::*;
@@ -43,6 +43,8 @@ extend-exclude = [
"docs/theme/css/",
# Spellcheck triggers on `|Fixe[sd]|` regex part.
"script/danger/dangerfile.ts",
+ # Hashes are not typos
+ "script/patches/use-cross-platform-livekit.patch"
]
[default]