Once iOS projects get large enough, Xcode and its default build system become a bottleneck. Bazel, a build system by Google, is able to address some of these shortcomings.
tool similar to Make, Maven, and Gradle. It uses a human-readable, high-level build language. Bazel supports projects in multiple languages and builds outputs for multiple platforms. Bazel supports large codebases across multiple repositories, and large numbers of users. — Bazel documentation
are primarily of two types: files and rules All files in the directory of/below the package's BUILD, excluding those in sub-packages, are contained in the package Target labels include package names: App defined in ./X/Y/BUILD has the label //X/Y:App
recent build will overwrite some outputs Sometimes cleaned up automatically (resides in /tmp) bazel clean deletes it bazel clean --expunge deletes external cache
be on your local machine Largest benefit: pulling master is no longer a full rebuild Smaller benefit: same thing for running someone’s PR Warning: it's possible to poison the cache, best if only CI writes, but everyone reads
build --experimental_repository_cache_hardlinks # Cache action graph and CAS in a local disk cache build --disk_cache=~/.cache/bazel-target # Don't download cached items # Drastically speeds up 100% cached situation build --remote_download_minimal
environment variables changing build --incompatible_strict_action_env --action_env=PATH=/usr/bin:/bin # Try to prevent cache poisoning build --experimental_guard_against_concurrent_changes # Cache checks/downloads require more jobs to be efficient build --jobs=200 # Faster remote cache hashing build --experimental_multi_threaded_digest # Keep more of the cache digests in memory build --cache_computed_file_digests=500000
--config=Debug # Build, but don't run, manual tests test:ci --test_tag_filters=-manual # Point out, but still continue after, flakey tests test:ci --flaky_test_attempts=3 # Collect all test results, even if some fail test:ci --test_keep_going
build build:bullflight --config=Release # Allow code to condition on Bullflight build:bullflight --swiftcopt=-DBULLFLIGHT # SwiftSupport is only needed for the App Store build:bullflight --define=apple.package_swift_support=no # App Store distribution is a Release build build:appstore --config=Release