Minimal setup for .xcodeproj
with the bazel build system
. Xcode project
is generated using rules_xcodeproj
$ git clone --recursive https://github.com/pepeunlimited/xcodeproj-bazel.git
Install bazelisk via homebrew
$ brew install bazelisk
Check that you have installed and configured xcodebuild. If you're not download
Xcode
Install the Command Line Tools
$ xcode-select --install
Open the Xcode after installation at least once because it executes configures for macOS and licence agreements during first launch.
$ /usr/bin/xcodebuild -version
$ sudo xcode-select -s /Applications/Xcode.app
If you still get error, try to agree license.
$ sudo xcodebuild -license
Test that bazel should be able to build iOS project with the Bazel
$ bazel build //HelloWorld/iOS:HelloWorld
$ which bazel
Since Homebrew v3.0.0, the default prefix is different depending on the chip architecture. The defaults are the following:
on Apple silicon
/opt/homebrew
on Intel
/usr/local
LaunchScreen.storyboard
is required to be configured, otherwise UIScreen.main.bounds
and windowScene.coordinateSpace.bounds
causes misbehavior for application.
Generate .xcodeproj
using the buildbuddy-io/rules_xcodeproj
$ bazel run //HelloWorld/iOS:xcodeproj
Open the Xcode
$ open $SRCROOT/HelloWorld/iOS/helloworld-ios.xcodeproj
Build the iOS
application
$ bazel build //HelloWorld/iOS:HelloWorld
Run the iOS
application
$ bazel run //HelloWorld/iOS:HelloWorld
TODO
Build the SharedKit
swift_test
$ bazel build //submodules/SharedKit:SwiftXCTest
Run the SharedKit
swift_test
$ bazel test //submodules/SharedKit:SwiftXCTest --macos_minimum_os=13.5.2
Build OSExtension
$ bazel build //submodules/OSExtension:OSExtension
Build the HelloWorldUI
ios_unit_test
$ bazel build //submodules/HelloWorldUI:XCUnitTestSuite
Run the HelloWorldUI
ios_unit_test
$ bazel test //submodules/HelloWorldUI:XCUnitTestSuite
Clean
$ bazel clean --expunge
Boot
$ xcrun simctl boot "iPhone 14"
Open Simulator.app
$ open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app
Failed to start launchd_sim: could not bind to session
See the list of running simulators
$ xcrun simctl list
View the log stream on console
$ xcrun simctl spawn '5A709945-ED74-45F3-A248-AA289FE92497' log stream --debug --predicate 'subsystem == "com.pepeunlimited.helloworld"'
xcrun --toolchain swift sourcekit-lsp --help
how-coupled-is-sourcekit-lsp-to-spm
export-compile-commands.json
vscode-env
$ brew install swiftlint
¢ swiftlint lint submodules/HelloWorldUI/Sources/FeedViewController.swift --no-cache --fix --format
api-design-guidelines
.swiftlint.yml
This documentation is collected from rulesets in the bazelbuild GitHub org
bazelbuild/rules_apple
bazelbuild/rules_swift
bazelbuild/apple_support
bazelbuild/bazel-skylib
bazel.build/command-line-reference
buildbuddy-io/rules_xcodeproj
Bazel Tutorial: Build an iOS App
Migrating from Xcode to Bazel
Building with Bazel
ios_and_bazel_at_reddit_a_journey
migrating-ios-project-to-bazel-a-real-world-experience
google-mediapipe-examples-ios
Telegram-iOS
liuliu/dflat
wendyliga/simple_bazel
TulsiGeneratorIntegrationTests
iOS Dynamic vs. Static Library / Framework
.imageset
xcodeproj-bazel is released under the MIT license. See LICENSE
for details.