Files
daily-notification-plugin/docs/CONSOLE_BUILD_GUIDE.md
Matthew Raymer 8ded555a21 fix(ios): resolve compilation errors and enable successful build
Fixed critical compilation errors preventing iOS plugin build:
- Updated logger API calls from logger.debug(TAG, msg) to logger.log(.debug, msg)
  across all iOS plugin files to match DailyNotificationLogger interface
- Fixed async/await concurrency in makeConditionalRequest using semaphore pattern
- Fixed NotificationContent immutability by creating new instances instead of mutation
- Changed private access control to internal for extension-accessible methods
- Added iOS 15.0+ availability checks for interruptionLevel property
- Fixed static member references using Self.MEMBER_NAME syntax
- Added missing .scheduling case to exhaustive switch statement
- Fixed variable initialization in retry state closures

Added DailyNotificationStorage.swift implementation matching Android pattern.

Updated build scripts with improved error reporting and full log visibility.

iOS plugin now compiles successfully. All build errors resolved.
2025-11-04 22:22:02 -08:00

292 lines
5.6 KiB
Markdown

# Building Everything from Console
**Author**: Matthew Raymer
**Date**: November 4, 2025
## Quick Start
Build everything (plugin + iOS + Android):
```bash
./scripts/build-all.sh
```
Build specific platform:
```bash
./scripts/build-all.sh ios # iOS only
./scripts/build-all.sh android # Android only
./scripts/build-all.sh all # Everything (default)
```
## What Gets Built
### 1. Plugin Build
- Compiles TypeScript to JavaScript
- Builds native iOS code (Swift)
- Builds native Android code (Kotlin/Java)
- Creates plugin frameworks/bundles
### 2. Android Build
- Builds Android app (`android/app`)
- Creates debug APK
- Output: `android/app/build/outputs/apk/debug/app-debug.apk`
### 3. iOS Build
- Installs CocoaPods dependencies
- Builds iOS app (`ios/App`)
- Creates simulator app bundle
- Output: `ios/App/build/derivedData/Build/Products/Debug-iphonesimulator/App.app`
## Detailed Build Process
### Step-by-Step Build
```bash
# 1. Build plugin (TypeScript + Native)
./scripts/build-native.sh --platform all
# 2. Build Android app
cd android
./gradlew :app:assembleDebug
cd ..
# 3. Build iOS app
cd ios
pod install
cd App
xcodebuild -workspace App.xcworkspace \
-scheme App \
-configuration Debug \
-sdk iphonesimulator \
-destination 'generic/platform=iOS Simulator' \
CODE_SIGN_IDENTITY="" \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGNING_ALLOWED=NO
```
### Platform-Specific Builds
#### Android Only
```bash
# Build plugin for Android
./scripts/build-native.sh --platform android
# Build Android app
cd android
./gradlew :app:assembleDebug
# Install on device/emulator
adb install app/build/outputs/apk/debug/app-debug.apk
```
#### iOS Only
```bash
# Build plugin for iOS
./scripts/build-native.sh --platform ios
# Install CocoaPods dependencies
cd ios
pod install
# Build iOS app
cd App
xcodebuild -workspace App.xcworkspace \
-scheme App \
-configuration Debug \
-sdk iphonesimulator \
CODE_SIGN_IDENTITY="" \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGNING_ALLOWED=NO
# Deploy to simulator (see deployment scripts)
../scripts/build-and-deploy-native-ios.sh
```
## Build Scripts
### Main Build Script
**`scripts/build-all.sh`**
- Builds plugin + iOS + Android
- Handles dependencies automatically
- Provides clear error messages
### Platform-Specific Scripts
**`scripts/build-native.sh`**
- Builds plugin only (TypeScript + native code)
- Supports `--platform ios`, `--platform android`, `--platform all`
**`scripts/build-and-deploy-native-ios.sh`**
- Builds iOS plugin + app
- Deploys to simulator automatically
- Includes booting simulator and launching app
**`test-apps/daily-notification-test/scripts/build-and-deploy-ios.sh`**
- Builds Vue 3 test app
- Syncs web assets
- Deploys to simulator
## Build Outputs
### Android
```
android/app/build/outputs/apk/debug/app-debug.apk
```
### iOS
```
ios/App/build/derivedData/Build/Products/Debug-iphonesimulator/App.app
```
### Plugin
```
ios/build/derivedData/Build/Products/*/DailyNotificationPlugin.framework
android/plugin/build/outputs/aar/plugin-release.aar
```
## Prerequisites
### For All Platforms
- Node.js and npm
- Git
### For Android
- Android SDK
- Java JDK (8 or higher)
- Gradle (or use Gradle wrapper)
### For iOS
- macOS
- Xcode Command Line Tools
- CocoaPods (`gem install cocoapods`)
## Troubleshooting
### Build Fails
```bash
# Clean and rebuild
./scripts/build-native.sh --platform all --clean
# Android: Clean Gradle cache
cd android && ./gradlew clean && cd ..
# iOS: Clean Xcode build
cd ios/App && xcodebuild clean && cd ../..
```
### Dependencies Out of Date
```bash
# Update npm dependencies
npm install
# Update CocoaPods
cd ios && pod update && cd ..
# Update Android dependencies
cd android && ./gradlew --refresh-dependencies && cd ..
```
### iOS Project Not Found
If `ios/App/App.xcworkspace` doesn't exist:
```bash
# Initialize iOS app with Capacitor
cd ios
npx cap sync ios
pod install
```
### Android Build Issues
```bash
# Verify Android SDK
echo $ANDROID_HOME
# Clean build
cd android
./gradlew clean
./gradlew :app:assembleDebug
```
## CI/CD Integration
### GitHub Actions Example
```yaml
name: Build All Platforms
on: [push, pull_request]
jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- name: Build Everything
run: ./scripts/build-all.sh all
```
### Android-Only CI
```yaml
name: Build Android
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/setup-java@v2
- name: Build Android
run: ./scripts/build-all.sh android
```
## Verification
After building, verify outputs:
```bash
# Android APK exists
test -f android/app/build/outputs/apk/debug/app-debug.apk && echo "✓ Android APK"
# iOS app bundle exists
test -d ios/App/build/derivedData/Build/Products/Debug-iphonesimulator/App.app && echo "✓ iOS app"
# Plugin frameworks exist
test -d ios/build/derivedData/Build/Products/*/DailyNotificationPlugin.framework && echo "✓ iOS plugin"
test -f android/plugin/build/outputs/aar/plugin-release.aar && echo "✓ Android plugin"
```
## Next Steps
After building:
1. **Deploy Android**: `adb install android/app/build/outputs/apk/debug/app-debug.apk`
2. **Deploy iOS**: Use `scripts/build-and-deploy-native-ios.sh`
3. **Test**: Run plugin tests and verify functionality
4. **Debug**: Use platform-specific debugging tools
## References
- [Build Native Script](scripts/build-native.sh)
- [iOS Deployment Guide](docs/standalone-ios-simulator-guide.md)
- [Android Build Guide](BUILDING.md)