Skip to content

Commit f696f5b

Browse files
Revert "Fix schema generator binary recompilation during release bundling." (#9676)
Reverts #9632 Will look at in the future. Currently causing dev build issues like https://github.com/warpdotdev/warp-internal/actions/runs/25187609052/job/73853657131
1 parent e6098a8 commit f696f5b

7 files changed

Lines changed: 20 additions & 138 deletions

File tree

script/linux/bundle

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ fi
240240
if [[ "$ARTIFACT" == "cli" ]]; then
241241
echo "Preparing CLI resources directory"
242242
BUNDLED_RESOURCES_DIR="$OUT_DIR/resources"
243-
"$WORKSPACE_ROOT_DIR/script/prepare_bundled_resources" "$BUNDLED_RESOURCES_DIR" "$RELEASE_CHANNEL" "$CARGO_PROFILE" "$FEATURES"
243+
"$WORKSPACE_ROOT_DIR/script/prepare_bundled_resources" "$BUNDLED_RESOURCES_DIR" "$RELEASE_CHANNEL" "$CARGO_PROFILE"
244244
fi
245245

246246

@@ -269,8 +269,7 @@ export \
269269
APPIMAGE_NAME \
270270
BUILD_ARCH \
271271
ARTIFACT \
272-
CARGO_PROFILE \
273-
FEATURES
272+
CARGO_PROFILE
274273

275274
# Build the AppImage bundle.
276275
if [[ ${PACKAGES[@]} =~ "appimage" ]]; then

script/linux/bundle_install

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
# - EXECUTABLE_PATH: The path to the compiled executable we want to install.
1414
# - BINARY_NAME: The name that the compiled executable should have on the target machine.
1515
# - ARTIFACT: Which artifact to build: app or cli.
16-
# - FEATURES: Comma-separated cargo features used to build the main binary.
17-
# Used to invoke the settings schema generator with the same
18-
# feature set so cargo can reuse compiled artifacts.
1916

2017
set -e
2118

@@ -47,8 +44,4 @@ if [[ "$ARTIFACT" == "app" ]]; then
4744
fi
4845

4946
# Prepare the bundled resources directory.
50-
#
51-
# Pass FEATURES through so the settings schema generator builds with the same
52-
# feature set as the main binary; otherwise cargo will recompile any
53-
# dependencies whose enabled features differ.
54-
"$WORKSPACE_ROOT_DIR/script/prepare_bundled_resources" "${TARGET_DIR}/${OPT_DIR}/resources" "$RELEASE_CHANNEL" "$CARGO_PROFILE" "$FEATURES"
47+
"$WORKSPACE_ROOT_DIR/script/prepare_bundled_resources" "${TARGET_DIR}/${OPT_DIR}/resources" "$RELEASE_CHANNEL" "$CARGO_PROFILE"

script/macos/bundle

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,6 @@ ARM_ARCH="aarch64"
6161
ARM_TARGET="$ARM_ARCH-apple-darwin"
6262
DEFAULT_ARCH="$(rustc --print cfg | grep target_arch)"
6363

64-
# The Rust target triple corresponding to the build host. Used below to
65-
# decide whether to forward --target to `cargo run` for the settings schema
66-
# generator: that step needs to execute its compiled binary, so we can only
67-
# pass a target that's runnable on the host.
68-
if [[ "$DEFAULT_ARCH" == *"$INTEL_ARCH"* ]]; then
69-
HOST_TARGET="$INTEL_TARGET"
70-
elif [[ "$DEFAULT_ARCH" == *"$ARM_ARCH"* ]]; then
71-
HOST_TARGET="$ARM_TARGET"
72-
fi
73-
7464
# Function to clean up temporary DMG files
7565
cleanup_dmg_files() {
7666
local target_dir="$1"
@@ -526,15 +516,7 @@ if [[ "$ARTIFACT" == "app" ]]; then
526516

527517
BUNDLED_RESOURCES_DIR="$BUNDLE_DIR/$WARP_APP_NAME.app/Contents/Resources"
528518
echo "Preparing bundled resources..."
529-
# Only forward --target to the schema generator when the build target is
530-
# runnable on the host; otherwise `cargo run` would try to execute a
531-
# cross-compiled binary and fail.
532-
if [[ "$DEFAULT_TARGET" == "$HOST_TARGET" ]]; then
533-
SCHEMA_CARGO_TARGET="$DEFAULT_TARGET"
534-
else
535-
SCHEMA_CARGO_TARGET=""
536-
fi
537-
"$WORKSPACE_ROOT_DIR/script/prepare_bundled_resources" "$BUNDLED_RESOURCES_DIR" "$RELEASE_CHANNEL" "$CARGO_PROFILE" "$FEATURES" "$SCHEMA_CARGO_TARGET"
519+
"$WORKSPACE_ROOT_DIR/script/prepare_bundled_resources" "$BUNDLED_RESOURCES_DIR" "$RELEASE_CHANNEL" "$CARGO_PROFILE"
538520

539521
"$WORKSPACE_ROOT_DIR/script/compile_icon" "$RELEASE_CHANNEL" "$BUNDLE_DIR/$WARP_APP_NAME.app"
540522

@@ -606,15 +588,7 @@ elif [[ "$ARTIFACT" == "cli" ]]; then
606588

607589
echo "Preparing CLI resources directory"
608590
BUNDLED_RESOURCES_DIR="$OUT_DIR/resources"
609-
# Only forward --target to the schema generator when the build target is
610-
# runnable on the host; otherwise `cargo run` would try to execute a
611-
# cross-compiled binary and fail.
612-
if [[ "$DEFAULT_TARGET" == "$HOST_TARGET" ]]; then
613-
SCHEMA_CARGO_TARGET="$DEFAULT_TARGET"
614-
else
615-
SCHEMA_CARGO_TARGET=""
616-
fi
617-
"$WORKSPACE_ROOT_DIR/script/prepare_bundled_resources" "$BUNDLED_RESOURCES_DIR" "$RELEASE_CHANNEL" "$CARGO_PROFILE" "$FEATURES" "$SCHEMA_CARGO_TARGET"
591+
"$WORKSPACE_ROOT_DIR/script/prepare_bundled_resources" "$BUNDLED_RESOURCES_DIR" "$RELEASE_CHANNEL" "$CARGO_PROFILE"
618592

619593

620594
# Set the primary binary path to output.

script/macos/run

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,7 @@ echo "Preparing bundled resources..."
116116
if [ "${GENERATE_SCHEMA:-false}" != "true" ]; then
117117
export SKIP_SETTINGS_SCHEMA=1
118118
fi
119-
# Pass FEATURES through (and an empty cargo profile, since this script does
120-
# not configure one) so that the schema generation reuses the same compiled
121-
# artifacts as the cargo bundle invocation above.
122-
NO_LICENSES=1 "${REPO_ROOT}/script/prepare_bundled_resources" "$WARP_APP_PATH/Contents/Resources" "$WARP_CHANNEL" "" "$FEATURES"
119+
NO_LICENSES=1 "${REPO_ROOT}/script/prepare_bundled_resources" "$WARP_APP_PATH/Contents/Resources" "$WARP_CHANNEL"
123120

124121
"${REPO_ROOT}/script/compile_icon" "$WARP_CHANNEL" "$WARP_APP_PATH"
125122

script/prepare_bundled_resources

Lines changed: 6 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# destination directory. It is used by macOS and Linux build scripts.
77
#
88
# Usage:
9-
# prepare_bundled_resources <destination_directory> [channel] [cargo_profile] [cargo_features] [cargo_target]
9+
# prepare_bundled_resources <destination_directory> [channel] [cargo_profile]
1010
#
1111
# Arguments:
1212
# destination_directory: The directory where resources should be installed.
@@ -17,25 +17,6 @@
1717
# cargo_profile: (Optional) Cargo build profile to use when
1818
# generating the settings schema. Reusing the same
1919
# profile as the main build avoids recompiling deps.
20-
# cargo_features: (Optional) Comma-separated cargo features to
21-
# enable when generating the settings schema.
22-
# Should match the features used to build the main
23-
# binary so that cargo can reuse the existing
24-
# compilation artifacts (otherwise dependencies
25-
# gated behind those features will be recompiled).
26-
# Also ensures that feature-gated settings are
27-
# included in the generated schema.
28-
# cargo_target: (Optional) Rust target triple to pass via
29-
# --target. Should match the target used to build
30-
# the main binary, for the same reason as
31-
# cargo_features.
32-
# NOTE: only set this when the target can be
33-
# executed on the build host (e.g. when not
34-
# cross-compiling, or when running through a
35-
# supported emulator like Rosetta). `cargo run`
36-
# will attempt to execute the resulting binary,
37-
# and a binary built for an unrunnable target
38-
# will fail at this step.
3920
#
4021
# Environment variables:
4122
# SKIP_SETTINGS_SCHEMA: Set to "1" to skip generating the JSON settings
@@ -44,17 +25,15 @@
4425

4526
set -e
4627

47-
if [ $# -lt 1 ] || [ $# -gt 5 ]; then
48-
echo "Error: Expected 1-5 arguments but received $#" >&2
49-
echo "Usage: $0 <destination_directory> [channel] [cargo_profile] [cargo_features] [cargo_target]" >&2
28+
if [ $# -lt 1 ] || [ $# -gt 3 ]; then
29+
echo "Error: Expected 1-3 arguments but received $#" >&2
30+
echo "Usage: $0 <destination_directory> [channel] [cargo_profile]" >&2
5031
exit 1
5132
fi
5233

5334
DEST_DIR="$1"
5435
CHANNEL="${2:-}"
5536
CARGO_PROFILE="${3:-}"
56-
CARGO_FEATURES="${4:-}"
57-
CARGO_TARGET="${5:-}"
5837
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5938
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
6039
RESOURCES_SRC="$REPO_ROOT/resources"
@@ -147,21 +126,11 @@ if [ "${SKIP_SETTINGS_SCHEMA:-}" != "1" ]; then
147126
SCHEMA_OUTPUT="$DEST_DIR/settings_schema.json"
148127
echo "Generating settings schema at $SCHEMA_OUTPUT"
149128

150-
# Pass the same package, profile, features, and target as the main build
151-
# so that cargo can reuse compilation artifacts (rather than recompiling
152-
# any dependencies whose enabled features differ). Also ensures that
153-
# feature-gated settings are included in the generated schema.
154-
SCHEMA_CMD=(cargo run --manifest-path "$REPO_ROOT/Cargo.toml" -p warp)
129+
SCHEMA_CMD=(cargo run)
155130
if [ -n "$CARGO_PROFILE" ]; then
156131
SCHEMA_CMD+=(--profile "$CARGO_PROFILE")
157132
fi
158-
if [ -n "$CARGO_FEATURES" ]; then
159-
SCHEMA_CMD+=(--features "$CARGO_FEATURES")
160-
fi
161-
if [ -n "$CARGO_TARGET" ]; then
162-
SCHEMA_CMD+=(--target "$CARGO_TARGET")
163-
fi
164-
SCHEMA_CMD+=(--bin generate_settings_schema --)
133+
SCHEMA_CMD+=(--manifest-path "$REPO_ROOT/Cargo.toml" --bin generate_settings_schema --)
165134
if [ -n "$CHANNEL" ]; then
166135
SCHEMA_CMD+=(--channel "$CHANNEL")
167136
fi

script/windows/bundle.ps1

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -180,23 +180,7 @@ Write-Output "Built for $ARCH with executable at $BINARY_PATH"
180180
# Prepare bundled resources
181181
$BUNDLED_RESOURCES_DIR = "$CARGO_TARGET_OUTPUT_DIR\resources"
182182
Write-Output "Preparing bundled resources..."
183-
# Only forward --target to the schema generator when the build target is
184-
# runnable on the host; otherwise `cargo run` would try to execute a
185-
# cross-compiled binary (e.g. aarch64-pc-windows-msvc on an x64 runner)
186-
# and fail.
187-
if ($env:PROCESSOR_ARCHITECTURE -eq 'AMD64') {
188-
$HOST_TARGET = 'x86_64-pc-windows-msvc'
189-
} elseif ($env:PROCESSOR_ARCHITECTURE -eq 'ARM64') {
190-
$HOST_TARGET = 'aarch64-pc-windows-msvc'
191-
} else {
192-
$HOST_TARGET = ''
193-
}
194-
if ($PLATFORM_TARGET -eq $HOST_TARGET) {
195-
$SCHEMA_CARGO_TARGET = $PLATFORM_TARGET
196-
} else {
197-
$SCHEMA_CARGO_TARGET = ''
198-
}
199-
& "$WINDOWS_INSTALLER_DIR\prepare_bundled_resources.ps1" -DestinationDir "$BUNDLED_RESOURCES_DIR" -Channel "$CHANNEL" -CargoProfile "$CARGO_PROFILE" -CargoFeatures "$FEATURES" -CargoTarget "$SCHEMA_CARGO_TARGET"
183+
& "$WINDOWS_INSTALLER_DIR\prepare_bundled_resources.ps1" -DestinationDir "$BUNDLED_RESOURCES_DIR" -Channel "$CHANNEL" -CargoProfile "$CARGO_PROFILE"
200184
if (-Not $?) {
201185
Write-Error "Failed to prepare bundled resources"
202186
exit 1

script/windows/prepare_bundled_resources.ps1

Lines changed: 7 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,12 @@
55
# destination directory. It is used by the Windows build script.
66
#
77
# Usage:
8-
# prepare_bundled_resources.ps1 -DestinationDir <destination_directory> [-Channel <channel>] [-CargoProfile <profile>] [-CargoFeatures <features>] [-CargoTarget <target>]
8+
# prepare_bundled_resources.ps1 <destination_directory>
99
#
1010
# Arguments:
11-
# DestinationDir: The directory where resources should be installed.
12-
# Resources will be copied to subdirectories within this
13-
# path (e.g., $DEST_DIR\skills).
14-
# Channel: (Optional) Release channel. Used to include
15-
# channel-gated skills.
16-
# CargoProfile: (Optional) Cargo build profile to use when generating
17-
# the settings schema.
18-
# CargoFeatures: (Optional) Comma-separated cargo features to enable when
19-
# generating the settings schema. Should match the
20-
# features used to build the main binary so that cargo
21-
# can reuse the existing compilation artifacts. Also
22-
# ensures that feature-gated settings are included in the
23-
# generated schema.
24-
# CargoTarget: (Optional) Rust target triple to pass via --target.
25-
# Should match the target used to build the main binary.
26-
# NOTE: only set this when the target can be executed on
27-
# the build host. `cargo run` will attempt to execute
28-
# the resulting binary, so this must be omitted when
29-
# cross-compiling to a target the host can't run
30-
# (e.g. aarch64-pc-windows-msvc on an x64 runner).
11+
# destination_directory: The directory where resources should be installed.
12+
# Resources will be copied to subdirectories within
13+
# this path (e.g., $DEST_DIR\skills).
3114

3215
Param(
3316
[Parameter(Mandatory = $true)]
@@ -37,13 +20,7 @@ Param(
3720
[String]$Channel = '',
3821

3922
[Parameter(Mandatory = $false)]
40-
[String]$CargoProfile = '',
41-
42-
[Parameter(Mandatory = $false)]
43-
[String]$CargoFeatures = '',
44-
45-
[Parameter(Mandatory = $false)]
46-
[String]$CargoTarget = ''
23+
[String]$CargoProfile = ''
4724
)
4825

4926
$ErrorActionPreference = 'Stop'
@@ -187,22 +164,11 @@ if ($env:SKIP_SETTINGS_SCHEMA -ne '1') {
187164
$SchemaOutput = Join-Path $DestinationDir 'settings_schema.json'
188165
Write-Output "Generating settings schema at $SchemaOutput"
189166

190-
# Pass the same package, profile, features, and target as the main
191-
# build so that cargo can reuse compilation artifacts (rather than
192-
# recompiling any dependencies whose enabled features differ). Also
193-
# ensures that feature-gated settings are included in the generated
194-
# schema.
195-
$SchemaCmd = @('run', '--manifest-path', (Join-Path $RepoRoot 'Cargo.toml'), '-p', 'warp')
167+
$SchemaCmd = @('run')
196168
if ($CargoProfile) {
197169
$SchemaCmd += @('--profile', $CargoProfile)
198170
}
199-
if ($CargoFeatures) {
200-
$SchemaCmd += @('--features', $CargoFeatures)
201-
}
202-
if ($CargoTarget) {
203-
$SchemaCmd += @('--target', $CargoTarget)
204-
}
205-
$SchemaCmd += @('--bin', 'generate_settings_schema', '--')
171+
$SchemaCmd += @('--manifest-path', (Join-Path $RepoRoot 'Cargo.toml'), '--bin', 'generate_settings_schema', '--')
206172
if ($Channel) {
207173
$SchemaCmd += @('--channel', $Channel)
208174
}

0 commit comments

Comments
 (0)