Browse Source
- Removed 24 redundant build:capacitor:* scripts that were just aliases - Kept essential build:capacitor and build:capacitor:sync scripts - Improves script clarity and reduces maintenance overhead - No functional changes to build processespull/142/head
6 changed files with 840 additions and 29 deletions
@ -0,0 +1,405 @@ |
|||
# Auto-Run Guide |
|||
|
|||
**Author**: Matthew Raymer |
|||
**Date**: 2025-07-12 |
|||
**Status**: 🎯 **ACTIVE** - In Use |
|||
|
|||
## Overview |
|||
|
|||
The TimeSafari auto-run system intelligently detects available devices and |
|||
automatically builds and launches the app on the best available target. It |
|||
supports Android devices/emulators, iOS devices/simulators, and Electron |
|||
desktop apps. |
|||
|
|||
## Features |
|||
|
|||
### Smart Device Detection |
|||
- **Android**: Detects real devices vs emulators using ADB |
|||
- **iOS**: Detects real devices vs simulators using xcrun |
|||
- **Electron**: Checks for Electron availability |
|||
- **Priority**: Real devices preferred over simulators/emulators |
|||
|
|||
### Build Mode Support |
|||
- **Development**: Default mode for daily development |
|||
- **Test**: Optimized for testing with test data |
|||
- **Production**: Production-ready builds |
|||
|
|||
### Platform Targeting |
|||
- **All platforms**: Automatically detects and runs on all available |
|||
- **Specific platform**: Target only iOS, Android, or Electron |
|||
- **Cross-platform**: Works on macOS, Linux, and Windows |
|||
|
|||
### Auto-Run Options |
|||
- **Build + Auto-Run**: Single command to build and launch |
|||
- **Smart Detection**: Automatically chooses best available target |
|||
- **Error Handling**: Graceful fallbacks when devices unavailable |
|||
|
|||
## Usage |
|||
|
|||
### Auto-Run Script (Recommended) |
|||
|
|||
```bash |
|||
# Auto-detect and run on all available platforms (development mode) |
|||
npm run auto-run |
|||
|
|||
# Run in test mode |
|||
npm run auto-run:test |
|||
|
|||
# Run in production mode |
|||
npm run auto-run:prod |
|||
|
|||
# Target specific platforms |
|||
npm run auto-run:ios |
|||
npm run auto-run:android |
|||
npm run auto-run:electron |
|||
``` |
|||
|
|||
### Build Script Auto-Run |
|||
|
|||
#### iOS Auto-Run Commands |
|||
|
|||
```bash |
|||
# Test build + auto-run |
|||
npm run build:ios:test:run |
|||
|
|||
# Production build + auto-run |
|||
npm run build:ios:prod:run |
|||
|
|||
# Debug build + auto-run |
|||
npm run build:ios:debug:run |
|||
|
|||
# Release build + auto-run |
|||
npm run build:ios:release:run |
|||
``` |
|||
|
|||
#### Android Auto-Run Commands |
|||
|
|||
```bash |
|||
# Test build + auto-run |
|||
npm run build:android:test:run |
|||
|
|||
# Production build + auto-run |
|||
npm run build:android:prod:run |
|||
|
|||
# Debug build + auto-run |
|||
npm run build:android:debug:run |
|||
|
|||
# Release build + auto-run |
|||
npm run build:android:release:run |
|||
``` |
|||
|
|||
#### Electron Auto-Run Commands |
|||
|
|||
```bash |
|||
# Development build + auto-run |
|||
npm run build:electron:dev:run |
|||
|
|||
# Test build + auto-run |
|||
npm run build:electron:test:run |
|||
|
|||
# Production build + auto-run |
|||
npm run build:electron:prod:run |
|||
``` |
|||
|
|||
### Advanced Usage |
|||
|
|||
```bash |
|||
# Direct script usage with options |
|||
./scripts/auto-run.sh --test --platform=ios |
|||
./scripts/auto-run.sh --prod --platform=android |
|||
./scripts/auto-run.sh --auto # Skip confirmation prompts |
|||
|
|||
# Build script with auto-run flag |
|||
./scripts/build-ios.sh --test --auto-run |
|||
./scripts/build-android.sh --prod --auto-run |
|||
./scripts/build-electron.sh --test --auto-run |
|||
|
|||
# Combine options |
|||
./scripts/auto-run.sh --test --platform=all --auto |
|||
``` |
|||
|
|||
### Command Line Options |
|||
|
|||
| Option | Description | Example | |
|||
|--------|-------------|---------| |
|||
| `--test` | Build and run in test mode | `--test` | |
|||
| `--prod` | Build and run in production mode | `--prod` | |
|||
| `--platform=PLATFORM` | Target specific platform | `--platform=ios` | |
|||
| `--auto` | Skip confirmation prompts | `--auto` | |
|||
| `--auto-run` | Auto-run after build | `--auto-run` | |
|||
| `--help` | Show help message | `--help` | |
|||
|
|||
**Platform Options:** |
|||
- `ios` - iOS devices/simulators only |
|||
- `android` - Android devices/emulators only |
|||
- `electron` - Electron desktop app only |
|||
- `all` - All available platforms (default) |
|||
|
|||
## How It Works |
|||
|
|||
### 1. Device Detection |
|||
|
|||
**Android Detection:** |
|||
```bash |
|||
# Uses ADB to list devices |
|||
adb devices |
|||
|
|||
# Parses output to distinguish: |
|||
# - Real devices: Physical Android phones/tablets |
|||
# - Emulators: Android emulator instances |
|||
``` |
|||
|
|||
**iOS Detection:** |
|||
```bash |
|||
# Uses xcrun to list devices |
|||
xcrun xctrace list devices |
|||
|
|||
# Parses output to distinguish: |
|||
# - Real devices: Physical iPhones/iPads |
|||
# - Simulators: iOS Simulator instances |
|||
``` |
|||
|
|||
### 2. Build Process |
|||
|
|||
The script automatically calls the appropriate build commands: |
|||
|
|||
```bash |
|||
# Development mode |
|||
npm run build:ios:dev |
|||
npm run build:android:dev |
|||
npm run build:electron:dev |
|||
|
|||
# Test mode |
|||
npm run build:ios:test |
|||
npm run build:android:test |
|||
npm run build:electron:test |
|||
|
|||
# Production mode |
|||
npm run build:ios:prod |
|||
npm run build:android:prod |
|||
npm run build:electron:prod |
|||
``` |
|||
|
|||
### 3. Launch Process |
|||
|
|||
**Android:** |
|||
- Real devices: Install APK and launch via ADB |
|||
- Emulators: Use `npx cap run android` |
|||
|
|||
**iOS:** |
|||
- Real devices: Build release version (requires Xcode setup) |
|||
- Simulators: Use `npx cap run ios` |
|||
|
|||
**Electron:** |
|||
- Launch via `npm run electron:start` |
|||
|
|||
## Examples |
|||
|
|||
### Development Workflow |
|||
|
|||
```bash |
|||
# Quick development run |
|||
npm run auto-run |
|||
|
|||
# Output: |
|||
# ✅ Found 1 real Android device: ABC123DEF456 |
|||
# ✅ Found 1 iOS simulator: iPhone 15 Pro |
|||
# ✅ Electron: available |
|||
# |
|||
# Available targets: |
|||
# Android: real:ABC123DEF456 |
|||
# iOS: simulator:iPhone 15 Pro |
|||
# Electron: available |
|||
# |
|||
# Continue with auto-run? (y/N): y |
|||
# |
|||
# 🔄 Building and running Android (real: ABC123DEF456)... |
|||
# 🔄 Building and running iOS (simulator: iPhone 15 Pro)... |
|||
# 🔄 Building and running Electron... |
|||
# |
|||
# ✅ Auto-run completed successfully! 3 platform(s) launched. |
|||
``` |
|||
|
|||
### Test Mode with Build Scripts |
|||
|
|||
```bash |
|||
# iOS test build + auto-run |
|||
npm run build:ios:test:run |
|||
|
|||
# Android test build + auto-run |
|||
npm run build:android:test:run |
|||
|
|||
# Electron test build + auto-run |
|||
npm run build:electron:test:run |
|||
|
|||
# Output: |
|||
# === TimeSafari iOS Build Process === |
|||
# 🔄 Building Capacitor version (test)... |
|||
# 🔄 Syncing with Capacitor... |
|||
# 🔄 Building iOS app... |
|||
# 🔄 Auto-running iOS app... |
|||
# ✅ iOS app launched successfully! |
|||
# ✅ iOS build completed successfully! |
|||
``` |
|||
|
|||
### Production Mode |
|||
|
|||
```bash |
|||
# Production build and run |
|||
npm run auto-run:prod |
|||
|
|||
# Output: |
|||
# 🔄 Building Android (production)... |
|||
# 🔄 Building iOS (production)... |
|||
# 🔄 Building Electron (production)... |
|||
# |
|||
# ✅ Auto-run completed successfully! 3 platform(s) launched. |
|||
``` |
|||
|
|||
## Comparison: Auto-Run Script vs Build Scripts |
|||
|
|||
### Auto-Run Script (`auto-run.sh`) |
|||
**Best for:** |
|||
- Multi-platform development |
|||
- Quick testing across devices |
|||
- Automated workflows |
|||
- CI/CD integration |
|||
|
|||
**Features:** |
|||
- Smart device detection |
|||
- Multi-platform support |
|||
- Interactive confirmation |
|||
- Error recovery |
|||
|
|||
### Build Scripts with `--auto-run` |
|||
**Best for:** |
|||
- Single platform development |
|||
- Specific build configurations |
|||
- Non-interactive workflows |
|||
- Build customization |
|||
|
|||
**Features:** |
|||
- Platform-specific optimization |
|||
- Build customization options |
|||
- Direct control over build process |
|||
- Integration with existing workflows |
|||
|
|||
## Troubleshooting |
|||
|
|||
### Common Issues |
|||
|
|||
**No devices detected:** |
|||
```bash |
|||
# Check Android devices |
|||
adb devices |
|||
|
|||
# Check iOS devices (macOS only) |
|||
xcrun xctrace list devices |
|||
|
|||
# Check Electron availability |
|||
which electron |
|||
``` |
|||
|
|||
**Build failures:** |
|||
```bash |
|||
# Clean and rebuild |
|||
npm run clean:android |
|||
npm run clean:ios |
|||
npm run clean:electron |
|||
|
|||
# Then retry auto-run |
|||
npm run auto-run |
|||
``` |
|||
|
|||
**Permission issues:** |
|||
```bash |
|||
# Make script executable |
|||
chmod +x scripts/auto-run.sh |
|||
|
|||
# Check ADB permissions (Android) |
|||
adb kill-server |
|||
adb start-server |
|||
``` |
|||
|
|||
### Platform-Specific Issues |
|||
|
|||
**Android:** |
|||
- Ensure ADB is in PATH |
|||
- Enable USB debugging on device |
|||
- Accept device authorization prompt |
|||
- Check device is in "device" state (not "unauthorized") |
|||
|
|||
**iOS:** |
|||
- Requires macOS with Xcode |
|||
- Ensure Xcode command line tools installed |
|||
- Check iOS Simulator is available |
|||
- For real devices: Requires proper certificates |
|||
|
|||
**Electron:** |
|||
- Ensure Electron is installed globally or locally |
|||
- Check Node.js version compatibility |
|||
- Verify build dependencies are installed |
|||
|
|||
### Debug Mode |
|||
|
|||
Enable verbose logging by modifying the script: |
|||
|
|||
```bash |
|||
# Add debug logging to auto-run.sh |
|||
set -x # Enable debug mode |
|||
``` |
|||
|
|||
## Integration with CI/CD |
|||
|
|||
The auto-run script can be integrated into CI/CD pipelines: |
|||
|
|||
```yaml |
|||
# Example GitHub Actions workflow |
|||
- name: Auto-run tests |
|||
run: | |
|||
npm run auto-run:test --auto |
|||
env: |
|||
# Set environment variables for CI |
|||
CI: true |
|||
``` |
|||
|
|||
## Best Practices |
|||
|
|||
### Development Workflow |
|||
1. **Daily development**: Use `npm run auto-run` for quick testing |
|||
2. **Testing**: Use `npm run auto-run:test` before commits |
|||
3. **Production**: Use `npm run auto-run:prod` for final testing |
|||
4. **Single platform**: Use `npm run build:ios:test:run` for focused work |
|||
|
|||
### Device Management |
|||
1. **Keep devices connected**: Reduces detection time |
|||
2. **Use consistent device names**: Helps with identification |
|||
3. **Regular cleanup**: Clear old builds and caches |
|||
|
|||
### Performance Tips |
|||
1. **Use --auto flag**: Skip prompts in automated workflows |
|||
2. **Target specific platforms**: Use `--platform=ios` for faster runs |
|||
3. **Parallel execution**: Script runs platforms in sequence (can be optimized) |
|||
|
|||
## Future Enhancements |
|||
|
|||
### Planned Features |
|||
- **Parallel execution**: Run multiple platforms simultaneously |
|||
- **Device selection**: Choose specific devices when multiple available |
|||
- **Custom build configurations**: Support for custom build modes |
|||
- **Integration with IDEs**: VS Code and other IDE integration |
|||
- **Performance monitoring**: Track build and launch times |
|||
|
|||
### Contributing |
|||
To add new features or fix issues: |
|||
1. Modify `scripts/auto-run.sh` |
|||
2. Update this documentation |
|||
3. Test on multiple platforms |
|||
4. Submit pull request |
|||
|
|||
## Related Documentation |
|||
|
|||
- [iOS Simulator Build and Icons](./ios-simulator-build-and-icons.md) |
|||
- [Android Build Guide](./android-build-guide.md) |
|||
- [Electron Build Guide](./electron-build-guide.md) |
|||
- [Testing Guide](./testing-guide.md) |
@ -0,0 +1,343 @@ |
|||
#!/bin/bash |
|||
# auto-run.sh |
|||
# Author: Matthew Raymer |
|||
# Description: Smart auto-run script that detects devices and automatically launches |
|||
# the appropriate target for test and production builds |
|||
# |
|||
# This script can: |
|||
# - Detect connected Android devices vs emulators |
|||
# - Detect connected iOS devices vs simulators |
|||
# - Automatically launch Electron app |
|||
# - Choose the best available target for each platform |
|||
# |
|||
# Usage: |
|||
# ./scripts/auto-run.sh [--test|--prod] [--platform=ios|android|electron|all] |
|||
# |
|||
# Exit Codes: |
|||
# 0 - Success |
|||
# 1 - No devices found |
|||
# 2 - Build failed |
|||
# 3 - Launch failed |
|||
|
|||
# Exit on any error |
|||
set -e |
|||
|
|||
# Source common utilities |
|||
source "$(dirname "$0")/common.sh" |
|||
|
|||
# Default values |
|||
BUILD_MODE="development" |
|||
PLATFORM="all" |
|||
AUTO_CONFIRM=false |
|||
|
|||
# Parse command line arguments |
|||
while [[ $# -gt 0 ]]; do |
|||
case $1 in |
|||
--test) |
|||
BUILD_MODE="test" |
|||
shift |
|||
;; |
|||
--prod) |
|||
BUILD_MODE="production" |
|||
shift |
|||
;; |
|||
--platform=*) |
|||
PLATFORM="${1#*=}" |
|||
shift |
|||
;; |
|||
--auto) |
|||
AUTO_CONFIRM=true |
|||
shift |
|||
;; |
|||
--help) |
|||
echo "Usage: $0 [--test|--prod] [--platform=ios|android|electron|all] [--auto]" |
|||
echo "" |
|||
echo "Options:" |
|||
echo " --test Build and run in test mode" |
|||
echo " --prod Build and run in production mode" |
|||
echo " --platform=PLATFORM Target platform (ios|android|electron|all)" |
|||
echo " --auto Skip confirmation prompts" |
|||
echo " --help Show this help message" |
|||
exit 0 |
|||
;; |
|||
*) |
|||
log_error "Unknown option: $1" |
|||
exit 1 |
|||
;; |
|||
esac |
|||
done |
|||
|
|||
# Print header |
|||
print_header "TimeSafari Auto-Run" |
|||
log_info "Build mode: $BUILD_MODE" |
|||
log_info "Target platform: $PLATFORM" |
|||
log_info "Auto confirm: $AUTO_CONFIRM" |
|||
|
|||
# Function to detect Android devices |
|||
detect_android_devices() { |
|||
log_step "Detecting Android devices..." |
|||
|
|||
# Check if adb is available |
|||
if ! command -v adb &> /dev/null; then |
|||
log_warn "ADB not found - Android detection skipped" |
|||
return 1 |
|||
fi |
|||
|
|||
# Get list of devices |
|||
local devices_output=$(adb devices 2>/dev/null || echo "") |
|||
local devices=() |
|||
local emulators=() |
|||
|
|||
# Parse device list |
|||
while IFS= read -r line; do |
|||
if [[ $line =~ ^([a-zA-Z0-9.-]+)[[:space:]]+device$ ]]; then |
|||
local device_id="${BASH_REMATCH[1]}" |
|||
|
|||
# Check if it's an emulator (emulator IDs typically contain 'emulator') |
|||
if [[ $device_id == *"emulator"* ]]; then |
|||
emulators+=("$device_id") |
|||
else |
|||
devices+=("$device_id") |
|||
fi |
|||
fi |
|||
done <<< "$devices_output" |
|||
|
|||
# Log results |
|||
if [ ${#devices[@]} -gt 0 ]; then |
|||
log_success "Found ${#devices[@]} real Android device(s): ${devices[*]}" |
|||
fi |
|||
|
|||
if [ ${#emulators[@]} -gt 0 ]; then |
|||
log_success "Found ${#emulators[@]} Android emulator(s): ${emulators[*]}" |
|||
fi |
|||
|
|||
if [ ${#devices[@]} -eq 0 ] && [ ${#emulators[@]} -eq 0 ]; then |
|||
log_warn "No Android devices or emulators found" |
|||
return 1 |
|||
fi |
|||
|
|||
# Return device type and ID |
|||
if [ ${#devices[@]} -gt 0 ]; then |
|||
echo "real:${devices[0]}" |
|||
else |
|||
echo "emulator:${emulators[0]}" |
|||
fi |
|||
} |
|||
|
|||
# Function to detect iOS devices |
|||
detect_ios_devices() { |
|||
log_step "Detecting iOS devices..." |
|||
|
|||
# Check if xcrun is available |
|||
if ! command -v xcrun &> /dev/null; then |
|||
log_warn "xcrun not found - iOS detection skipped" |
|||
return 1 |
|||
fi |
|||
|
|||
# Get list of devices |
|||
local devices_output=$(xcrun xctrace list devices 2>/dev/null || echo "") |
|||
local devices=() |
|||
local simulators=() |
|||
|
|||
# Parse device list |
|||
while IFS= read -r line; do |
|||
# Look for real devices (containing "iPhone" or "iPad" but not "Simulator") |
|||
if [[ $line =~ iPhone|iPad ]] && [[ $line != *"Simulator"* ]]; then |
|||
if [[ $line =~ \(([A-F0-9-]+)\) ]]; then |
|||
local device_id="${BASH_REMATCH[1]}" |
|||
devices+=("$device_id") |
|||
fi |
|||
fi |
|||
|
|||
# Look for simulators |
|||
if [[ $line =~ Simulator ]]; then |
|||
if [[ $line =~ \(([A-F0-9-]+)\) ]]; then |
|||
local simulator_id="${BASH_REMATCH[1]}" |
|||
simulators+=("$simulator_id") |
|||
fi |
|||
fi |
|||
done <<< "$devices_output" |
|||
|
|||
# Log results |
|||
if [ ${#devices[@]} -gt 0 ]; then |
|||
log_success "Found ${#devices[@]} real iOS device(s): ${devices[*]}" |
|||
fi |
|||
|
|||
if [ ${#simulators[@]} -gt 0 ]; then |
|||
log_success "Found ${#simulators[@]} iOS simulator(s): ${simulators[*]}" |
|||
fi |
|||
|
|||
if [ ${#devices[@]} -eq 0 ] && [ ${#simulators[@]} -eq 0 ]; then |
|||
log_warn "No iOS devices or simulators found" |
|||
return 1 |
|||
fi |
|||
|
|||
# Return device type and ID |
|||
if [ ${#devices[@]} -gt 0 ]; then |
|||
echo "real:${devices[0]}" |
|||
else |
|||
echo "simulator:${simulators[0]}" |
|||
fi |
|||
} |
|||
|
|||
# Function to build and run Android |
|||
run_android() { |
|||
local device_info=$1 |
|||
local device_type=$(echo "$device_info" | cut -d: -f1) |
|||
local device_id=$(echo "$device_info" | cut -d: -f2) |
|||
|
|||
log_step "Building and running Android ($device_type: $device_id)..." |
|||
|
|||
# Build the app |
|||
if [ "$BUILD_MODE" = "test" ]; then |
|||
safe_execute "Building Android (test)" "npm run build:android:test" |
|||
elif [ "$BUILD_MODE" = "production" ]; then |
|||
safe_execute "Building Android (production)" "npm run build:android:prod" |
|||
else |
|||
safe_execute "Building Android (development)" "npm run build:android:dev" |
|||
fi |
|||
|
|||
# Run the app |
|||
if [ "$device_type" = "real" ]; then |
|||
log_info "Installing and launching on real device: $device_id" |
|||
safe_execute "Installing APK" "adb -s $device_id install -r android/app/build/outputs/apk/debug/app-debug.apk" |
|||
safe_execute "Launching app" "adb -s $device_id shell am start -n app.timesafari.app/app.timesafari.MainActivity" |
|||
else |
|||
log_info "Launching emulator and installing app" |
|||
safe_execute "Launching app" "npx cap run android" |
|||
fi |
|||
} |
|||
|
|||
# Function to build and run iOS |
|||
run_ios() { |
|||
local device_info=$1 |
|||
local device_type=$(echo "$device_info" | cut -d: -f1) |
|||
local device_id=$(echo "$device_info" | cut -d: -f2) |
|||
|
|||
log_step "Building and running iOS ($device_type: $device_id)..." |
|||
|
|||
# Build the app |
|||
if [ "$BUILD_MODE" = "test" ]; then |
|||
safe_execute "Building iOS (test)" "npm run build:ios:test" |
|||
elif [ "$BUILD_MODE" = "production" ]; then |
|||
safe_execute "Building iOS (production)" "npm run build:ios:prod" |
|||
else |
|||
safe_execute "Building iOS (development)" "npm run build:ios:dev" |
|||
fi |
|||
|
|||
# Run the app |
|||
if [ "$device_type" = "real" ]; then |
|||
log_info "Building and installing on real device: $device_id" |
|||
safe_execute "Building for device" "npm run build:ios:release" |
|||
# Note: For real devices, you'd typically need to use Xcode or fastlane |
|||
log_warn "Real device deployment requires Xcode or fastlane setup" |
|||
else |
|||
log_info "Launching simulator and installing app" |
|||
safe_execute "Launching app" "npx cap run ios" |
|||
fi |
|||
} |
|||
|
|||
# Function to build and run Electron |
|||
run_electron() { |
|||
log_step "Building and running Electron..." |
|||
|
|||
# Build the app |
|||
if [ "$BUILD_MODE" = "test" ]; then |
|||
safe_execute "Building Electron (test)" "npm run build:electron:test" |
|||
elif [ "$BUILD_MODE" = "production" ]; then |
|||
safe_execute "Building Electron (production)" "npm run build:electron:prod" |
|||
else |
|||
safe_execute "Building Electron (development)" "npm run build:electron:dev" |
|||
fi |
|||
|
|||
# Run the app |
|||
log_info "Launching Electron app" |
|||
safe_execute "Launching Electron" "npm run electron:start" |
|||
} |
|||
|
|||
# Main execution |
|||
main() { |
|||
log_info "Starting auto-run at $(date)" |
|||
|
|||
# Detect available platforms |
|||
local android_device="" |
|||
local ios_device="" |
|||
local electron_available=true |
|||
|
|||
# Check Android |
|||
if [ "$PLATFORM" = "all" ] || [ "$PLATFORM" = "android" ]; then |
|||
android_device=$(detect_android_devices) || log_warn "Android not available" |
|||
fi |
|||
|
|||
# Check iOS (only on macOS) |
|||
if [ "$PLATFORM" = "all" ] || [ "$PLATFORM" = "ios" ]; then |
|||
if [ "$(uname)" = "Darwin" ]; then |
|||
ios_device=$(detect_ios_devices) || log_warn "iOS not available" |
|||
else |
|||
log_warn "iOS not available on non-macOS platform" |
|||
fi |
|||
fi |
|||
|
|||
# Check Electron |
|||
if [ "$PLATFORM" = "all" ] || [ "$PLATFORM" = "electron" ]; then |
|||
if ! command -v electron &> /dev/null; then |
|||
log_warn "Electron not available" |
|||
electron_available=false |
|||
fi |
|||
fi |
|||
|
|||
# Show available options |
|||
log_info "Available targets:" |
|||
[ -n "$android_device" ] && log_info " Android: $android_device" |
|||
[ -n "$ios_device" ] && log_info " iOS: $ios_device" |
|||
[ "$electron_available" = true ] && log_info " Electron: available" |
|||
|
|||
# Confirm with user (unless auto mode) |
|||
if [ "$AUTO_CONFIRM" = false ]; then |
|||
echo "" |
|||
read -p "Continue with auto-run? (y/N): " -n 1 -r |
|||
echo "" |
|||
if [[ ! $REPLY =~ ^[Yy]$ ]]; then |
|||
log_info "Auto-run cancelled by user" |
|||
exit 0 |
|||
fi |
|||
fi |
|||
|
|||
# Execute based on platform selection |
|||
local success_count=0 |
|||
|
|||
if [ "$PLATFORM" = "android" ] || [ "$PLATFORM" = "all" ]; then |
|||
if [ -n "$android_device" ]; then |
|||
if run_android "$android_device"; then |
|||
((success_count++)) |
|||
fi |
|||
fi |
|||
fi |
|||
|
|||
if [ "$PLATFORM" = "ios" ] || [ "$PLATFORM" = "all" ]; then |
|||
if [ -n "$ios_device" ]; then |
|||
if run_ios "$ios_device"; then |
|||
((success_count++)) |
|||
fi |
|||
fi |
|||
fi |
|||
|
|||
if [ "$PLATFORM" = "electron" ] || [ "$PLATFORM" = "all" ]; then |
|||
if [ "$electron_available" = true ]; then |
|||
if run_electron; then |
|||
((success_count++)) |
|||
fi |
|||
fi |
|||
fi |
|||
|
|||
# Summary |
|||
if [ $success_count -gt 0 ]; then |
|||
log_success "Auto-run completed successfully! $success_count platform(s) launched." |
|||
else |
|||
log_error "No platforms were successfully launched" |
|||
exit 1 |
|||
fi |
|||
} |
|||
|
|||
# Run main function |
|||
main "$@" |
Loading…
Reference in new issue