iOS and Bazel at Reddit: A Journey

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

Our great sponsors
  • InfluxDB - Build time-series-based applications quickly and at scale.
  • Zigi - The context switching struggle is real
  • SonarLint - Clean code begins in your IDE with SonarLint
  • Scout APM - Truly a developer’s best friend
  • 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:

  • InfluxDB

    Build time-series-based applications quickly and at scale.. InfluxDB is the Time Series Data Platform where developers build real-time applications for analytics, IoT and cloud-native services in less time with less code.

  • 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