| 1 | # Building and checking native Docs |
| 2 | |
| 3 | The native editor uses SwiftUI with AppKit/UIKit text controls and a bounded |
| 4 | WASM interpreter for the shared Yjs-compatible CRDT. It does not load a web editor. |
| 5 | |
| 6 | Requirements: Xcode 26, XcodeGen, Swift 6.2+, Node/npm, and Rust with the |
| 7 | `wasm32-unknown-unknown`, `aarch64-apple-darwin`, `x86_64-apple-darwin`, |
| 8 | `aarch64-apple-ios`, `aarch64-apple-ios-sim`, and `x86_64-apple-ios` targets. |
| 9 | The server gate additionally requires the Go version in `go.mod`. |
| 10 | |
| 11 | Run the native gate from the repository root: |
| 12 | |
| 13 | ```sh |
| 14 | native/scripts/check-native.sh |
| 15 | ``` |
| 16 | |
| 17 | It builds the CRDT WASM, runs Rust editor and bounded-host tests, checks native |
| 18 | and browser updates in both directions (including every list-rule reversal delta |
| 19 | and its authoritative snapshot), prepares the Apple XCFramework, and |
| 20 | runs Swift adapter/actor tests. `--core-only` runs the Rust and wire checks on |
| 21 | Linux. CI invokes this through `.amadan/ci.d/20-native`, alongside the existing |
| 22 | server/web gate. `--mutations` additionally proves representative faulty changes |
| 23 | are caught, restoring every changed source and saving logs under |
| 24 | `native/build/mutation-logs`. Do not run mutations concurrently with builds. |
| 25 | |
| 26 | `CARGO` can select a non-default Cargo executable; put its matching Rust toolchain |
| 27 | on `PATH`. If that toolchain needs an explicit LLVM runtime lookup path, set |
| 28 | `DOCS_LLVM_LIBRARY_PATH`. No generated native framework is committed. |
| 29 | |
| 30 | Build individual applications: |
| 31 | |
| 32 | ```sh |
| 33 | native/scripts/build-mac.sh |
| 34 | native/scripts/build-iphone.sh simulator |
| 35 | OFICINA_DEVELOPMENT_TEAM=YOUR_TEAM native/scripts/build-iphone.sh device |
| 36 | ``` |
| 37 | |
| 38 | The suite's `build-native-apps.py` prepares the native framework and Xcode projects |
| 39 | once, then runs Docs and Sheets builds concurrently with separate platform logs |
| 40 | and a combined `results.json`. Its default targets are Mac and iOS Simulator; |
| 41 | `--platforms mac simulator device` also builds signed device applications when |
| 42 | `OFICINA_DEVELOPMENT_TEAM` is set. It does not install or publish applications. |
| 43 | |
| 44 | Native UI tests use fresh local credentials and isolated databases. See |
| 45 | [REVIEW.md](REVIEW.md) for their runner, exact evidence, and untested behavior. |
| 46 | Performance measurements and their limits are in |
| 47 | [benchmarks/README.md](benchmarks/README.md). |
| 48 | |