mirror of
https://github.com/openclaw/openclaw.git
synced 2026-10-03 09:39:25 +00:00
* fix(scripts): use system Bash for macOS tooling and owned Mach-O fixtures Pin native entrypoints and package commands to /bin/bash, guard portable heredoc callers on Darwin, and preserve Bash 3.2 boolean parsing. Streamed installers explain how to use system Bash when their input cannot be replayed. Generate deterministic x86_64, arm64, and arm64e framework fixtures instead of borrowing /bin/ls. Preserve the existing framework pipeline repair from #141056 and verify merged slice bytes. * fix(scripts): keep guarded portable scripts bash 3.2 compatible * fix(scripts): keep macOS Bash CI coverage green Distinguish sourced installer returns from stdin exits without ShellCheck unreachable-code warnings. Retain the shebang regression suite in changed-target routing, and repartition hosted tooling tails toward 50-second groups within the existing 150-second budget and 80-job cap. Validation: 635 interpreter and routing tests plus 53 planner tests passed; ShellCheck, targeted lint, formatting, and fresh Codex review passed. The broader local changed-file check hit an unrelated existing dependency graph crossing through extensions/reef/node_modules/@noble/hashes; exact-head hosted CI remains required. * docs(install): use system Bash in install and recovery commands Align macOS-facing copy-and-paste commands and emitted installer guidance with the supported streamed interpreter. This addresses the remaining installer-command review finding without changing the PR body. Validation: streamed help for both installers, install.sh dry-run, 16 selected fresh-install and upgrade lifecycle tests, formatting, diff check, and fresh Codex review passed. Landing remains blocked by unrelated provider-transport integration CI failure caused by an unchanged incomplete plugin-registry mock. * fix(scripts): preserve streamed installs and CI packing Keep public installer commands portable while replaying Darwin Bash 5.3+ stdin under system Bash through an immediately unlinked private temp file. Retain actionable sourced-install rejection and the SC2317-safe check. Restore the original CI packing policy and move the Bash policy scan into its existing macOS tooling owner without adding a routed test file. Validation: real Homebrew Bash streamed help and cleanup; 642 scan/routing tests; 23 selected installer tests under both PATH orders; planner cap and coverage tests; 139 Bash syntax checks; ShellCheck; 1,135 changed-gate tests; focused lint/changed-check repair; fresh Codex review with no P0/P1 findings.
163 lines
4.9 KiB
Bash
Executable file
163 lines
4.9 KiB
Bash
Executable file
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
IOS_DIR="${ROOT_DIR}/apps/ios"
|
|
|
|
APP_NAME="${IOS_APP_NAME:-OpenClaw}"
|
|
CONFIGURATION="${IOS_CONFIGURATION:-Debug}"
|
|
DERIVED_DATA_DIR="${IOS_DERIVED_DATA_DIR:-${IOS_DIR}/build/DerivedData}"
|
|
IOS_DESTINATION="${IOS_DEST:-platform=iOS Simulator,name=iPhone 17}"
|
|
SIMULATOR_TARGET="${IOS_SIM:-iPhone 17}"
|
|
|
|
XCODEBUILD_BIN="${IOS_RUN_XCODEBUILD_BIN:-xcodebuild}"
|
|
XCODEGEN_BIN="${IOS_RUN_XCODEGEN_BIN:-xcodegen}"
|
|
SIMCTL_BIN="${IOS_RUN_SIMCTL_BIN:-xcrun simctl}"
|
|
PLIST_BUDDY_BIN="${IOS_RUN_PLIST_BUDDY_BIN:-/usr/libexec/PlistBuddy}"
|
|
|
|
usage() {
|
|
cat <<'EOF'
|
|
Usage: scripts/ios-run.sh [options]
|
|
|
|
Options:
|
|
--push-sandbox-simulator
|
|
Build with the hosted sandbox push relay and launch the simulator with an
|
|
internal simulator proof secret.
|
|
--push-relay-base-url <url>
|
|
Override the sandbox relay URL used with --push-sandbox-simulator.
|
|
Defaults to https://ios-push-relay-sandbox.openclaw.ai.
|
|
--simulator-proof-secret-env <name>
|
|
Environment variable that contains the simulator proof secret.
|
|
Defaults to OPENCLAW_SIMULATOR_PUSH_PROOF_SECRET.
|
|
-h, --help
|
|
Show this help.
|
|
EOF
|
|
}
|
|
|
|
run_simctl() {
|
|
# shellcheck disable=SC2086
|
|
${SIMCTL_BIN} "$@"
|
|
}
|
|
|
|
push_sandbox_simulator=0
|
|
push_relay_base_url="${OPENCLAW_PUSH_SANDBOX_RELAY_BASE_URL:-https://ios-push-relay-sandbox.openclaw.ai}"
|
|
simulator_proof_secret_env="${OPENCLAW_SIMULATOR_PUSH_PROOF_SECRET_ENV:-OPENCLAW_SIMULATOR_PUSH_PROOF_SECRET}"
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
--push-sandbox-simulator)
|
|
push_sandbox_simulator=1
|
|
;;
|
|
--push-relay-base-url)
|
|
if [[ $# -lt 2 || -z "$2" ]]; then
|
|
echo "ERROR: --push-relay-base-url requires a URL" >&2
|
|
exit 1
|
|
fi
|
|
push_relay_base_url="$2"
|
|
shift
|
|
;;
|
|
--simulator-proof-secret-env)
|
|
if [[ $# -lt 2 || -z "$2" ]]; then
|
|
echo "ERROR: --simulator-proof-secret-env requires an environment variable name" >&2
|
|
exit 1
|
|
fi
|
|
simulator_proof_secret_env="$2"
|
|
shift
|
|
;;
|
|
-h | --help)
|
|
usage
|
|
exit 0
|
|
;;
|
|
*)
|
|
echo "ERROR: Unknown argument: $1" >&2
|
|
usage >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
xcodebuild_overrides=()
|
|
simulator_proof_secret=""
|
|
|
|
if [[ ! "${simulator_proof_secret_env}" =~ ^[A-Za-z_][A-Za-z0-9_]*$ ]]; then
|
|
echo "ERROR: Invalid simulator proof secret environment variable name" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [[ "${push_sandbox_simulator}" == "1" ]]; then
|
|
simulator_proof_secret="${!simulator_proof_secret_env:-}"
|
|
if [[ -z "${simulator_proof_secret}" ]]; then
|
|
echo "ERROR: ${simulator_proof_secret_env} must be set for --push-sandbox-simulator" >&2
|
|
exit 1
|
|
fi
|
|
if [[ "${#simulator_proof_secret}" -lt 32 ]]; then
|
|
echo "ERROR: ${simulator_proof_secret_env} must contain at least 32 characters" >&2
|
|
exit 1
|
|
fi
|
|
|
|
xcodebuild_overrides+=(
|
|
"OPENCLAW_PUSH_MODE=simulatorSandbox"
|
|
"OPENCLAW_PUSH_RELAY_BASE_URL=${push_relay_base_url}"
|
|
"OPENCLAW_APNS_ENTITLEMENT_ENVIRONMENT=development"
|
|
)
|
|
fi
|
|
|
|
unset "${simulator_proof_secret_env}"
|
|
if [[ "${simulator_proof_secret_env}" != "OPENCLAW_SIMULATOR_PUSH_PROOF_SECRET" ]]; then
|
|
unset OPENCLAW_SIMULATOR_PUSH_PROOF_SECRET
|
|
fi
|
|
|
|
"${ROOT_DIR}/scripts/ios-configure-signing.sh"
|
|
"${ROOT_DIR}/scripts/ios-write-version-xcconfig.sh"
|
|
node "${ROOT_DIR}/scripts/ios-write-swift-filelist.mjs"
|
|
|
|
cd "${IOS_DIR}"
|
|
"${XCODEGEN_BIN}" generate
|
|
if [[ "${push_sandbox_simulator}" == "1" ]]; then
|
|
"${XCODEBUILD_BIN}" \
|
|
-project OpenClaw.xcodeproj \
|
|
-scheme OpenClaw \
|
|
-destination "${IOS_DESTINATION}" \
|
|
-configuration "${CONFIGURATION}" \
|
|
-derivedDataPath "${DERIVED_DATA_DIR}" \
|
|
build \
|
|
"${xcodebuild_overrides[@]}"
|
|
else
|
|
"${XCODEBUILD_BIN}" \
|
|
-project OpenClaw.xcodeproj \
|
|
-scheme OpenClaw \
|
|
-destination "${IOS_DESTINATION}" \
|
|
-configuration "${CONFIGURATION}" \
|
|
-derivedDataPath "${DERIVED_DATA_DIR}" \
|
|
build
|
|
fi
|
|
|
|
app_path="${DERIVED_DATA_DIR}/Build/Products/${CONFIGURATION}-iphonesimulator/${APP_NAME}.app"
|
|
if [[ ! -d "${app_path}" ]]; then
|
|
echo "ERROR: Built app not found at ${app_path}" >&2
|
|
exit 1
|
|
fi
|
|
|
|
bundle_id="$("${PLIST_BUDDY_BIN}" -c 'Print :CFBundleIdentifier' "${app_path}/Info.plist" 2>/dev/null || true)"
|
|
if [[ -z "${bundle_id}" ]]; then
|
|
echo "ERROR: Built app is missing CFBundleIdentifier: ${app_path}/Info.plist" >&2
|
|
exit 1
|
|
fi
|
|
|
|
boot_output=""
|
|
if ! boot_output="$(run_simctl boot "${SIMULATOR_TARGET}" 2>&1)"; then
|
|
if [[ "${boot_output}" != *"Unable to boot device in current state: Booted"* ]]; then
|
|
printf '%s\n' "${boot_output}" >&2
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
run_simctl install "${SIMULATOR_TARGET}" "${app_path}"
|
|
if [[ "${push_sandbox_simulator}" == "1" ]]; then
|
|
# shellcheck disable=SC2086
|
|
SIMCTL_CHILD_OPENCLAW_SIMULATOR_PUSH_PROOF_SECRET="${simulator_proof_secret}" \
|
|
${SIMCTL_BIN} launch "${SIMULATOR_TARGET}" "${bundle_id}"
|
|
else
|
|
run_simctl launch "${SIMULATOR_TARGET}" "${bundle_id}"
|
|
fi
|