iOS and Bazel at Reddit: A Journey

This page summarizes the projects mentioned and recommended in the original post on /r/RedditEng

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • rules_ios

    Bazel rules for building iOS applications and frameworks

  • Finally, we are to a place where we have a reliable/truthful representation of targets to access in Bazel. As alluded to in the State of the World section, Reddit has many frameworks that combine Swift and Objective-C to deliver functionality and this meant that we needed a Bazel ruleset that supported these mixed language frameworks. Since Bazel’s “default” rules are built to handle single-language targets, we tested a few open source options and ended up selecting https://github.com/bazel-ios/rules_ios. The rules_ios ruleset is used by a handful of other big players in the mobile industry and has an active open source community. Fortunately for Reddit, rules_ios also comes with a CocoaPods plugin that makes it easy to generate Bazel’s BUILD.bazel files from a CocoaPod setup called https://github.com/bazel-ios/cocoapods-bazel. The combination of these two items was the last piece of the puzzle to add “real” Bazel representations for our:

  • cocoapods-bazel

    A Cocoapods plugin for automatically generating Bazel BUILD files

  • Finally, we are to a place where we have a reliable/truthful representation of targets to access in Bazel. As alluded to in the State of the World section, Reddit has many frameworks that combine Swift and Objective-C to deliver functionality and this meant that we needed a Bazel ruleset that supported these mixed language frameworks. Since Bazel’s “default” rules are built to handle single-language targets, we tested a few open source options and ended up selecting https://github.com/bazel-ios/rules_ios. The rules_ios ruleset is used by a handful of other big players in the mobile industry and has an active open source community. Fortunately for Reddit, rules_ios also comes with a CocoaPods plugin that makes it easy to generate Bazel’s BUILD.bazel files from a CocoaPod setup called https://github.com/bazel-ios/cocoapods-bazel. The combination of these two items was the last piece of the puzzle to add “real” Bazel representations for our:

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • bazel-diff

    Performs Bazel Target Diffing between two revisions in Git, allowing for Test Target Selection and Selective Building

  • From the CI perspective, downloading artifacts from a remote cache offers drastic reductions in builds that run through Bazel by avoiding duplicated work. There’s no doubt that this is great all by itself. But, it’s even better to avoid building/downloading/executing parts of your Bazel workspace that haven’t changed. In general, this is called “test selection” and, fortunately, there are open source implementations that are designed to work with Bazel like https://github.com/Tinder/bazel-diff. This approach has offered wonderful improvements to CI build/test times even without a powerful remote cache implementation.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts