mirror of
https://github.com/warpdotdev/warp.git
synced 2026-07-02 01:04:49 +08:00
## Description The release bundling workflow runs `prepare_bundled_resources` after the main `cargo build`, and that script in turn invokes `cargo run --bin generate_settings_schema`. Until now we passed neither `--features` nor `--target` to this run, so cargo's resolver-v2 saw a different per-package feature unification than the main build and recompiled every dependency whose enabled features differed (`rust-embed` with `debug-embed`, `warp_core`'s `release_bundle`, sentry, jemalloc, etc.). This added significant time to release builds and pulled in extra system dependencies (e.g. protoc) for jobs that should otherwise just be packaging the prebuilt binary. There was a secondary correctness issue: the schema generator iterates settings registered via `inventory::submit!`, and `#[cfg(feature = \"...\")]`-gated settings were silently omitted from the schema in any context whose feature set didn't match the main binary. The fix threads the build's feature set (and target, where applicable) through to the schema-generator invocation, and makes package selection explicit with `-p warp`. With matching features and target, cargo reuses the existing compilation artifacts; with the same feature set, the generated schema is also faithful to what the bundled binary actually exposes. ## Testing Verified `bash -n` syntax for the modified bash scripts and parsed the modified PowerShell files via `pwsh`. Bundling, schema generation, and CI behavior will be exercised by this PR's release builds. ## Agent Mode - [x] Warp Agent Mode - This PR was created via Warp's AI Agent Mode [Conversation](https://staging.warp.dev/conversation/1bd5574f-df28-4c2e-867d-40d71ed7e827)
55 lines
2.4 KiB
Bash
Executable File
55 lines
2.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Installs everything built by the bundle script into the given directory.
|
|
#
|
|
# This is intended to be used when building Linux packages (e.g.: .deb).
|
|
#
|
|
# Required environment variables:
|
|
# - WORKSPACE_ROOT_DIR: The root directory of the Cargo workspace.
|
|
# - CARGO_TARGET_OUTPUT_DIR: The cargo target directory containing build output.
|
|
# - OPT_DIR: The absolute path to our install directory (under /opt) on the target machine.
|
|
# - RELEASE_CHANNEL: The release channel we're bundling (e.g.: "dev").
|
|
# - BUNDLE_ID: The app ID for the bundle (e.g.: "dev.warp.WarpDev").
|
|
# - EXECUTABLE_PATH: The path to the compiled executable we want to install.
|
|
# - BINARY_NAME: The name that the compiled executable should have on the target machine.
|
|
# - ARTIFACT: Which artifact to build: app or cli.
|
|
# - FEATURES: Comma-separated cargo features used to build the main binary.
|
|
# Used to invoke the settings schema generator with the same
|
|
# feature set so cargo can reuse compiled artifacts.
|
|
|
|
set -e
|
|
|
|
# The target directory should be the first (and only) positional argument.
|
|
if [[ $# -gt 1 ]]; then
|
|
echo "Expected 1 argument but received $#!"
|
|
exit 1
|
|
fi
|
|
TARGET_DIR="$1"
|
|
|
|
# Make sure the target directory is empty.
|
|
if [[ ! -z "$(ls -A "$TARGET_DIR")" ]]; then
|
|
echo "Target directory '$TARGET_DIR' not empty!"
|
|
exit 1
|
|
fi
|
|
|
|
# Copy files to the desired output locations within the target dir, stripping
|
|
# debugging symbols from the installed binaries.
|
|
install -D "$EXECUTABLE_PATH" "${TARGET_DIR}${OPT_DIR}/$BINARY_NAME"
|
|
# Only install desktop file and icons if the artifact is "app"
|
|
if [[ "$ARTIFACT" == "app" ]]; then
|
|
install -Dm644 "$WORKSPACE_ROOT_DIR/app/channels/$RELEASE_CHANNEL/$BUNDLE_ID.desktop" "${TARGET_DIR}/usr/share/applications/$BUNDLE_ID.desktop"
|
|
for size in 16x16 32x32 64x64 128x128 256x256 512x512; do
|
|
src_path="$WORKSPACE_ROOT_DIR/app/channels/$RELEASE_CHANNEL/icon/no-padding/$size.png"
|
|
if [[ -f "$src_path" ]]; then
|
|
install -Dm644 "$src_path" "${TARGET_DIR}/usr/share/icons/hicolor/$size/apps/$BUNDLE_ID.png"
|
|
fi
|
|
done
|
|
fi
|
|
|
|
# Prepare the bundled resources directory.
|
|
#
|
|
# Pass FEATURES through so the settings schema generator builds with the same
|
|
# feature set as the main binary; otherwise cargo will recompile any
|
|
# dependencies whose enabled features differ.
|
|
"$WORKSPACE_ROOT_DIR/script/prepare_bundled_resources" "${TARGET_DIR}/${OPT_DIR}/resources" "$RELEASE_CHANNEL" "$CARGO_PROFILE" "$FEATURES"
|