1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-26 14:49:06 -04:00

Move the inspector to a separate repo

This commit is contained in:
lucasmerlin
2026-04-22 12:26:43 +02:00
parent 92b127c688
commit 0cefd89141
8 changed files with 22 additions and 1256 deletions

View File

@@ -1393,6 +1393,7 @@ name = "egui_kittest"
version = "0.34.1"
dependencies = [
"backtrace",
"bincode 2.0.1",
"dify",
"document-features",
"eframe",
@@ -1401,7 +1402,6 @@ dependencies = [
"egui_extras",
"image",
"kittest",
"kittest_inspector",
"open",
"pollster",
"serde",
@@ -1792,16 +1792,6 @@ dependencies = [
"percent-encoding",
]
[[package]]
name = "fs4"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8640e34b88f7652208ce9e88b1a37a2ae95227d84abec377ccd3c5cfeb141ed4"
dependencies = [
"rustix 1.1.4",
"windows-sys 0.59.0",
]
[[package]]
name = "futures-core"
version = "0.3.32"
@@ -2527,21 +2517,6 @@ dependencies = [
"accesskit_consumer",
]
[[package]]
name = "kittest_inspector"
version = "0.34.1"
dependencies = [
"accesskit",
"arboard",
"bincode 2.0.1",
"eframe",
"egui",
"egui_extras",
"fs4",
"image",
"serde",
]
[[package]]
name = "kurbo"
version = "0.11.1"

View File

@@ -7,7 +7,6 @@ members = [
"crates/egui_extras",
"crates/egui_glow",
"crates/egui_kittest",
"crates/kittest_inspector",
"crates/egui-wgpu",
"crates/egui-winit",
"crates/egui",
@@ -68,7 +67,6 @@ egui_demo_lib = { version = "0.34.1", path = "crates/egui_demo_lib", default-fea
egui_glow = { version = "0.34.1", path = "crates/egui_glow", default-features = false }
egui_kittest = { version = "0.34.1", path = "crates/egui_kittest", default-features = false }
eframe = { version = "0.34.1", path = "crates/eframe", default-features = false }
kittest_inspector = { version = "0.34.1", path = "crates/kittest_inspector", default-features = false }
accesskit = "0.24.0"
accesskit_consumer = "0.35.0"

View File

@@ -29,8 +29,13 @@ snapshot = ["dep:dify", "dep:image", "dep:open", "dep:tempfile", "image/png"]
## Record a test session as an animated GIF or PNG sequence.
recording = ["dep:image", "image/gif", "image/png"]
## Expose the [`inspector_api`] wire protocol used to talk to the external
## `kittest_inspector` binary. Pull this in if you're building a tool that consumes
## the same stream — the binary itself enables this transitively.
inspector_api = ["dep:bincode", "egui/serde"]
## Stream frames + accesskit tree to a `kittest_inspector` window for live debugging.
inspector = ["dep:image", "dep:kittest_inspector", "dep:backtrace"]
inspector = ["inspector_api", "dep:image", "dep:backtrace"]
## Allows testing eframe::App
eframe = ["dep:eframe", "eframe/accesskit"]
@@ -57,7 +62,7 @@ wgpu = { workspace = true, features = ["metal", "dx12", "vulkan", "gles"], optio
dify = { workspace = true, optional = true }
# inspector dependencies
kittest_inspector = { workspace = true, default-features = false, optional = true }
bincode = { workspace = true, optional = true }
backtrace = { workspace = true, optional = true }
# Enable this when generating docs.

View File

@@ -12,10 +12,10 @@ use std::sync::LazyLock;
use egui::accesskit;
use egui::mutex::Mutex;
use kittest_inspector::{
use crate::inspector_api::{
Frame, HarnessMessage, InspectorReply, SourceView, read_message, write_message,
};
use crate::node::EventSite;
/// Environment variable: when set to a truthy value, every harness auto-launches an inspector.
@@ -238,7 +238,6 @@ fn is_user_code(path: &str) -> bool {
"/.cargo/registry/",
"/.cargo/git/",
"egui_kittest/src/",
"kittest_inspector/src/",
];
!EXCLUDE.iter().any(|needle| path.contains(needle))
}

View File

@@ -1,16 +1,23 @@
//! Wire protocol for `kittest_inspector`.
//! Wire protocol shared between [`crate::Harness`] and the external `kittest_inspector`
//! binary (lives at <https://github.com/rerun-io/kittest_inspector>).
//!
//! The harness launches `kittest_inspector` as a child process with piped stdin/stdout.
//! For each step, the harness writes a [`HarnessMessage`] to the child's stdin and reads an
//! The harness spawns the inspector as a child process with piped stdin/stdout. For each
//! step, the harness writes a [`HarnessMessage`] to the child's stdin and reads an
//! [`InspectorReply`] from its stdout. The inspector decides whether to reply immediately
//! (playing) or to wait for the user to click Play/Next (paused).
//!
//! Messages are framed as a 4-byte big-endian length followed by a bincode-encoded body.
//! Anything the inspector wants to log goes to stderr (which the harness inherits), keeping
//! stdout reserved for protocol traffic.
//!
//! Living inside `egui_kittest` (rather than the inspector crate) lets the inspector be
//! released independently — it just consumes whichever protocol version ships with the
//! egui release it was built against.
use std::io::{self, Read, Write};
use egui::accesskit;
/// One source file plus the test-source lines the inspector should highlight inside it.
///
/// The harness walks each captured backtrace (for the `.run()` call that produced the frame

View File

@@ -15,6 +15,8 @@ mod app_kind;
mod config;
#[cfg(feature = "inspector")]
mod inspector;
#[cfg(feature = "inspector_api")]
pub mod inspector_api;
mod node;
#[cfg(feature = "recording")]
mod recording;

View File

@@ -1,46 +0,0 @@
[package]
name = "kittest_inspector"
version.workspace = true
authors = ["Lucas Meurer <hi@lucasmerlin.me>"]
description = "Live inspector eframe app for egui_kittest tests (frame + accesskit tree + step controls)"
edition.workspace = true
rust-version.workspace = true
license.workspace = true
repository = "https://github.com/emilk/egui"
categories = ["gui", "development-tools::testing"]
keywords = ["egui", "kittest", "testing", "inspector"]
readme = "./README.md"
include = ["../../LICENSE-APACHE", "../../LICENSE-MIT", "**/*.rs", "Cargo.toml"]
[lib]
name = "kittest_inspector"
path = "src/lib.rs"
[[bin]]
name = "kittest_inspector"
path = "src/main.rs"
required-features = ["app"]
[features]
default = ["app"]
## Build the eframe inspector binary.
app = ["dep:eframe", "dep:egui_extras", "dep:fs4", "dep:image", "dep:arboard"]
[dependencies]
accesskit = { workspace = true, features = ["serde"] }
bincode = { workspace = true }
egui = { workspace = true, features = ["serde"] }
serde = { workspace = true }
# `app` feature dependencies:
eframe = { workspace = true, features = ["default_fonts", "wgpu"], optional = true }
egui_extras = { workspace = true, features = ["image"], optional = true }
fs4 = { workspace = true, optional = true }
image = { workspace = true, optional = true, features = ["gif"] }
# Cross-platform clipboard — same crate eframe uses — with `set_file_list` so apps that
# accept pasted files (Slack, Discord, Finder, etc.) attach the GIF with animation intact.
arboard = { workspace = true, optional = true }
[lints]
workspace = true

File diff suppressed because it is too large Load Diff