Files
AFFiNE-Mirror/packages/frontend/apps/ios/setup.sh
Lakr 75a6c79b2c fix(ios): crash at swift runtime error (#13635)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Fetch copilot model options per prompt (default, optional, pro) with
generated GraphQL query and schema types.

* **Chores**
* Upgraded iOS deps: Apollo iOS 1.23.0, EventSource 0.1.5, Swift
Collections 1.2.1.
* Switched Intelligents to static linking and updated project
integration.
* Parameterized and standardized GraphQL codegen tooling; setup
automation now syncs versions and safely backs up/restores custom
scalars.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-09-23 05:56:08 +00:00

61 lines
1.7 KiB
Bash
Executable File

#!/bin/zsh
# This script provides a quick setup process for iOS developers working on this project.
set -e
set -o pipefail
# packages/frontend/apps/ios/
cd "$(dirname "$0")"
export SCRIPT_DIR_PATH=$(pwd)
export BUILD_TYPE=canary
export PUBLIC_PATH="/"
cd ../../../../
if [ ! -d .git ]; then
echo "[-] .git directory not found at project root"
exit 1
fi
echo "[+] setting up the project"
echo "[*] interacting with yarn..."
yarn install
echo "[*] temporary set pbxproj to use object version 56"
XCPROJ_PATH=$SCRIPT_DIR_PATH/App/App.xcodeproj/project.pbxproj
CURRENT_VERSION=$(grep "objectVersion = " "$XCPROJ_PATH" | awk -F ' = ' '{print $2}' | tr -d ';')
echo "[*] current object version: $CURRENT_VERSION"
sed -i '' "s/objectVersion = $CURRENT_VERSION/objectVersion = 56/" "$XCPROJ_PATH"
yarn affine @affine/ios build
yarn affine @affine/ios sync
echo "[*] interacting with rust..."
rustup target add aarch64-apple-ios
rustup target add aarch64-apple-ios-sim
rustup target add aarch64-apple-darwin
echo "[*] syncing apollo version..."
LATEST_VERSION="1.23.0"
sed -i '' "s/exact: \"[^\"]*\"/exact: \"$LATEST_VERSION\"/g" $SCRIPT_DIR_PATH/App/Packages/AffineGraphQL/Package.swift
echo "[*] apollo version synced to $LATEST_VERSION"
echo "[*] backing up CustomScalars..."
TEMP_DIR=$(mktemp -d)
mkdir -p "$TEMP_DIR"
function cleanup { rm -rf "$TEMP_DIR"; }
trap cleanup EXIT
CUSTOM_SCALARS_DIR=$SCRIPT_DIR_PATH/App/Packages/AffineGraphQL/Sources/Schema/CustomScalars
cp -r $CUSTOM_SCALARS_DIR/* $TEMP_DIR/
echo "[*] codegen..."
rm -rf $CUSTOM_SCALARS_DIR/*
yarn affine @affine/ios codegen "1.23.0"
cp -r $TEMP_DIR/* $CUSTOM_SCALARS_DIR/
echo "[+] setup complete"
yarn affine @affine/ios xcode