Developer Environment Setup
To ensure that everything can be developed properly in parallel, we use a monorepo structure. This, combined with CI, will ensure that changes in the core must be immediately reflected in platform code like Apple and Android.
Standard build workflows
We use just to standardize workflows. This makes it easy to discover and run workflows locally, and CI dogfoods it, preventing most cases of local vs CI drift. You can develop without this, but there are packages available for every major OS, so we strongly recommend using it.
You can see all recipes by running just --list or even simply just
(the default recipe prints out the list).
Platform-specific setup
Let’s look at what’s involved to get hacking on each platform.
Rust (common)
- Install Rust.
If at all possible, install
rustup. We use rust-toolchain.yml to synchronize the toolchain and install targets automatically (otherwise you will need to manage toolchains manually). - Open the cargo workspace (
common/) in your preferred editing environment.
The Rust project is a cargo workspace, and nothing beyond the above should be needed to start hacking! Make some changes and run the tests!
Rust recipes are usually named common, e.g. build-common or test-common.
PR checklist
- Before pushing, run
just format-common(orjust format-all). - Run the test suite with
just test-common. - Bump the version on the Ferrostar Cargo.toml at
common/ferrostar/Cargo.toml(if necessary). If you forget to do this and make breaking changes, CI will let you know. You can check this locally withjust check-semver(requires that cargo-semver-checks is installed).
Web
- Install
wasm-pack:
cargo install wasm-pack
- Build the WASM package for the core:
just build-web
3. Run a local dev server or do a release build:
```shell
# This will start a local web server for the demo app with hot reload
just run-web-dev
PR checklist
- Run
just format-web(orjust format-all) to ensure formatting is standardized. This also runs a linter and auto-fixes anything that can be mechanically addressed. - Run
just test-webto ensure everything builds.
iOS
- Install the latest version of Xcode.
- Install the Xcode Command Line Tools.
xcode-select --install
- Install
swiftformat. - Since you’re developing locally, set
let useLocalFramework = trueinPackage.swift. (TODO: Figure out a way to extract this so it doesn’t get accidentally committed.) - Run the iOS build script:
cd common
just build-ios
IMPORTANT: every time you make changes to the common core,
you will need to run build-ios!
We want to integrate this into the Xcode build flow in the future,
but at the time of this writing,
it is not possible with the Swift package flow.
Further, the “normal” Xcode build flow always assumes xcframeworks can’t change during build,
so it processes them before any other build rules.
Given these limitations, we opted for a shell script until further notice.
If you do not have access to a Mac, you can run ./build-ios.sh --ffi-only
to regenerate the UniFFI bindings without invoking xcodebuild.
- Open the Swift package in Xcode. (NOTE: Due to the quirks of how SPM is designed, Package.swift must live in the repo root. This makes the project view in Xcode slightly more cluttered, but there isn’t much we can do about this given how SPM works.)
PR checklist
- Run
just format-apple(orjust format-all) to automatically fix any formatting issues. - Ensure that all tests pass with
just test-ios.
Android
- Install Android Studio (NOTE: We assume you are using a recent version no more than ~a month out of date).
- Install cargo-ndk to allow gradle to build the local library
libferrostar.soandlibuniffi_ferrostar.so. With cargo-ndk installed you can load and sync Android Studio then build the demo app allowing gradle to automatically build what it needs.
cargo install cargo-ndk
- Ensure that the latest NDK is installed
(refer to the
ndkVersionnumber incore/build.gradleand ensure you have the same version available). This is easiest to install via Android Studio’s SDK Manager (under SDK Tools > NDK). - Open the Gradle workspace (‘android/’) in Android Studio. Gradle builds automatically ensure the core is built, so there are no funky scripts needed as on iOS.
- (Optional) If you want to use Maven local publishing to test…
- Bump the version number to a
SNAPSHOTinbuild.gradle. - run
./gradlew publishToMavenLocal -Pskip.signing. - Reference the updated version number in the project, and ensure that
mavenLocalis one of therepositories.
- Bump the version number to a
PR checklist
- Run
just format-android(orjust format-all) before committing to ensure consistent formatting. - If you changed anything UI related, you may need to record updated UI snapshots with
just record-android-snapshots. just test-androidwill run the full test suite, but beware this can take some time. Connected checks via an emulator/device are the slow part. You MUST have an emulator/device available; we don’t start one for you.