rules_xcodeproj supports two build modes that determine what happens when you press ⌘B (or click Run) in Xcode. The choice of build mode affects build speed, artifact hermeticity, Xcode feature support, and which parts of the toolchain are responsible for compilation. Understanding the trade-offs of each mode helps you choose the right one for your team and workflow.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/MobileNativeFoundation/rules_xcodeproj/llms.txt
Use this file to discover all available pages before exploring further.
- Build with Bazel
- Build with Xcode
Build with Bazel (BwB) is the default mode. When you trigger a build in Xcode, Xcode invokes
bazel build to perform the actual compilation. Xcode’s own build system is stubbed out — it acts as an orchestrator and UI layer, but Bazel does all the work.Key characteristics:- Bazel produces hermetic, reproducible outputs
- Serialized diagnostics (warnings and errors) are replayed into Xcode, so they appear inline in the editor and persist between builds
- Fix-its and warning highlights clear correctly when the underlying code is fixed
- SwiftUI Previews are fully supported
- Remote caching and remote execution work transparently
- The output layout mirrors
bazel-out/, giving you artifacts that are identical to a command-linebazel build
Feature comparison
| Feature | Build with Bazel | Build with Xcode |
|---|---|---|
| Native Xcode build graph | ❌ | ✅ |
| Hermetic Bazel outputs | ✅ | Partial |
| Inline warnings & fix-its | ✅ | ✅ |
| SwiftUI Previews | ✅ | ✅ |
| Remote caching | ✅ | Partial |
| Code coverage | ✅ | ✅ (with config) |
| Archive action | ❌ | Limited |
| Supports new Xcode features immediately | Depends on ruleset | ✅ |
Identical to bazel build output | ✅ | Partial |
Switching between modes
The recommended approach for teams that need both modes is to declare dedicated generation targets in aBUILD file:
BUILD
Archiving and distribution
Diagnostics in Build with Bazel mode
One of the most impactful features of Build with Bazel mode is serialized diagnostics replay. After Bazel completes a build, rules_xcodeproj replays the diagnostics (warnings and errors) that Bazel serialized during compilation back into Xcode’s issue navigator and inline editor annotations. This means:- Warnings from previous builds persist in the issue navigator even if you haven’t re-compiled that file
- Warnings correctly disappear when you fix the underlying issue and rebuild
- Fix-its work exactly as they do in a native Xcode build
.dia (serialized diagnostics) files during compilation, which rules_xcodeproj then feeds back to Xcode after the bazel build run completes.