Skip to content

Commit c672f46

Browse files
alokedesaioz-agent
andcommitted
Shrink oz CLI tarball via async/** exclude + release-cli profile
Reduces the macOS CLI tarball from ~120 MiB → 43 MiB gzipped (−64%) and the Linux CLI tarball from ~66 MiB → 49 MiB gzipped (−26%) by adapting two techniques the WASM build already uses: 1. Exclude `async/**` from the embedded `Assets` set for standalone CLI builds, mirroring the existing WASM carve-out. Drops ~57 MiB of PNGs/JPGs that the headless CLI never renders. 2. Add a `release-cli` cargo profile (`opt-level = "s"`, `lto = "fat"`, `codegen-units = 1`) plus a `_debug_assertions` mirror for dev/local channels. Wire `--artifact cli` to use it from script/{macos,linux}/bundle. 3. Strip the macOS CLI binary post-build (`strip -S` for dev, `strip -x` for prod), mirroring Linux's existing strip step. dSYM is unaffected because of `split-debuginfo = "packed"` and CI continues uploading it to Sentry separately. `panic = "abort"` was intentionally excluded from the profile because app/src/persistence/sqlite.rs:273 relies on `catch_unwind` to prevent panics from unwinding across the SQLite FFI boundary. Co-Authored-By: Oz <oz-agent@warp.dev>
1 parent bc3fffa commit c672f46

4 files changed

Lines changed: 43 additions & 5 deletions

File tree

Cargo.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,22 @@ debug-assertions = true
453453
[profile.rltoda]
454454
inherits = "release-lto-debug_assertions"
455455

456+
# A profile tuned for the `oz` CLI tarball. The CLI is shipped over the network
457+
# and run headlessly, so we trade some compile time and a small amount of
458+
# runtime perf for a smaller binary by mirroring the size-leaning settings used
459+
# by `release-wasm`.
460+
[profile.release-cli]
461+
inherits = "release-lto"
462+
opt-level = "s"
463+
lto = "fat"
464+
codegen-units = 1
465+
466+
# A custom CLI release-like profile that forces debug assertions on, used for
467+
# dev/local channel CLI bundles.
468+
[profile.release-cli-debug_assertions]
469+
inherits = "release-cli"
470+
debug-assertions = true
471+
456472
[profile.release-wasm]
457473
inherits = "release"
458474
opt-level = "s"

app/src/lib.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,13 @@ use warpui::{AppContext, SingletonEntity, WindowId};
311311
#[folder = "assets"]
312312
#[include = "bundled/**"] // Should be kept in sync with BUNDLED_ASSETS_DIR.
313313
#[include = "async/**"] // Should be kept in sync with ASYNC_ASSETS_DIR.
314-
#[cfg_attr(target_family = "wasm", exclude = "async/**")] // Excludes take precedence.
314+
#[cfg_attr(target_family = "wasm", exclude = "async/**")]
315+
// Excludes take precedence.
316+
// Standalone CLI builds (the `oz` tarball) are headless and never render the
317+
// onboarding/theme imagery in `async/`, so we exclude those bytes from the
318+
// embedded asset set to keep the CLI binary small — mirroring the carve-out
319+
// already applied for the WASM target above.
320+
#[cfg_attr(feature = "standalone", exclude = "async/**")]
315321
pub struct Assets;
316322

317323
pub static ASSETS: Assets = Assets;

script/linux/bundle

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,17 @@ elif [[ $RELEASE_CHANNEL = "local" || $RELEASE_CHANNEL = "dev" ]]; then
118118
# For dev bundles, we want to enable debug assertions to
119119
# catch violations that would otherwise silently pass in
120120
# a normal release build (e.g. in stable).
121-
CARGO_PROFILE="release-lto-debug_assertions"
121+
if [[ "$ARTIFACT" == "cli" ]]; then
122+
CARGO_PROFILE="release-cli-debug_assertions"
123+
else
124+
CARGO_PROFILE="release-lto-debug_assertions"
125+
fi
122126
else
123-
CARGO_PROFILE="release-lto"
127+
if [[ "$ARTIFACT" == "cli" ]]; then
128+
CARGO_PROFILE="release-cli"
129+
else
130+
CARGO_PROFILE="release-lto"
131+
fi
124132
fi
125133

126134
if [[ "$CARGO_PROFILE" == "dev" ]]; then

script/macos/bundle

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,17 @@ elif [[ $RELEASE_CHANNEL = "local" || $RELEASE_CHANNEL = "dev" ]]; then
250250
# For dev bundles, we want to enable debug assertions to
251251
# catch violations that would otherwise silently pass in
252252
# a normal release build (e.g. in stable).
253-
CARGO_PROFILE="release-lto-debug_assertions"
253+
if [[ "$ARTIFACT" == "cli" ]]; then
254+
CARGO_PROFILE="release-cli-debug_assertions"
255+
else
256+
CARGO_PROFILE="release-lto-debug_assertions"
257+
fi
254258
else
255-
CARGO_PROFILE="release-lto"
259+
if [[ "$ARTIFACT" == "cli" ]]; then
260+
CARGO_PROFILE="release-cli"
261+
else
262+
CARGO_PROFILE="release-lto"
263+
fi
256264
fi
257265

258266
TARGET_PROFILE_DIR="$CARGO_PROFILE"

0 commit comments

Comments
 (0)