This guide explains how to build OpenMind from the command line using the provided build automation tools.
- macOS 14.0 or later
- Xcode 15.0 or later
- Command Line Tools installed (
xcode-select --install)
# Initial setup (first time only)
make setup
# Build the app
make build
# Run tests
make test
# Build and run
make devmake help- Show all available commandsmake setup- Install dependencies and configure the projectmake build- Build the app for simulatormake device- Build the app for physical devicemake test- Run all tests with coveragemake clean- Clean all build artifacts
make lint- Run SwiftLint to check code stylemake format- Auto-format code with SwiftFormatmake analyze- Run static analysis
make docs- Generate API documentation with Jazzy
make archive- Create a release archivemake release- Build and export for App Store
make dev- Format, lint, and build (quick development cycle)make run- Build and launch in simulator
For more control over the build process:
# Debug build for simulator
./Scripts/build.sh debug simulator
# Release build for device
./Scripts/build.sh release deviceThe build script provides:
- Detailed logging with color output
- Build time tracking
- Automatic dependency resolution
- Post-build validation
- Optional simulator installation
For comprehensive testing:
# Run all tests
./Scripts/test.sh all
# Run only unit tests
./Scripts/test.sh unit
# Run only UI tests
./Scripts/test.sh ui
# Run performance tests
./Scripts/test.sh performance
# Specify custom device
./Scripts/test.sh all "iPhone 15 Pro"The test script provides:
- Test result collection
- Code coverage reporting
- HTML report generation
- Test failure tracking
# List available schemes
xcodebuild -project OpenMind.xcodeproj -list
# Build for simulator
xcodebuild build \
-project OpenMind.xcodeproj \
-scheme OpenMind \
-destination "platform=iOS Simulator,name=iPhone 15"
# Build for device
xcodebuild build \
-project OpenMind.xcodeproj \
-scheme OpenMind \
-destination "generic/platform=iOS"# Run unit tests
xcodebuild test \
-project OpenMind.xcodeproj \
-scheme OpenMind \
-destination "platform=iOS Simulator,name=iPhone 15" \
-enableCodeCoverage YES
# Run specific test class
xcodebuild test \
-project OpenMind.xcodeproj \
-scheme OpenMind \
-only-testing:OpenMindTests/LayoutEngineTests# Generate coverage report
xcrun xccov view --report build/TestResults/Coverage.xcresult
# Export coverage as JSON
xcrun xccov view --report --json build/TestResults/Coverage.xcresult > coverage.json# Create archive
xcodebuild archive \
-project OpenMind.xcodeproj \
-scheme OpenMind \
-archivePath build/OpenMind.xcarchive
# Export for App Store
xcodebuild -exportArchive \
-archivePath build/OpenMind.xcarchive \
-exportPath build/Export \
-exportOptionsPlist Scripts/ExportOptions.plistname: Build and Test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Select Xcode
run: sudo xcode-select -s /Applications/Xcode.app
- name: Setup
run: make setup
- name: Build
run: make build
- name: Test
run: make test
- name: Upload coverage
uses: codecov/codecov-action@v3
with:
file: build/Coverage/combined_coverage.jsonCreate a Fastfile for advanced automation:
default_platform(:ios)
platform :ios do
desc "Build and test"
lane :test do
scan(
project: "OpenMind.xcodeproj",
scheme: "OpenMind",
devices: ["iPhone 15"],
code_coverage: true
)
end
desc "Build for release"
lane :release do
build_app(
project: "OpenMind.xcodeproj",
scheme: "OpenMind",
export_method: "app-store"
)
end
end-
SwiftLint/SwiftFormat not found
brew install swiftlint swiftformat
-
Module not found errors
xcodebuild -resolvePackageDependencies
-
Simulator not found
xcrun simctl list devices
-
Code signing issues
- Ensure you have a valid development team set in the project
- Run
make setupto configure signing
# Verbose build output
xcodebuild build -project OpenMind.xcodeproj -scheme OpenMind -verbose
# Show build settings
xcodebuild -showBuildSettings -project OpenMind.xcodeproj -scheme OpenMind
# Clean derived data
rm -rf ~/Library/Developer/Xcode/DerivedData/OpenMind-*- Parallel builds: Already enabled in the project
- Incremental builds: Use derived data path consistently
- Build time optimization:
# Analyze build time xcodebuild build -showBuildTimingSummary
Edit Scripts/ExportOptions.plist for custom export options.
DERIVED_DATA_PATH- Custom derived data locationBUILD_DIR- Custom build output directoryXCODE_SCHEME- Override default schemeXCODE_CONFIGURATION- Override build configuration
# Format and lint before building
swiftformat . && swiftlint lint --strict && make build
# Generate documentation after building
make build && make docs
# Full CI simulation
make clean && make format && make lint && make build && make testCurrent version: v0.2.0
The build system automatically handles:
- Dependency resolution
- Code signing (with valid certificates)
- Build number incrementing (when using release scripts)
- Symbol generation for crash reporting