If all you've got is Xcode, your only tool is a
XCHammer generates Xcode projects from a Bazel Workspace.
- Complete Bazel Xcode IDE integration
- 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
Build and install to
Pinterest vendors XCHammer.app for reproducibility and simplicity.
Generate using a XCHammerConfig.
xchammer generate <configPath>
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 targets: - "//ios-app:ios-app" projects: "MyProject": paths: - "**"
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.
# WORKSPACE local_repository( name = "xchammer_resources", path = "/Path/To/xchammer.app/Contents/Resources", ) # BUILD.Bazel load("@xchammer_resources//:xcodeproject.bzl", "xcode_project") 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
- make sure Xcode's new build system is enabled
Under Swift and clang compilers, the execution root is written into debug info in object files by default. XCHammer writes an lldbinit file to map this directory to the source root of source code, so that both breakpoints and sources work in Xcode.
To make outputs consistent and debuggable across machines, e.g. with remote
caching, it's recommended to use debug info remapping. Debug info remapping is a
technique that simply remaps absolute paths in debug info to a stable location.
LLDB then is able to map these to the source directory, via a
target.source-map. By default, these Bazel flags are not configured and
require adding additional flags to the build. Generally, these flags should set
.bazelrc for every build.
Clang provides debug info remapping via the
-fdebug-prefix-map flag. For
Objective-C, C, C++, debug info remapping is implemented at the crosstool level.
Configure Bazel to pass these arguments by setting
--copt="DEBUG_PREFIX_MAP_PWD=." or providing a custom crosstool. See setting
for more info.
Starting with Xcode 10.2, Swift provides debug info remapping via the
rules_swift supports the ability to pass the debug
--swiftcopt=-Xwrapped-swift=-debug-prefix-pwd-is-dot to remap debug
info in Swift.
XCHammer will automatically write a compatible remapping in the
HAMMER_USE_DEBUG_INFO_REMAPPING=YES via an
xcconfig. See XCHammer's BUILD
file, for an example of this.
Generating a dSYM for development is not recommended due to the performance hit, and in practice is only required for Instruments.app.
Please find more info about developing XCHammer in The XCHammer FAQ. Pull requests welcome