changes
This commit is contained in:
Executable
+27
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build the Rust WASM engine + React frontend, then bundle the production build
|
||||
# into assets/web/ so the Flutter InAppLocalhostServer can serve it inside the app.
|
||||
#
|
||||
# Run from anywhere: ./scripts/build_web.sh
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
|
||||
echo "==> Building Rust WASM (wasm-pack, target web)"
|
||||
( cd wasm && wasm-pack build --target web )
|
||||
|
||||
echo "==> Building React frontend (vite)"
|
||||
( cd wasm/frontend && npm run build )
|
||||
|
||||
echo "==> Bundling dist/ -> assets/web/"
|
||||
rm -rf assets/web
|
||||
mkdir -p assets/web
|
||||
cp -R wasm/frontend/dist/. assets/web/
|
||||
|
||||
echo "==> Done. assets/web/ contents:"
|
||||
ls -la assets/web
|
||||
|
||||
echo
|
||||
echo "Flutter will serve this at http://localhost:8080 via InAppLocalhostServer."
|
||||
echo "Remember to run 'flutter pub get' if pubspec assets changed."
|
||||
Executable
+54
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build the web bundle + iOS app and install it on a connected iPhone.
|
||||
#
|
||||
# Works with the free Personal Team: on first use the app is built through
|
||||
# Xcode for this device, which registers it in the provisioning profile
|
||||
# (`flutter install` fails there with "This provisioning profile cannot be
|
||||
# installed on this device").
|
||||
# Personal Team builds expire after 7 days: just run this again.
|
||||
#
|
||||
# Usage: ./scripts/install_ios.sh [device-id] (default: first iPhone found)
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
|
||||
DEVICE="${1:-}"
|
||||
if [ -z "$DEVICE" ]; then
|
||||
DEVICE="$(flutter devices --machine 2>/dev/null | python3 -c '
|
||||
import json, sys
|
||||
devs = [d for d in json.load(sys.stdin) if d.get("targetPlatform") == "ios" and not d.get("emulator")]
|
||||
print(devs[0]["id"] if devs else "")')"
|
||||
fi
|
||||
if [ -z "$DEVICE" ]; then
|
||||
echo "No iPhone found. Connect it (cable or same Wi-Fi) and unlock it." >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "==> Device: $DEVICE"
|
||||
|
||||
./scripts/build_web.sh
|
||||
|
||||
# Native-asset frameworks (e.g. objective_c) live in build/native_assets/ios and
|
||||
# Flutter's cache does not tell simulator and device builds apart: after a
|
||||
# simulator build the iPhone would get a simulator binary and reject the app.
|
||||
rm -rf .dart_tool/flutter_build build/native_assets/ios
|
||||
|
||||
echo "==> Flutter iOS build (device)"
|
||||
flutter build ios --release
|
||||
APP=build/ios/iphoneos/Runner.app
|
||||
|
||||
# The free Personal Team profile must list this iPhone. If it does not yet,
|
||||
# build once through Xcode so it registers the device in the profile.
|
||||
if ! security cms -D -i "$APP/embedded.mobileprovision" 2>/dev/null | grep -q "$DEVICE"; then
|
||||
echo "==> Registering the device in the provisioning profile (Xcode build)"
|
||||
xcodebuild -workspace ios/Runner.xcworkspace -scheme Runner -configuration Release \
|
||||
-destination "id=$DEVICE" -allowProvisioningUpdates -allowProvisioningDeviceRegistration \
|
||||
-derivedDataPath build/ios-device -quiet build
|
||||
APP=build/ios-device/Build/Products/Release-iphoneos/Runner.app
|
||||
fi
|
||||
|
||||
echo "==> Installing"
|
||||
xcrun devicectl device install app --device "$DEVICE" "$APP"
|
||||
|
||||
echo "==> Launching (first time: trust the developer on the phone, see README)"
|
||||
xcrun devicectl device process launch --device "$DEVICE" com.sagifer.skycontour || true
|
||||
Reference in New Issue
Block a user