I'm preparing a list of Getting Started with Bazel + iOS articles and talks for internal usage. Here's what I have in my mind as foundational for me/the community.
The general Bazel docs are a great place to start:
- The overview and vision lays out the highest-level overview of what Bazel is about.
- Bazel visibility is an important concept (especially since it, generally, puts it a level above what Xcode allows). This will help explain the package concept a bit too.
- Bazel query allows you to ask the build system questions about the build. This is essential in platform work to easily answer questions like "what depends on Foo?", "is there a relationship between Foo and Bar?", and on and on.
- Bazel aspects are a powerful (and honestly a bit obtuse until you write a few) concept that unlocks special graph augmentations within rules (like gathering transitive info, propagating info, etc.).
- Flare Build's wrote about the relationship between iOS and Bazel (iOS ❤️ Bazel). It covers a lot of the questions that need to be answered when making the transition.
- Benjamin Peterson's (previously at Dropbox) talk on test selection at BazelCon (it's what inspired bazel-diff).
- Keith Smiley and Dave Lee's postmortem on the migration of Lyft's iOS codebase to Bazel (similar to my post for Reddit but definitely more groundbreaking 😜).
What rulesets are folks in the iOS community using?
- The default Google rules set the foundation. rules_apple and rules_swift for building iOS/macOS bits. xctestrunner for running tests on iOS devices or simulators.
- rules_ios (from Square, LinkedIn, and others) easily builds mixed language (Swift, Objective-C, etc.) targets. rules_apple and rules_swift are definitely geared toward a single language per target and rules_ios unlocks "easy" polyglot targets similar to Xcode. I view rules_apple_line (from Line) as a precursor (sorta) to rules_ios. I'm not sure how much it's used in the community at this point.
- For Xcode project generation, the tools are somewhat vast. rules_xcodeproj (from BuildBuddy) is a new tool meant to be the de facto way teams get Bazel representations into Xcode. xchammer (from Pinterest) and tulsi (from Google) have been around for a lot longer. Lots of teams end up using xcodegen with some internal scripts to do generation as well.
What else would you add to this list?
A new addition to the space from BuildBuddy and Brentley as well: https://www.buildbuddy.io/blog/how-to-migrate-an-ios-app-to-bazel/
Nice work Matt Robinson