Fork me on GitHub

Alex Rupérez

Published: 22 Jul 15:19
I starred pinterest/xchammer at GitHub.
XCHammer generates Xcode projects from a Bazel Workspace.
View on GitHub



If all you've got is Xcode, your only tool is a 🔨

Build Status

XCHammer generates Xcode projects from a Bazel Workspace.

  • Complete Bazel Xcode IDE integration
    • Bazel build and run via Xcode
    • Xcode test runner integration
    • Full LLDB support without DSYM generation
    • Autocompletion and indexing support
    • Renders Bazel's progress in Xcode's progress bar
    • Optionally import index's via index-import with Run Scripts
    • Customize Bazel invocations for Xcode
  • Focused Xcode projects
  • Xcode build Bazel targets without Bazel
  • Optionally Bazel build Xcode projects
    • Define and compose Xcode projects in Skylark
    • Builds reproducible and remote cacheable projects
  • Automatically updates Xcode projects


Note: this README is intended to be a minimal, quick start guide. For a comprehensive explanation of XCHammer, see Introducing XCHammer and The XCHammer FAQ


Build and install to /usr/local/bin/

make install

Pinterest vendors for reproducibility and simplicity.


Generate using a XCHammerConfig.

xchammer generate <configPath>

Configuration Format

XCHammer is configured via a yaml representation of XCHammerConfig.

The configuration describes projects that should be generated.

# Generates a project containing the target ios-app
    - "//ios-app:ios-app"

            - "**"

See XCHammerConfig.swift for detailed documentation of the format.

To learn about how Pinterest uses XCHammer with Bazel locally check out Pinterest Xcode Focused Projects.


Bazel build Xcode projects

XCHammer additionally supports Bazel building Xcode projects, which enables remote caching and other features. This feature is experimental.

    name = "xchammer_resources",
    path = "/Path/To/",

# BUILD.Bazel
load("@xchammer_resources//:xcodeproject.bzl", "xcode_project")
    name = "MyProject",
    targets = [ "//ios-app:ios-app" ],
    paths = [ "**" ],

Xcode progress bar integration

XCHammer provides a path to optionally integrate with Xcode's build system and progress bar.

  • Install support for Xcode's progress bar for Xcode 11
xchammer install_xcode_build_system
  • add --build_event_binary_file=/tmp/bep.bep to your .bazelrc
  • make sure Xcode's new build system is enabled


Please find more info about developing XCHammer in The XCHammer FAQ. Pull requests welcome 💖.