first pass of merging in warp (doesn't build)
This commit is contained in:
+49
-12
@@ -223,8 +223,8 @@ while (( "$#" )); do
|
||||
;;
|
||||
--artifact)
|
||||
if [ -n "$2" ] && [ "${2:0:1}" != "-" ]; then
|
||||
if [[ "$2" != "app" && "$2" != "cli" ]]; then
|
||||
echo "Error: --artifact must be either 'app' or 'cli', got '$2'" >&2
|
||||
if [[ "$2" != "app" && "$2" != "cli" && "$2" != "warpctrl" ]]; then
|
||||
echo "Error: --artifact must be 'app', 'cli', or 'warpctrl', got '$2'" >&2
|
||||
exit 1
|
||||
fi
|
||||
ARTIFACT="$2"
|
||||
@@ -250,13 +250,13 @@ elif [[ $RELEASE_CHANNEL = "local" || $RELEASE_CHANNEL = "dev" ]]; then
|
||||
# For dev bundles, we want to enable debug assertions to
|
||||
# catch violations that would otherwise silently pass in
|
||||
# a normal release build (e.g. in stable).
|
||||
if [[ "$ARTIFACT" == "cli" ]]; then
|
||||
if [[ "$ARTIFACT" == "cli" || "$ARTIFACT" == "warpctrl" ]]; then
|
||||
CARGO_PROFILE="release-cli-debug_assertions"
|
||||
else
|
||||
CARGO_PROFILE="release-lto-debug_assertions"
|
||||
fi
|
||||
else
|
||||
if [[ "$ARTIFACT" == "cli" ]]; then
|
||||
if [[ "$ARTIFACT" == "cli" || "$ARTIFACT" == "warpctrl" ]]; then
|
||||
CARGO_PROFILE="release-cli"
|
||||
else
|
||||
CARGO_PROFILE="release-lto"
|
||||
@@ -286,6 +286,8 @@ elif [[ $RELEASE_CHANNEL = "dev" ]]; then
|
||||
FEATURES="$FEATURES,agent_mode_debug"
|
||||
# Enable heap usage tracking & profiling using jemalloc through pprof.
|
||||
FEATURES="$FEATURES,jemalloc_pprof,heap_usage_tracking"
|
||||
# Enable the Warp Control CLI wrapper for local scripting/automation.
|
||||
FEATURES="$FEATURES,warp_control_cli"
|
||||
# For dev builds, use different versions of our bundled frameworks (e.g.:
|
||||
# Sentry). This needs to be exported so it can be referenced by
|
||||
# app/build.rs later, while running `cargo bundle`.
|
||||
@@ -304,6 +306,8 @@ elif [[ $RELEASE_CHANNEL = "stable" ]]; then
|
||||
BUNDLE_ID="com.samsung.Galaxy"
|
||||
WARP_APP_NAME="Galaxy"
|
||||
WARP_SCHEME_NAME="galaxy"
|
||||
# Enable heap usage tracking & profiling using jemalloc through pprof.
|
||||
FEATURES="$FEATURES,jemalloc_pprof,heap_usage_tracking"
|
||||
elif [[ $RELEASE_CHANNEL = "oss" ]]; then
|
||||
WARP_BIN="galaxy-ai-oss"
|
||||
BUNDLE_ID="com.samsung.Galaxy"
|
||||
@@ -345,12 +349,13 @@ else
|
||||
fi
|
||||
|
||||
# Set artifact-specific configuration.
|
||||
if [[ "$ARTIFACT" == cli ]]; then
|
||||
if [[ "$ARTIFACT" == cli || "$ARTIFACT" == warpctrl ]]; then
|
||||
UNIVERSAL_BINARY=false
|
||||
OPEN_AFTER_BUNDLE=false
|
||||
FEATURES="$FEATURES,standalone"
|
||||
elif [[ "$ARTIFACT" == app ]]; then
|
||||
FEATURES="$FEATURES,gui,nld_improvements"
|
||||
# All channels ship the v3 classifier and v2 heuristic.
|
||||
FEATURES="$FEATURES,gui,nld_classifier_v3,nld_heuristic_v2"
|
||||
fi
|
||||
|
||||
# If we're building a universal bundle for the app artifact, make sure the additional target is available.
|
||||
@@ -363,7 +368,7 @@ fi
|
||||
# using the same feature flags and profile that we would be using in production.
|
||||
if [[ "$CHECK_ONLY" == "true" ]]; then
|
||||
cargo check --profile "$CARGO_PROFILE" --bin "$WARP_BIN" --target "$DEFAULT_TARGET" --features "$FEATURES"
|
||||
if [[ $UNIVERSAL_BINARY = true && "$ARTIFACT" != "cli" ]]; then
|
||||
if [[ $UNIVERSAL_BINARY = true && "$ARTIFACT" != "cli" && "$ARTIFACT" != "warpctrl" ]]; then
|
||||
cargo check --profile "$CARGO_PROFILE" --bin "$WARP_BIN" --target "$ADDITIONAL_TARGET" --features "$FEATURES"
|
||||
fi
|
||||
exit 0
|
||||
@@ -551,10 +556,26 @@ EOF
|
||||
# Make the script executable
|
||||
chmod +x "$CLI_SCRIPT_PATH"
|
||||
|
||||
if [[ ",$FEATURES," =~ ",warp_control_cli," ]]; then
|
||||
# Each value must match `Channel::warpctrl_command_name` in the Rust source.
|
||||
if [[ $RELEASE_CHANNEL = "stable" ]]; then
|
||||
WARPCTRL_COMMAND_NAME="warpctrl"
|
||||
elif [[ $RELEASE_CHANNEL = "oss" ]]; then
|
||||
WARPCTRL_COMMAND_NAME="warpctrl-oss"
|
||||
else
|
||||
WARPCTRL_COMMAND_NAME="warpctrl-$RELEASE_CHANNEL"
|
||||
fi
|
||||
WARPCTRL_SCRIPT_PATH="$BUNDLED_RESOURCES_DIR/bin/$WARPCTRL_COMMAND_NAME"
|
||||
echo "Creating warpctrl wrapper script at $WARPCTRL_SCRIPT_PATH..."
|
||||
"$WORKSPACE_ROOT_DIR/script/macos/create_warpctrl_wrapper" \
|
||||
"$WARPCTRL_SCRIPT_PATH" \
|
||||
"../../MacOS/$WARP_BIN"
|
||||
fi
|
||||
|
||||
# Store the built artifact locations for GitHub Actions outputs.
|
||||
BINARY_PATH="target/$DEFAULT_TARGET/$TARGET_PROFILE_DIR/$WARP_BIN"
|
||||
DMG_PATH="$OUT_DIR/$FINAL_DMG_NAME"
|
||||
elif [[ "$ARTIFACT" == "cli" ]]; then
|
||||
elif [[ "$ARTIFACT" == "cli" || "$ARTIFACT" == "warpctrl" ]]; then
|
||||
if [[ $BUILD_BINARY == true ]]; then
|
||||
# Create Info.plist before building the app, since it's embedded at build time.
|
||||
# Apple's codesigning tools will detect Info.plist files in the same directory as an executable.
|
||||
@@ -581,6 +602,18 @@ elif [[ "$ARTIFACT" == "cli" ]]; then
|
||||
echo "Copying binary into $OUT_DIR/$WARP_BIN"
|
||||
cp "target/$DEFAULT_TARGET/$TARGET_PROFILE_DIR/$WARP_BIN" "$OUT_DIR/$WARP_BIN"
|
||||
|
||||
if [[ "$ARTIFACT" == "warpctrl" ]]; then
|
||||
if [[ ! ",$FEATURES," =~ ",warp_control_cli," ]]; then
|
||||
echo "warpctrl artifact requires the warp_control_cli feature" >&2
|
||||
exit 1
|
||||
fi
|
||||
WARPCTRL_SCRIPT_PATH="$OUT_DIR/warpctrl"
|
||||
echo "Creating warpctrl wrapper script at $WARPCTRL_SCRIPT_PATH"
|
||||
"$WORKSPACE_ROOT_DIR/script/macos/create_warpctrl_wrapper" \
|
||||
"$WARPCTRL_SCRIPT_PATH" \
|
||||
"$WARP_BIN"
|
||||
fi
|
||||
|
||||
if [[ -n "$TARGET_ARCH" && -e "target/$DEFAULT_TARGET/$TARGET_PROFILE_DIR/$WARP_BIN.dSYM" ]]; then
|
||||
echo "Copying .dSYM into $OUT_DIR/$WARP_BIN.dSYM"
|
||||
cp -HR "target/$DEFAULT_TARGET/$TARGET_PROFILE_DIR/$WARP_BIN.dSYM" "$OUT_DIR/"
|
||||
@@ -592,7 +625,11 @@ elif [[ "$ARTIFACT" == "cli" ]]; then
|
||||
|
||||
|
||||
# Set the primary binary path to output.
|
||||
BINARY_PATH="$OUT_DIR/$WARP_BIN"
|
||||
if [[ "$ARTIFACT" == "warpctrl" ]]; then
|
||||
BINARY_PATH="$OUT_DIR/warpctrl"
|
||||
else
|
||||
BINARY_PATH="$OUT_DIR/$WARP_BIN"
|
||||
fi
|
||||
else
|
||||
echo "Unsupported artifact: $ARTIFACT" >&2
|
||||
exit 1
|
||||
@@ -659,7 +696,7 @@ if [[ $SELFSIGN = true ]]; then
|
||||
if [[ "$ARTIFACT" == app ]]; then
|
||||
echo "Self-signing $BUNDLE_DIR/$WARP_APP_NAME.app with ${SIGNING_CERT}..."
|
||||
codesign --force --deep --options runtime --sign "$SIGNING_CERT" "$BUNDLE_DIR/$WARP_APP_NAME.app" --entitlements script/Debug-Entitlements.plist
|
||||
elif [[ "$ARTIFACT" == cli ]]; then
|
||||
elif [[ "$ARTIFACT" == cli || "$ARTIFACT" == warpctrl ]]; then
|
||||
echo "Self-signing $OUT_DIR/$WARP_BIN with ${SIGNING_CERT}..."
|
||||
codesign --force --options runtime --sign "$SIGNING_CERT" "$OUT_DIR/$WARP_BIN" --entitlements script/Debug-Entitlements.plist
|
||||
fi
|
||||
@@ -668,7 +705,7 @@ elif [[ $CODESIGN = true ]]; then
|
||||
echo "Codesigning $BUNDLE_DIR/$WARP_APP_NAME.app..."
|
||||
# Use --deep so we sign bundled frameworks as well
|
||||
codesign --deep -f -o runtime --timestamp -s "$APPLE_TEAM_ID" "$BUNDLE_DIR/$WARP_APP_NAME.app" --entitlements script/Entitlements.plist
|
||||
elif [[ "$ARTIFACT" == cli ]]; then
|
||||
elif [[ "$ARTIFACT" == cli || "$ARTIFACT" == warpctrl ]]; then
|
||||
echo "Codesigning $OUT_DIR/$WARP_BIN..."
|
||||
codesign -f -o runtime --timestamp -s "$APPLE_TEAM_ID" "$OUT_DIR/$WARP_BIN" --entitlements script/Entitlements.plist
|
||||
|
||||
@@ -779,7 +816,7 @@ if [[ $CODESIGN = true ]]; then
|
||||
echo "Verifying notarization ticket..."
|
||||
if [[ "$ARTIFACT" = app ]]; then
|
||||
xcrun stapler validate "$DMG_DIR/$DMG_NAME"
|
||||
elif [[ "$ARTIFACT" = cli ]]; then
|
||||
elif [[ "$ARTIFACT" = cli || "$ARTIFACT" = warpctrl ]]; then
|
||||
spctl -a -t open --context context:primary-signature -vv "$OUT_DIR/$WARP_BIN"
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user