Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Apple support for Bazel rules

License

NotificationsYou must be signed in to change notification settings

bazelbuild/apple_support

This repository contains theApple CC toolchain,Apple relatedplatforms andconstraints definitions, and small helper functionsfor rules authors targeting Apple platforms.

If you want to build iOS, tvOS, visionOS, watchOS, or macOS apps, userules_apple.

If you want to build Swift userules_swift.

Seethe documentation for the helper rules provided by thisrepository.

Installation

Copy theMODULE.bazel orWORKSPACE snippets fromthe releasespage into yourproject.

Toolchain setup

The Apple CC toolchain in this repository provides toolchains forbuilding for Apple platforms besides macOS. Since Bazel 7 this toolchainis required when targeting those platforms.

The toolchain supports using a full Xcode installation or the XcodeCommand Line Tools.

Bazel 7+ Setup

For Bazel 7+ the only setup that is required is to haveapple_supportin yourMODULE.bazel (even if you're not referencing it directly) orWORKSPACE, which you can copy fromthe releasespage into yourproject.

If you also depend onrules_cc,apple_support must comeaboverules_cc in yourMODULE.bazel orWORKSPACE file because Bazelselects toolchains based on which is registered first.

Toolchain configuration

There are many different flags you can flip to configure how thetoolchain works. Here are some of the more commonly useful ones:

  • SettingDEVELOPER_DIR in the environment. This is recommended sothat the toolchain can be invalidated when theDEVELOPER_DIRchanges, which ensures that toolchain binaries will be rebuilt withthe new version of Xcode so that caches are correctly shared acrossmachines.
  • SettingBAZEL_ALLOW_NON_APPLICATIONS_XCODE=1 in the environment (orusing--repo_env) allows the toolchain to discover Xcode versionsoutside of the/Applications directory to avoid header inclusionerrors from bazel. This is not enabled by default because/Applications is the standard directory, and this improves toolchainsetup performance.

[8]ページ先頭

©2009-2025 Movatter.jp