Repository navigation
perf(desktop): run the CLI from the macOS app binary instead of shipping a second engine copy - #2762
Open
richiemcilroy wants to merge 1 commit into
Open
richiemcilroy wants to merge 1 commit into
richiemcilroy wants to merge 1 commit into
Conversation
…ing a second engine copy
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The macOS bundle shipped the recording, rendering and export engine twice: in
Cap(56 MB) and incap-cli(36 MB), a separately linked build of the same crates.Capis now also the CLI on macOS:Cap --cap-cli <args>hands the arguments to thecapcrate as the very first thingmain()does, before logging, single-instance, menus or any window.Contents/MacOS/cap-clibecomes a small std-only launcher (crates/cli-launcher). It resolves its own path (through a shim symlink), thenexecs the siblingCapwith--cap-cli, keeping the caller'sargv[0]so help and usage still readcap.~/.cap/bin/cap -> …/Contents/MacOS/cap-cli),cap desktop install-cli, Settings → CLI and the Feedback self-test keep the same path.Supporting changes:
apps/cli:main.rsmoves verbatim tolib.rs.run_main(args)is the oldmainwithCli::parse_from,run_embeddedmarks the process as embedded, and the bin'smain.rscallsrun_main(std::env::args_os()).record start --detach: it re-spawns the CLI, so that now goes throughcli_command, which adds--cap-cliwhen embedded. Otherwise the detached worker would have launched the GUI.scripts/build-desktop-binaries.shbuilds the launcher ascap-clion*-apple-darwinand no longer compiles the separate CLI binary there, which also shortens the macOS release build.Cap.exehas no console to print to, so it keeps the standalone CLI.--cap-clilauncher.Proof
build-gpui, both macOS runners), new step "Test the macOS CLI launcher":cap-gpuiand the launcher, laid out asCap.app/Contents/MacOS/{Cap,cap-cli}with the FFmpeg framework;cap-cli --versionandproject --help, thendesktop install-cliinto a throwaway HOME;cap-cli,cap --versionworks through it, anddesktop statusreports installed;desktop-release.yml): after verifying signatures, the signed bundle'scap-cli --versionmust printcap ….--bin capto--lib.Size (macOS, measured)
Release builds on a Blacksmith macOS runner (
aarch64-apple-darwin, stripped exactly as the release does). Measured with a scratch workflow that builtorigin/mainand this branch side by side;cap-cli --versionran through the launcher on both.Capcap-clicap-muxerCap+cap-cliCapgrows 13.1 MB with the CLI-only code (clap, the MCP server, keyring, the self-test window, the API client), which is still 24 MB less than shipping the engine twice.