Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 34 additions & 2 deletions appium/scripts/run-local/build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,37 @@
#!/usr/bin/env bash

# ── 1. Build app ─────────────────────────────────────────────────────────────
ensure_flutter_swift_package_manager() {
# Without SPM, flutter build ios falls back to CocoaPods for onesignal_flutter
# and fails on the prebuilt OneSignal XCFramework (Multiple commands produce
# XCFrameworkIntermediates, or Podfile.lock vs podspec version skew).
if flutter config --list 2>/dev/null | grep -q 'enable-swift-package-manager: true'; then
return 0
fi
info "Enabling Flutter Swift Package Manager (required for OneSignal iOS builds)..."
flutter config --enable-swift-package-manager
}

sync_flutter_onesignal_xcframework_pod() {
# NSE/Widget extension targets still resolve OneSignalXCFramework via CocoaPods
# even when SPM owns the Flutter plugin. Podfile.lock often lags the podspec
# pin after an iOS SDK bump (e.g. 5.4.1 lock vs 5.5.0 podspec).
local lock="$DEMO_DIR/ios/Podfile.lock"
local podspec="$FLUTTER_DIR/ios/onesignal_flutter.podspec"
[[ -f "$lock" && -f "$podspec" ]] || return 0

local locked wanted
locked="$(awk '/^- OneSignalXCFramework \(/ {
if (match($0, /[0-9]+\.[0-9]+\.[0-9]+/)) { print substr($0, RSTART, RLENGTH); exit }
}' "$lock" 2>/dev/null || true)"
wanted="$(awk -F"'" '/OneSignalXCFramework/ { print $4; exit }' "$podspec" 2>/dev/null || true)"

[[ -n "$locked" && -n "$wanted" && "$locked" != "$wanted" ]] || return 0

info "Updating OneSignalXCFramework CocoaPods pin ($locked -> $wanted)..."
(cd "$DEMO_DIR/ios" && pod update OneSignalXCFramework --repo-update)
}

build_flutter_ios() {
if [[ -n "${ONESIGNAL_APP_ID:-}" && -n "${ONESIGNAL_API_KEY:-}" ]]; then
info "Writing .env for demo app..."
Expand All @@ -12,11 +43,12 @@ EOF
warn "ONESIGNAL_APP_ID / ONESIGNAL_API_KEY not set — skipping demo .env"
fi

ensure_flutter_swift_package_manager

info "Installing Flutter dependencies..."
(cd "$FLUTTER_DIR" && flutter pub get)

# info "Installing CocoaPods..."
# (cd "$DEMO_DIR/ios" && pod install)
sync_flutter_onesignal_xcframework_pod

info "Building debug .app for simulator (this may take a few minutes)..."
(cd "$DEMO_DIR" && flutter build ios --simulator --debug)
Expand Down
10 changes: 10 additions & 0 deletions appium/scripts/run-local/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,16 @@ USAGE
|| error "Appium driver '$driver' is not installed. Install it with: appium driver install $driver
(check what's installed with: appium driver list --installed)"

# Vite+ installs into ~/.vite-plus/bin and updates shell rc files, but the
# current terminal (e.g. right after bootstrap.sh) may not have sourced
# ~/.vite-plus/env yet. Prepend the shim dir when the binary is present.
if ! command -v vpx >/dev/null 2>&1; then
local vp_bin="$HOME/.vite-plus/bin"
if [[ -x "$vp_bin/vpx" ]]; then
export PATH="$vp_bin:$PATH"
info "Added $vp_bin to PATH for this run (restart the shell or: source \"$HOME/.vite-plus/env\")."
fi
fi
if ! command -v vpx >/dev/null 2>&1; then
if [[ -x "$HOME/.vite-plus/current/bin/vp" ]]; then
error "vpx not found on PATH, but Vite+ is installed — the vpx symlink is missing or ~/.vite-plus/bin isn't on PATH. Run $SCRIPT_DIR/bootstrap.sh (or: ln -sf ../current/bin/vp ~/.vite-plus/bin/vpx && open a new shell / source ~/.vite-plus/env)."
Expand Down