My stab at CI (#66)

This commit is contained in:
Miles Wirht
2026-06-15 18:42:57 -04:00
committed by GitHub
parent 74a728db05
commit ec395ac14c
32 changed files with 815 additions and 280 deletions
+12 -20
View File
@@ -19,23 +19,17 @@ workspace = true
[features]
default = ["font-kit", "wayland", "x11", "windows-manifest"]
test-support = [
"leak-detection",
"collections/test-support",
"wayland",
"x11",
"proptest",
"leak-detection",
"collections/test-support",
"wayland",
"x11",
"proptest",
]
inspector = ["gpui_macros/inspector"]
leak-detection = ["backtrace"]
wayland = [
"bitflags",
]
x11 = [
"scap?/x11",
]
screen-capture = [
"scap",
]
wayland = ["bitflags"]
x11 = ["scap?/x11"]
screen-capture = ["scap"]
windows-manifest = ["dep:embed-resource"]
input-latency-histogram = ["dep:hdrhistogram"]
@@ -76,10 +70,10 @@ regex.workspace = true
refineable.workspace = true
scheduler.workspace = true
resvg = { version = "0.45.0", default-features = false, features = [
"text",
"system-fonts",
"memmap-fonts",
"raster-images"
"text",
"system-fonts",
"memmap-fonts",
"raster-images",
] }
usvg = { version = "0.45.0", default-features = false }
ttf-parser = "0.25"
@@ -140,7 +134,6 @@ pathfinder_geometry = "0.5"
scap = { workspace = true, optional = true }
[target.'cfg(target_os = "windows")'.dependencies]
windows = { version = "0.61", features = ["Win32_Foundation"] }
@@ -159,7 +152,6 @@ scheduler = { workspace = true, features = ["test-support"] }
unicode-segmentation = { workspace = true }
[target.'cfg(target_family = "wasm")'.dev-dependencies]
wasm-bindgen = { workspace = true }
gpui_web.workspace = true
+5 -3
View File
@@ -138,9 +138,11 @@ fn content_blurred_rich() -> impl IntoElement {
.items_center()
.justify_center()
.gap_3()
.children([0xef4444, 0x22c55e, 0x3b82f6].into_iter().map(|hex| {
div().w(px(48.)).h(px(48.)).rounded_md().bg(rgb(hex))
}))
.children(
[0xef4444, 0x22c55e, 0x3b82f6]
.into_iter()
.map(|hex| div().w(px(48.)).h(px(48.)).rounded_md().bg(rgb(hex))),
)
}
/// Nested content blur: a `blur()` element inside another `blur()` element. The inner block is
+1 -3
View File
@@ -22,6 +22,7 @@ use itertools::Itertools;
use parking_lot::RwLock;
use slotmap::SlotMap;
use crate::http_client::{HttpClient, NullHttpClient};
pub use async_context::*;
use collections::{FxHashMap, FxHashSet, HashMap, VecDeque};
pub use context::*;
@@ -29,7 +30,6 @@ pub use entity_map::*;
use gpui_util::{ResultExt, debug_panic};
#[cfg(any(test, feature = "test-support"))]
pub use headless_app_context::*;
use crate::http_client::{HttpClient, NullHttpClient};
use smallvec::SmallVec;
#[cfg(any(test, feature = "test-support"))]
pub use test_app::*;
@@ -2710,8 +2710,6 @@ pub struct KeystrokeEvent {
pub context_stack: Vec<KeyContext>,
}
/// A mutable reference to an entity owned by GPUI
pub struct GpuiBorrow<'a, T> {
inner: Option<Lease<T>>,
+17 -18
View File
@@ -618,25 +618,24 @@ impl Asset for ImageAssetLoader {
async move {
let bytes = match source.clone() {
Resource::Path(uri) => fs::read(uri.as_ref())?,
Resource::Uri(uri) => {
use anyhow::Context as _;
Resource::Uri(uri) => {
use anyhow::Context as _;
let response = client
.get(uri.as_ref(), true)
.await
.with_context(|| format!("loading image asset from {uri:?}"))?;
if !response.status.is_success() {
let mut error_body =
String::from_utf8_lossy(&response.body).into_owned();
let first_line = error_body.lines().next().unwrap_or("").trim_end();
error_body.truncate(first_line.len());
return Err(ImageCacheError::BadStatus {
uri,
status: response.status,
body: error_body,
});
}
response.body
let response = client
.get(uri.as_ref(), true)
.await
.with_context(|| format!("loading image asset from {uri:?}"))?;
if !response.status.is_success() {
let mut error_body = String::from_utf8_lossy(&response.body).into_owned();
let first_line = error_body.lines().next().unwrap_or("").trim_end();
error_body.truncate(first_line.len());
return Err(ImageCacheError::BadStatus {
uri,
status: response.status,
body: error_body,
});
}
response.body
}
Resource::Embedded(path) => {
let data = asset_source.load(&path).ok().flatten();
+9 -9
View File
@@ -40,12 +40,12 @@ impl Clone for SurfaceSource {
}
impl std::fmt::Debug for SurfaceSource {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match *self {
#[cfg(target_os = "macos")]
SurfaceSource::Surface(ref buf) => f.debug_tuple("Surface").field(buf).finish(),
SurfaceSource::Surface(ref buf) => _f.debug_tuple("Surface").field(buf).finish(),
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
SurfaceSource::Texture { size, .. } => f
SurfaceSource::Texture { size, .. } => _f
.debug_struct("Texture")
.field("size", &size)
.finish_non_exhaustive(),
@@ -124,27 +124,27 @@ impl Element for Surface {
&mut self,
_global_id: Option<&GlobalElementId>,
_inspector_id: Option<&InspectorElementId>,
bounds: Bounds<Pixels>,
_bounds: Bounds<Pixels>,
_: &mut Self::RequestLayoutState,
_: &mut Self::PrepaintState,
window: &mut Window,
_window: &mut Window,
_: &mut App,
) {
match self.source {
#[cfg(target_os = "macos")]
SurfaceSource::Surface(ref surface) => {
let size = crate::size(surface.get_width().into(), surface.get_height().into());
let new_bounds = self.object_fit.get_bounds(bounds, size);
let new_bounds = self.object_fit.get_bounds(_bounds, size);
// TODO: Add support for corner_radii
window.paint_surface(new_bounds, surface.clone());
_window.paint_surface(new_bounds, surface.clone());
}
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
SurfaceSource::Texture {
ref texture,
ref size,
} => {
let new_bounds = self.object_fit.get_bounds(bounds, *size);
window.paint_surface(new_bounds, Arc::clone(texture), *size);
let new_bounds = self.object_fit.get_bounds(_bounds, *size);
_window.paint_surface(new_bounds, Arc::clone(texture), *size);
}
}
}
+1 -2
View File
@@ -9,8 +9,7 @@ use crate::{
CornersRefinement, CursorStyle, DefiniteLength, DevicePixels, Edges, EdgesRefinement, Font,
FontFallbacks, FontFeatures, FontStyle, FontWeight, GridLocation, Hsla, Length, Pixels, Point,
PointRefinement, Rgba, ScaledPixels, SharedString, Size, SizeRefinement, Styled, TextRun,
Window, black, phi,
point, quad, rems, size,
Window, black, phi, point, quad, rems, size,
};
use collections::HashSet;
use refineable::Refineable;
+1 -1
View File
@@ -702,7 +702,7 @@ mod tests {
#[test]
fn test_state_with_point() {
let initial: Point<f32> = Point { x: 10.0, y: 20.0 };
let state = TransitionState::new(initial.clone());
let state = TransitionState::new(initial);
assert_eq!(state.initial_goal.x, 10.0);
assert_eq!(state.initial_goal.y, 20.0);
+6 -7
View File
@@ -13,13 +13,12 @@ use crate::{
PolychromeSprite, Priority, PromptButton, PromptLevel, Quad, Render, RenderGlyphParams,
RenderImage, RenderImageParams, RenderSvgParams, Replay, ResizeEdge, SMOOTH_SVG_SCALE_FACTOR,
SUBPIXEL_VARIANTS_X, SUBPIXEL_VARIANTS_Y, ScaledFilter, ScaledPixels, Scene, Shadow,
SharedString, Size,
StrikethroughStyle, Style, SubpixelSprite, SubscriberSet, Subscription, SystemWindowTab,
SystemWindowTabController, TabStopMap, TaffyLayoutEngine, Task, TextRenderingMode, TextStyle,
TextStyleRefinement, ThermalState, TransformationMatrix, Transition, TransitionState,
Underline, UnderlineStyle, WindowAppearance, WindowBackgroundAppearance, WindowBounds,
WindowControls, WindowDecorations, WindowOptions, WindowParams, WindowTextSystem, point,
prelude::*, px, rems, size, transparent_black,
SharedString, Size, StrikethroughStyle, Style, SubpixelSprite, SubscriberSet, Subscription,
SystemWindowTab, SystemWindowTabController, TabStopMap, TaffyLayoutEngine, Task,
TextRenderingMode, TextStyle, TextStyleRefinement, ThermalState, TransformationMatrix,
Transition, TransitionState, Underline, UnderlineStyle, WindowAppearance,
WindowBackgroundAppearance, WindowBounds, WindowControls, WindowDecorations, WindowOptions,
WindowParams, WindowTextSystem, point, prelude::*, px, rems, size, transparent_black,
};
use anyhow::{Context as _, Result, anyhow};
use collections::{FxHashMap, FxHashSet};
+3
View File
@@ -8,6 +8,9 @@ license = "Apache-2.0"
[lints]
workspace = true
[package.metadata.cargo-machete]
ignored = ["gpui"]
[dependencies]
gpui.workspace = true
+48 -48
View File
@@ -15,39 +15,36 @@ path = "src/gpui_linux.rs"
default = ["wayland", "x11"]
test-support = ["gpui/test-support"]
wayland = [
"bitflags",
"gpui_wgpu",
"ashpd/wayland",
"bitflags",
"gpui_wgpu",
"ashpd/wayland",
"calloop-wayland-source",
"wayland-backend",
"wayland-client",
"wayland-cursor",
"wayland-protocols",
"wayland-protocols-plasma",
"wayland-protocols-wlr",
"filedescriptor",
"xkbcommon",
"open",
"gpui/wayland",
"calloop-wayland-source",
"wayland-backend",
"wayland-client",
"wayland-cursor",
"wayland-protocols",
"wayland-protocols-plasma",
"wayland-protocols-wlr",
"filedescriptor",
"xkbcommon",
"open",
"gpui/wayland",
]
x11 = [
"gpui_wgpu",
"ashpd",
"gpui_wgpu",
"ashpd",
"as-raw-xcb-connection",
"x11rb",
"xkbcommon",
"xim",
"x11-clipboard",
"filedescriptor",
"open",
"scap?/x11",
]
screen-capture = [
"gpui/screen-capture",
"scap",
"as-raw-xcb-connection",
"x11rb",
"xkbcommon",
"xim",
"x11-clipboard",
"filedescriptor",
"open",
"scap?/x11",
]
screen-capture = ["gpui/screen-capture", "scap"]
[target.'cfg(any(target_os = "linux", target_os = "freebsd"))'.dependencies]
@@ -76,8 +73,8 @@ uuid.workspace = true
# Always used
oo7 = { version = "0.6", default-features = false, features = [
"async-std",
"native_crypto",
"async-std",
"native_crypto",
] }
calloop = "0.14.3"
raw-window-handle = "0.6"
@@ -88,7 +85,10 @@ swash = { version = "0.2.6" }
bitflags = { workspace = true, optional = true }
filedescriptor = { version = "0.8.2", optional = true }
open = { version = "5.2.0", optional = true }
xkbcommon = { version = "0.8.0", features = ["wayland", "x11"], optional = true }
xkbcommon = { version = "0.8.0", features = [
"wayland",
"x11",
], optional = true }
# Screen capture
scap = { workspace = true, optional = true }
@@ -96,38 +96,38 @@ scap = { workspace = true, optional = true }
# Wayland
calloop-wayland-source = { version = "0.4.1", optional = true }
wayland-backend = { version = "0.3.3", features = [
"client_system",
"dlopen",
"client_system",
"dlopen",
], optional = true }
wayland-client = { version = "0.31.11", optional = true }
wayland-cursor = { version = "0.31.11", optional = true }
wayland-protocols = { version = "0.32.9", features = [
"client",
"staging",
"unstable",
"client",
"staging",
"unstable",
], optional = true }
wayland-protocols-plasma = { version = "0.3.9", features = [
"client",
"client",
], optional = true }
wayland-protocols-wlr = { version = "0.3.9", features = [
"client",
"client",
], optional = true }
# X11
as-raw-xcb-connection = { version = "1", optional = true }
x11rb = { version = "0.13.1", features = [
"allow-unsafe-code",
"xkb",
"randr",
"xinput",
"cursor",
"resource_manager",
"sync",
"dri3",
"allow-unsafe-code",
"xkb",
"randr",
"xinput",
"cursor",
"resource_manager",
"sync",
"dri3",
], optional = true }
# WARNING: If you change this, you must also publish a new version of zed-xim to crates.io
xim = { git = "https://github.com/zed-industries/xim-rs.git", rev = "16f35a2c881b815a2b6cdfd6687988e84f8447d8", features = [
"x11rb-xcb",
"x11rb-client",
"x11rb-xcb",
"x11rb-client",
], package = "zed-xim", version = "0.4.0-zed", optional = true }
x11-clipboard = { version = "0.9.3", optional = true }
@@ -15,8 +15,8 @@ use calloop::{
use calloop_wayland_source::WaylandSource;
use collections::HashMap;
use filedescriptor::Pipe;
use url::Url;
use smallvec::SmallVec;
use url::Url;
use util::ResultExt as _;
use wayland_backend::client::ObjectId;
use wayland_backend::protocol::WEnum;
+1 -1
View File
@@ -7,7 +7,6 @@ use calloop::{
use collections::HashMap;
use core::str;
use gpui::{Capslock, TaskTiming, profiler};
use url::Url;
use log::Level;
use smallvec::SmallVec;
use std::{
@@ -18,6 +17,7 @@ use std::{
rc::{Rc, Weak},
time::{Duration, Instant},
};
use url::Url;
use util::ResultExt as _;
use x11rb::{
+1 -1
View File
@@ -24,4 +24,4 @@ quote.workspace = true
syn.workspace = true
[dev-dependencies]
gpui = { workspace = true, features = ["inspector"] }
gpui = { workspace = true, features = ["inspector", "test-support"] }
+6 -1
View File
@@ -15,7 +15,12 @@ path = "src/gpui_platform.rs"
default = []
font-kit = ["gpui_macos/font-kit"]
test-support = ["gpui/test-support", "gpui_macos/test-support"]
screen-capture = ["gpui/screen-capture", "gpui_macos/screen-capture", "gpui_windows/screen-capture", "gpui_linux/screen-capture"]
screen-capture = [
"gpui/screen-capture",
"gpui_macos/screen-capture",
"gpui_windows/screen-capture",
"gpui_linux/screen-capture",
]
runtime_shaders = ["gpui_macos/runtime_shaders"]
wayland = ["gpui_linux/wayland"]
x11 = ["gpui_linux/x11"]
+36 -36
View File
@@ -20,7 +20,7 @@ path = "src/gpui_web.rs"
gpui.workspace = true
parking_lot = { workspace = true, features = ["nightly"] }
gpui_wgpu.workspace = true
http_client.workspace = true
http.workspace = true
anyhow.workspace = true
futures.workspace = true
log.workspace = true
@@ -34,39 +34,39 @@ js-sys = "0.3"
raw-window-handle = "0.6"
wasm_thread = { version = "0.3", features = ["es_modules"], optional = true }
web-sys = { version = "0.3", features = [
"console",
"CompositionEvent",
"CssStyleDeclaration",
"DataTransfer",
"Document",
"DomRect",
"DragEvent",
"Element",
"EventTarget",
"File",
"FileList",
"HtmlCanvasElement",
"HtmlElement",
"HtmlInputElement",
"KeyboardEvent",
"MediaQueryList",
"MediaQueryListEvent",
"MouseEvent",
"Navigator",
"PointerEvent",
"ResizeObserver",
"ResizeObserverBoxOptions",
"ResizeObserverEntry",
"ResizeObserverSize",
"ResizeObserverOptions",
"Screen",
"Storage",
"VisualViewport",
"Headers",
"Request",
"RequestInit",
"RequestRedirect",
"Response",
"WheelEvent",
"Window",
"console",
"CompositionEvent",
"CssStyleDeclaration",
"DataTransfer",
"Document",
"DomRect",
"DragEvent",
"Element",
"EventTarget",
"File",
"FileList",
"HtmlCanvasElement",
"HtmlElement",
"HtmlInputElement",
"KeyboardEvent",
"MediaQueryList",
"MediaQueryListEvent",
"MouseEvent",
"Navigator",
"PointerEvent",
"ResizeObserver",
"ResizeObserverBoxOptions",
"ResizeObserverEntry",
"ResizeObserverSize",
"ResizeObserverOptions",
"Screen",
"Storage",
"VisualViewport",
"Headers",
"Request",
"RequestInit",
"RequestRedirect",
"Response",
"WheelEvent",
"Window",
] }
@@ -1,13 +1,21 @@
[target.wasm32-unknown-unknown]
rustflags = [
"-C", "target-feature=+atomics,+bulk-memory,+mutable-globals",
"-C", "link-arg=--shared-memory",
"-C", "link-arg=--max-memory=1073741824",
"-C", "link-arg=--import-memory",
"-C", "link-arg=--export=__wasm_init_tls",
"-C", "link-arg=--export=__tls_size",
"-C", "link-arg=--export=__tls_align",
"-C", "link-arg=--export=__tls_base",
"-C",
"target-feature=+atomics,+bulk-memory,+mutable-globals",
"-C",
"link-arg=--shared-memory",
"-C",
"link-arg=--max-memory=1073741824",
"-C",
"link-arg=--import-memory",
"-C",
"link-arg=--export=__wasm_init_tls",
"-C",
"link-arg=--export=__tls_size",
"-C",
"link-arg=--export=__tls_align",
"-C",
"link-arg=--export=__tls_base",
]
[unstable]
+9 -1
View File
@@ -135,6 +135,7 @@ struct WgpuPipelines {
mono_sprites: wgpu::RenderPipeline,
subpixel_sprites: Option<wgpu::RenderPipeline>,
poly_sprites: wgpu::RenderPipeline,
#[allow(dead_code)]
surfaces: wgpu::RenderPipeline,
/// Copies a source texture into the (smaller) target with one bilinear tap. Used both to
/// downsample the scene into the half-resolution blur texture and to blit the offscreen
@@ -166,6 +167,7 @@ struct WgpuResources {
bind_group_layouts: WgpuBindGroupLayouts,
atlas_sampler: wgpu::Sampler,
surface_sampler: wgpu::Sampler,
#[allow(dead_code)]
surface_uniform_buffer: wgpu::Buffer,
/// One reused uniform buffer holding [`BlurParams`] for every blur pass in a frame, each at a
/// distinct (alignment-strided) offset. Avoids allocating a buffer per pass; distinct offsets
@@ -1041,7 +1043,7 @@ impl WgpuRenderer {
&layouts.globals,
&layouts.surfaces,
wgpu::PrimitiveTopology::TriangleStrip,
&[Some(color_target.clone())],
&[Some(color_target)],
1,
&shader_module,
);
@@ -1845,6 +1847,7 @@ impl WgpuRenderer {
)
}
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
fn draw_surfaces(&self, surfaces: &[PaintSurface], pass: &mut wgpu::RenderPass<'_>) -> bool {
let resources = self.resources();
for surface in surfaces {
@@ -1894,6 +1897,11 @@ impl WgpuRenderer {
true
}
#[cfg(not(any(target_os = "linux", target_os = "freebsd")))]
fn draw_surfaces(&self, _surfaces: &[PaintSurface], _pass: &mut wgpu::RenderPass<'_>) -> bool {
true
}
/// Build a bind group for a blur pass. Writes `params` into the next slot of the shared
/// `blur_params_buffer` (no per-pass allocation) and references that slot, the source texture,
/// and the filtering sampler. Distinct per-pass offsets keep `write_buffer`'s
@@ -114,16 +114,20 @@ struct DirectXResources {
/// (indexed by isolation depth), up to [`MAX_FILTER_DEPTH`], so nested content blurs isolate
/// correctly; deeper nests render inline.
struct BlurResources {
#[expect(dead_code)]
scene_color: ID3D11Texture2D,
scene_color_rtv: Option<ID3D11RenderTargetView>,
scene_color_srv: Option<ID3D11ShaderResourceView>,
#[expect(dead_code)]
ping: ID3D11Texture2D,
ping_rtv: Option<ID3D11RenderTargetView>,
ping_srv: Option<ID3D11ShaderResourceView>,
#[expect(dead_code)]
pong: ID3D11Texture2D,
pong_rtv: Option<ID3D11RenderTargetView>,
pong_srv: Option<ID3D11ShaderResourceView>,
// Kept alive for the lifetime of their views; indexed by isolation depth.
#[expect(dead_code)]
groups: Vec<ID3D11Texture2D>,
group_rtvs: Vec<Option<ID3D11RenderTargetView>>,
group_srvs: Vec<Option<ID3D11ShaderResourceView>>,