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.
This commit is contained in:
245
scripts/build-all.sh
Executable file
245
scripts/build-all.sh
Executable file
@@ -0,0 +1,245 @@
|
||||
#!/bin/bash
|
||||
# Complete Build Script - Build Everything from Console
|
||||
# Builds plugin, iOS app, Android app, and all dependencies
|
||||
#
|
||||
# Usage:
|
||||
# ./scripts/build-all.sh [platform]
|
||||
# Platform options: ios, android, all (default: all)
|
||||
#
|
||||
# @author Matthew Raymer
|
||||
# @version 1.0.0
|
||||
|
||||
set -e
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
log_info() {
|
||||
echo -e "${GREEN}[INFO]${NC} $1"
|
||||
}
|
||||
|
||||
log_warn() {
|
||||
echo -e "${YELLOW}[WARN]${NC} $1"
|
||||
}
|
||||
|
||||
log_error() {
|
||||
echo -e "${RED}[ERROR]${NC} $1"
|
||||
}
|
||||
|
||||
log_step() {
|
||||
echo -e "${BLUE}[STEP]${NC} $1"
|
||||
}
|
||||
|
||||
# Get script directory
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
|
||||
# Parse arguments
|
||||
PLATFORM="${1:-all}"
|
||||
|
||||
# Validate platform
|
||||
if [[ ! "$PLATFORM" =~ ^(ios|android|all)$ ]]; then
|
||||
log_error "Invalid platform: $PLATFORM"
|
||||
log_info "Usage: $0 [ios|android|all]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd "$PROJECT_ROOT"
|
||||
|
||||
log_info "=========================================="
|
||||
log_info "Complete Build Script"
|
||||
log_info "Platform: $PLATFORM"
|
||||
log_info "=========================================="
|
||||
log_info ""
|
||||
|
||||
# Build TypeScript and plugin code
|
||||
log_step "Building plugin (TypeScript + Native)..."
|
||||
if ! ./scripts/build-native.sh --platform "$PLATFORM" 2>&1 | tee /tmp/build-native-output.log; then
|
||||
log_error "Plugin build failed"
|
||||
log_info ""
|
||||
log_info "Full build output saved to: /tmp/build-native-output.log"
|
||||
log_info "View errors: grep -E '(error:|ERROR|FAILED)' /tmp/build-native-output.log"
|
||||
log_info ""
|
||||
log_info "Checking for xcodebuild logs..."
|
||||
if [ -f "/tmp/xcodebuild_device.log" ]; then
|
||||
log_info "Device build errors:"
|
||||
grep -E "(error:|warning:)" /tmp/xcodebuild_device.log | head -30
|
||||
fi
|
||||
if [ -f "/tmp/xcodebuild_simulator.log" ]; then
|
||||
log_info "Simulator build errors:"
|
||||
grep -E "(error:|warning:)" /tmp/xcodebuild_simulator.log | head -30
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Build Android
|
||||
if [[ "$PLATFORM" == "android" || "$PLATFORM" == "all" ]]; then
|
||||
log_step "Building Android app..."
|
||||
|
||||
cd "$PROJECT_ROOT/android"
|
||||
|
||||
if [ ! -f "gradlew" ]; then
|
||||
log_error "Gradle wrapper not found. Run: cd android && ./gradlew wrapper"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Build Android app
|
||||
if ! ./gradlew :app:assembleDebug; then
|
||||
log_error "Android build failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
APK_PATH="app/build/outputs/apk/debug/app-debug.apk"
|
||||
if [ -f "$APK_PATH" ]; then
|
||||
log_info "✓ Android APK: $APK_PATH"
|
||||
else
|
||||
log_error "Android APK not found at $APK_PATH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log_info ""
|
||||
fi
|
||||
|
||||
# Build iOS
|
||||
if [[ "$PLATFORM" == "ios" || "$PLATFORM" == "all" ]]; then
|
||||
log_step "Building iOS app..."
|
||||
|
||||
cd "$PROJECT_ROOT/ios"
|
||||
|
||||
# Check if CocoaPods is installed
|
||||
if ! command -v pod &> /dev/null; then
|
||||
log_error "CocoaPods not found. Install with: gem install cocoapods"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Install CocoaPods dependencies
|
||||
log_step "Installing CocoaPods dependencies..."
|
||||
if [ ! -f "Podfile.lock" ] || [ "Podfile" -nt "Podfile.lock" ]; then
|
||||
pod install
|
||||
else
|
||||
log_info "CocoaPods dependencies up to date"
|
||||
fi
|
||||
|
||||
# Check if App workspace exists
|
||||
if [ ! -d "App/App.xcworkspace" ] && [ ! -d "App/App.xcodeproj" ]; then
|
||||
log_warn "iOS app Xcode project not found"
|
||||
log_info "The iOS app may need to be initialized with Capacitor"
|
||||
log_info "Try: cd ios && npx cap sync ios"
|
||||
log_info ""
|
||||
log_info "Attempting to build plugin framework only..."
|
||||
|
||||
# Build plugin framework only
|
||||
cd "$PROJECT_ROOT/ios"
|
||||
if [ -d "DailyNotificationPlugin.xcworkspace" ]; then
|
||||
WORKSPACE="DailyNotificationPlugin.xcworkspace"
|
||||
SCHEME="DailyNotificationPlugin"
|
||||
CONFIG="Debug"
|
||||
|
||||
log_step "Building plugin framework for simulator..."
|
||||
xcodebuild build \
|
||||
-workspace "$WORKSPACE" \
|
||||
-scheme "$SCHEME" \
|
||||
-configuration "$CONFIG" \
|
||||
-sdk iphonesimulator \
|
||||
-destination 'generic/platform=iOS Simulator' \
|
||||
CODE_SIGN_IDENTITY="" \
|
||||
CODE_SIGNING_REQUIRED=NO \
|
||||
CODE_SIGNING_ALLOWED=NO || log_warn "Plugin framework build failed (may need Xcode project setup)"
|
||||
else
|
||||
log_error "Cannot find iOS workspace or project"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
# Build iOS app
|
||||
cd "$PROJECT_ROOT/ios/App"
|
||||
|
||||
# Determine workspace vs project
|
||||
if [ -d "App.xcworkspace" ]; then
|
||||
WORKSPACE="App.xcworkspace"
|
||||
BUILD_CMD="xcodebuild -workspace"
|
||||
elif [ -d "App.xcodeproj" ]; then
|
||||
PROJECT="App.xcodeproj"
|
||||
BUILD_CMD="xcodebuild -project"
|
||||
else
|
||||
log_error "Cannot find iOS workspace or project"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SCHEME="App"
|
||||
CONFIG="Debug"
|
||||
SDK="iphonesimulator"
|
||||
|
||||
log_step "Building iOS app for simulator..."
|
||||
|
||||
if [ -n "$WORKSPACE" ]; then
|
||||
BUILD_OUTPUT=$(xcodebuild build \
|
||||
-workspace "$WORKSPACE" \
|
||||
-scheme "$SCHEME" \
|
||||
-configuration "$CONFIG" \
|
||||
-sdk "$SDK" \
|
||||
-destination 'generic/platform=iOS Simulator' \
|
||||
-derivedDataPath build/derivedData \
|
||||
CODE_SIGN_IDENTITY="" \
|
||||
CODE_SIGNING_REQUIRED=NO \
|
||||
CODE_SIGNING_ALLOWED=NO \
|
||||
2>&1)
|
||||
else
|
||||
BUILD_OUTPUT=$(xcodebuild build \
|
||||
-project "$PROJECT" \
|
||||
-scheme "$SCHEME" \
|
||||
-configuration "$CONFIG" \
|
||||
-sdk "$SDK" \
|
||||
-destination 'generic/platform=iOS Simulator' \
|
||||
-derivedDataPath build/derivedData \
|
||||
CODE_SIGN_IDENTITY="" \
|
||||
CODE_SIGNING_REQUIRED=NO \
|
||||
CODE_SIGNING_ALLOWED=NO \
|
||||
2>&1)
|
||||
fi
|
||||
|
||||
if echo "$BUILD_OUTPUT" | grep -q "BUILD SUCCEEDED"; then
|
||||
log_info "✓ iOS app build completed successfully"
|
||||
|
||||
# Find built app
|
||||
APP_PATH=$(find build/derivedData -name "*.app" -type d -path "*/Build/Products/*-iphonesimulator/*.app" | head -1)
|
||||
if [ -n "$APP_PATH" ]; then
|
||||
log_info "✓ iOS app bundle: $APP_PATH"
|
||||
fi
|
||||
elif echo "$BUILD_OUTPUT" | grep -q "error:"; then
|
||||
log_error "iOS app build failed"
|
||||
echo "$BUILD_OUTPUT" | grep -E "(error:|warning:)" | head -20
|
||||
exit 1
|
||||
else
|
||||
log_warn "iOS app build completed with warnings"
|
||||
echo "$BUILD_OUTPUT" | grep -E "(warning:|error:)" | head -10
|
||||
fi
|
||||
fi
|
||||
|
||||
log_info ""
|
||||
fi
|
||||
|
||||
log_info "=========================================="
|
||||
log_info "✅ Build Complete!"
|
||||
log_info "=========================================="
|
||||
log_info ""
|
||||
|
||||
# Summary
|
||||
if [[ "$PLATFORM" == "android" || "$PLATFORM" == "all" ]]; then
|
||||
log_info "Android APK: android/app/build/outputs/apk/debug/app-debug.apk"
|
||||
log_info "Install: adb install android/app/build/outputs/apk/debug/app-debug.apk"
|
||||
fi
|
||||
|
||||
if [[ "$PLATFORM" == "ios" || "$PLATFORM" == "all" ]]; then
|
||||
log_info "iOS App: ios/App/build/derivedData/Build/Products/Debug-iphonesimulator/App.app"
|
||||
log_info "Install: xcrun simctl install booted <APP_PATH>"
|
||||
fi
|
||||
|
||||
log_info ""
|
||||
log_info "For deployment scripts, see:"
|
||||
log_info " - scripts/build-and-deploy-native-ios.sh (iOS native app)"
|
||||
log_info " - test-apps/daily-notification-test/scripts/build-and-deploy-ios.sh (Vue 3 test app)"
|
||||
|
||||
@@ -156,7 +156,23 @@ check_environment_ios() {
|
||||
# Check for CocoaPods
|
||||
if ! command -v pod &> /dev/null; then
|
||||
log_error "CocoaPods not found. Install with:"
|
||||
log_error " sudo gem install cocoapods"
|
||||
log_info " gem install cocoapods"
|
||||
|
||||
# Check if rbenv is available and suggest reloading
|
||||
if [ -n "$RBENV_ROOT" ] || [ -d "$HOME/.rbenv" ]; then
|
||||
log_info "Or if using rbenv, ensure shell is reloaded:"
|
||||
log_info " source ~/.zshrc # or source ~/.bashrc"
|
||||
log_info " gem install cocoapods"
|
||||
fi
|
||||
|
||||
# Check if setup script exists
|
||||
if [ -f "$SCRIPT_DIR/setup-ruby.sh" ]; then
|
||||
log_info ""
|
||||
log_info "You can also run the setup script first:"
|
||||
log_info " ./scripts/setup-ruby.sh"
|
||||
log_info " gem install cocoapods"
|
||||
fi
|
||||
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -408,21 +424,35 @@ build_ios() {
|
||||
IOS_SDK_VERSION=$(xcrun --show-sdk-version --sdk iphoneos 2>&1)
|
||||
log_info "Found iOS SDK: $IOS_SDK_VERSION"
|
||||
|
||||
# Check if platform components are installed by trying a dry-run
|
||||
DRY_RUN_OUTPUT=$(xcodebuild -workspace "$WORKSPACE" \
|
||||
-scheme "$SCHEME" \
|
||||
-destination 'generic/platform=iOS' \
|
||||
-dry-run 2>&1)
|
||||
|
||||
if echo "$DRY_RUN_OUTPUT" | grep -q "iOS.*is not installed"; then
|
||||
log_warn "iOS device platform components not installed"
|
||||
log_info "To install iOS device platform components, run:"
|
||||
log_info " xcodebuild -downloadPlatform iOS"
|
||||
log_info "Or via Xcode: Settings > Components > iOS $IOS_SDK_VERSION"
|
||||
log_info ""
|
||||
log_info "Building for iOS Simulator instead (sufficient for plugin development)"
|
||||
# Check if platform components are installed by trying a list command
|
||||
# Note: -dry-run is not supported in new build system, so we check SDK availability differently
|
||||
if xcodebuild -showsdks 2>&1 | grep -q "iphoneos"; then
|
||||
# Try to validate SDK path exists
|
||||
SDK_PATH=$(xcrun --show-sdk-path --sdk iphoneos 2>&1)
|
||||
if [ $? -eq 0 ] && [ -d "$SDK_PATH" ]; then
|
||||
# Check if we can actually build (by trying to list build settings)
|
||||
LIST_OUTPUT=$(xcodebuild -workspace "$WORKSPACE" \
|
||||
-scheme "$SCHEME" \
|
||||
-destination 'generic/platform=iOS' \
|
||||
-showBuildSettings 2>&1 | head -5)
|
||||
|
||||
if echo "$LIST_OUTPUT" | grep -q "iOS.*is not installed"; then
|
||||
log_warn "iOS device platform components not installed"
|
||||
log_info "To install iOS device platform components, run:"
|
||||
log_info " xcodebuild -downloadPlatform iOS"
|
||||
log_info "Or via Xcode: Settings > Components > iOS $IOS_SDK_VERSION"
|
||||
log_info ""
|
||||
log_info "Building for iOS Simulator instead (sufficient for plugin development)"
|
||||
else
|
||||
BUILD_DEVICE=true
|
||||
fi
|
||||
else
|
||||
log_warn "iOS SDK path not accessible: $SDK_PATH"
|
||||
log_info "Building for iOS Simulator instead"
|
||||
fi
|
||||
else
|
||||
BUILD_DEVICE=true
|
||||
log_warn "iOS device SDK not found in xcodebuild -showsdks"
|
||||
log_info "Building for iOS Simulator instead"
|
||||
fi
|
||||
else
|
||||
log_warn "iOS SDK not found"
|
||||
@@ -443,13 +473,37 @@ build_ios() {
|
||||
CODE_SIGNING_ALLOWED=NO \
|
||||
2>&1)
|
||||
|
||||
BUILD_EXIT_CODE=$?
|
||||
|
||||
if echo "$BUILD_OUTPUT" | grep -q "error.*iOS.*is not installed"; then
|
||||
log_warn "iOS device build failed - platform components not installed"
|
||||
echo "$BUILD_OUTPUT" > /tmp/xcodebuild_device.log
|
||||
log_info "Check build log: /tmp/xcodebuild_device.log"
|
||||
BUILD_DEVICE=false
|
||||
elif echo "$BUILD_OUTPUT" | grep -q "BUILD FAILED"; then
|
||||
log_warn "iOS device build failed"
|
||||
log_info ""
|
||||
log_info "=== DEVICE BUILD ERRORS ==="
|
||||
echo "$BUILD_OUTPUT" | grep -E "(error:|warning:|BUILD FAILED)"
|
||||
echo "$BUILD_OUTPUT" > /tmp/xcodebuild_device.log
|
||||
log_info ""
|
||||
log_info "Full build log saved to: /tmp/xcodebuild_device.log"
|
||||
log_info "View full log: cat /tmp/xcodebuild_device.log"
|
||||
log_info "Falling back to simulator build..."
|
||||
BUILD_DEVICE=false
|
||||
elif echo "$BUILD_OUTPUT" | grep -q "BUILD SUCCEEDED"; then
|
||||
log_info "✓ iOS device build completed"
|
||||
elif [ $BUILD_EXIT_CODE -ne 0 ]; then
|
||||
log_warn "iOS device build failed (exit code: $BUILD_EXIT_CODE)"
|
||||
log_info ""
|
||||
log_info "=== DEVICE BUILD ERRORS ==="
|
||||
echo "$BUILD_OUTPUT" | grep -E "(error:|warning:|BUILD FAILED)"
|
||||
echo "$BUILD_OUTPUT" > /tmp/xcodebuild_device.log
|
||||
log_info ""
|
||||
log_info "Full build log saved to: /tmp/xcodebuild_device.log"
|
||||
log_info "View full log: cat /tmp/xcodebuild_device.log"
|
||||
log_info "Falling back to simulator build..."
|
||||
BUILD_DEVICE=false
|
||||
else
|
||||
log_warn "iOS device build completed with warnings"
|
||||
echo "$BUILD_OUTPUT" > /tmp/xcodebuild_device.log
|
||||
@@ -470,11 +524,31 @@ build_ios() {
|
||||
CODE_SIGNING_ALLOWED=NO \
|
||||
2>&1)
|
||||
|
||||
SIMULATOR_EXIT_CODE=$?
|
||||
|
||||
# Save full output to log file
|
||||
echo "$SIMULATOR_BUILD_OUTPUT" > /tmp/xcodebuild_simulator.log
|
||||
|
||||
if echo "$SIMULATOR_BUILD_OUTPUT" | grep -q "BUILD SUCCEEDED"; then
|
||||
log_info "✓ iOS simulator build completed successfully"
|
||||
elif echo "$SIMULATOR_BUILD_OUTPUT" | grep -q "error:"; then
|
||||
log_error "iOS simulator build failed"
|
||||
echo "$SIMULATOR_BUILD_OUTPUT" | grep -E "(error:|warning:)" | head -20
|
||||
log_info ""
|
||||
log_info "Full error output:"
|
||||
echo "$SIMULATOR_BUILD_OUTPUT" | grep -E "(error:|warning:)"
|
||||
log_info ""
|
||||
log_info "Full build log saved to: /tmp/xcodebuild_simulator.log"
|
||||
log_info "View full log: cat /tmp/xcodebuild_simulator.log"
|
||||
log_info "View errors only: grep -E '(error:|warning:)' /tmp/xcodebuild_simulator.log"
|
||||
exit 1
|
||||
elif [ $SIMULATOR_EXIT_CODE -ne 0 ]; then
|
||||
log_error "iOS simulator build failed (exit code: $SIMULATOR_EXIT_CODE)"
|
||||
log_info ""
|
||||
log_info "Build output (last 50 lines):"
|
||||
echo "$SIMULATOR_BUILD_OUTPUT" | tail -50
|
||||
log_info ""
|
||||
log_info "Full build log saved to: /tmp/xcodebuild_simulator.log"
|
||||
log_info "View full log: cat /tmp/xcodebuild_simulator.log"
|
||||
exit 1
|
||||
else
|
||||
log_warn "iOS simulator build completed with warnings"
|
||||
|
||||
Reference in New Issue
Block a user