Skip to content

Commit 5b46574

Browse files
committed
build(verify): move the recording stimulus helper into its own crate
The stimulus binary's window, audio and Foundation dependencies (winit, softbuffer, cpal, objc2-foundation) lived in cap-verify, which the GPUI app uses for its caption and upload verification tests, so its lock file and macOS test build would have grown by the whole winit stack. The helper is now the cap-verify-stimulus crate; the recording test finds it next to its own target profile directory (or CAP_VERIFY_STIMULUS_BIN), and the workflow builds it first.
1 parent 2f97e49 commit 5b46574

6 files changed

Lines changed: 58 additions & 14 deletions

File tree

‎.github/workflows/verify-recording.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ jobs:
170170
- name: Build
171171
run: |
172172
start=$(date +%s)
173+
cargo build --locked -p cap-verify-stimulus
173174
cargo test --locked -p cap-verify --test recording --no-run
174175
echo "build seconds: $(( $(date +%s) - start ))"
175176

‎Cargo.lock‎

Lines changed: 15 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎crates/verify-stimulus/Cargo.toml‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[package]
2+
name = "cap-verify-stimulus"
3+
version = "0.1.0"
4+
edition = "2024"
5+
publish = false
6+
description = "Helper process of the real-capture recording oracle (crates/verify/tests/recording.rs): shows screen markers and plays system-audio markers"
7+
8+
[lints]
9+
workspace = true
10+
11+
[[bin]]
12+
name = "cap-verify-stimulus"
13+
path = "src/main.rs"
14+
15+
[dependencies]
16+
cap-verify = { path = "../verify" }
17+
anyhow = { workspace = true }
18+
serde_json = "1"
19+
workspace-hack = { version = "0.1", path = "../workspace-hack" }
20+
21+
[target.'cfg(target_os = "macos")'.dependencies]
22+
cidre = { workspace = true }
23+
cpal = { workspace = true }
24+
objc2-foundation = "0.3.1"
25+
softbuffer = "0.4"
26+
winit = "0.30"

‎crates/verify/Cargo.toml‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ workspace-hack = { version = "0.1", path = "../workspace-hack" }
2828
[target.'cfg(target_os = "macos")'.dependencies]
2929
cap-enc-avfoundation = { path = "../enc-avfoundation" }
3030
cidre = { workspace = true }
31-
cpal = { workspace = true }
32-
objc2-foundation = "0.3.1"
33-
softbuffer = "0.4"
34-
winit = "0.30"
3531

3632
[dev-dependencies]
3733
cap-recording = { path = "../recording", features = ["test-utils"] }
@@ -44,8 +40,3 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"] }
4440

4541
[target.'cfg(target_os = "macos")'.dev-dependencies]
4642
scap-targets = { path = "../scap-targets" }
47-
48-
[[bin]]
49-
name = "cap-verify-stimulus"
50-
path = "src/bin/stimulus.rs"
51-
test = false

‎crates/verify/tests/recording.rs‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,22 @@ fn studio_builder(
700700
fn stimulus_binary() -> PathBuf {
701701
std::env::var_os("CAP_VERIFY_STIMULUS_BIN")
702702
.map(PathBuf::from)
703-
.unwrap_or_else(|| PathBuf::from(env!("CARGO_BIN_EXE_cap-verify-stimulus")))
703+
.unwrap_or_else(|| {
704+
// Built by `cargo build -p cap-verify-stimulus` into the same
705+
// target directory as this test (target/<profile>/deps/..).
706+
let exe = std::env::current_exe().expect("test executable path");
707+
let path = exe
708+
.parent()
709+
.and_then(|deps| deps.parent())
710+
.expect("target profile directory")
711+
.join("cap-verify-stimulus");
712+
assert!(
713+
path.exists(),
714+
"{} not found: build it first with `cargo build -p cap-verify-stimulus` (same profile), or set CAP_VERIFY_STIMULUS_BIN",
715+
path.display()
716+
);
717+
path
718+
})
704719
}
705720

706721
fn find_window(title: &str) -> Option<scap_targets::WindowId> {

0 commit comments

Comments
 (0)