Build better software to build software better
Slack cut the 60-minute build pipeline for Quip and Slack Canvas's backend by applying classic software engineering principles (hermetic, idempotent, granular units of work and clean separation of concerns) before adopting Bazel. A dependency edge from the built Python backend into the TypeScript frontend build zeroed the cache hit rate and cost about 35 minutes per build. The team untangled build code from application code, rewrote orchestration in Starlark, cut Python build scripts down to the standard library only, and used a Rust diffing tool to verify the new artifacts matched the old ones. The core lesson is that Bazel's caching and parallelism only pay off once the build graph is acyclic, well-defined and finely granular.
Related posts
- Scaling Slack’s Mobile Codebases: Modularization
Slack Engineering mediumAdeptSlack split its monolithic iOS and Android app targets into owned Feature, Service and Library modules with strict linking rules, such as interface/implementation pairs on iOS, to cut build times, untangle dependencies and clarify code ownership. On iOS, adopting Bazel made module creation easy, eliminated project-file merge conflicts, enabled static linking that improved pre-main launch time, and powered code generation for modules, CoreData models and feature flags. On Android, Slack abandoned a per-module Dagger 'graph of graphs' in favor of Square's Anvil, cut KAPT usage by moving to KSP, Moshi and Kotlin data classes, and enabled Gradle configuration caching, saving 20-45s on builds after configuration changes.
- Optimizing Our E2E Pipeline
Slack Engineering mediumAdeptSlack cut redundant frontend builds in its monorepo E2E pipeline by using `git diff` three-dot notation against `main` to detect whether a PR touches frontend code, and when it doesn't, serving a recent production frontend build from S3 through an internal CDN instead of rebuilding. The check and artifact lookup take under 3 seconds across 100,000+ tracked files. Frontend build frequency dropped 60%, average build time fell from ~5 to ~2 minutes (from ~10 minutes at the start of the year, counting an earlier Webpack upgrade), several terabytes of monthly S3 storage were saved, and E2E test flakiness reached its lowest measured level.
- Mobile Developer Experience at Slack
Slack Engineering mediumAdeptA dedicated mobile Developer Experience team grew from 3 to 8 engineers and cut CI feedback time and failure rates by targeting the pain points that surveys, NPS and metrics like time to merge showed hurt developers most. iOS test time fell from about 50 minutes to an average of 9 by moving from Xcodebuild to Bazel with disk caching and bazel-diff, so only affected targets are tested. On Android, test sharding (in-house Fuel, later Flank) cut runs from 50+ minutes to under 20, and replacing Calabash with Espresso took suites from ~350 to ~60 minutes. Further gains came from auto-suppressing flaky tests (failure rate 57% to 4%), migrating from Jenkins to Buildkite (CI stability ~87% to 95%, TTM down 41%), generating Xcode projects with Xcodegen to avoid merge conflicts, and adopting a merge queue.
- Build faster with Buck2: Our open source build system
Meta Engineering mediumAdeptBuck2 is Meta's from-scratch rewrite of Buck, open sourced with a Rust core and all language rules written in Starlark, and it completes builds about twice as fast as Buck1 internally. Its speed comes from a single incremental dependency graph held by a persistent daemon instead of separate target/action graph phases, plus Bazel-compatible remote execution and integration with virtual file systems via Watchman and Sapling. New rule primitives make complex patterns safe and efficient: dynamic_output lets rules run tools like ocamldep and wire dependencies from their output, and transitive-sets (tsets) avoid O(n²) memory for C++ link closures. The open source release is nearly identical to Meta's internal version and is aimed mainly at moderately sized multi-language projects.
- Improving machine learning iteration speed with faster application build and packaging
Meta Engineering mediumAdeptMeta cut ML engineers' build and packaging overhead by double-digit percentages by tackling build non-determinism, pruning dependencies, and replacing monolithic XAR executables with an incremental Content Addressable Filesystem (CAF). Non-determinism from compilers and build rules is mitigated inside the Remote Execution service that Buck2 sends nearly all build actions to, so stable warm revisions can reuse cached outputs. CAF describes each executable as a flat manifest of content digests, skips uploads already in CAS, and fetches only missing content via per-host CAS daemons that share data peer-to-peer over Owl. Btrfs compression and copy-on-write keep on-disk size close to XAR while sharing files across executables. Planned next steps are lazy on-demand fetching (LazyCAF) and putting all ML engineers on uniform revisions to raise cache hit rates.