IMPORTANT: The Bazel docs have moved! Please update your bookmark to https://bazel.build/rules/lib/apple_platform
You can read about the migration, and let us know what you think.
Extensions >
API reference >
apple_platform
apple_platform
Corresponds to Xcode's notion of a platform as would be found inXcode.app/Contents/Developer/Platforms
. Each platform represents an Apple platform type (such as iOS or tvOS) combined with one or more related CPU architectures. For example, the iOS simulator platform supports x86_64
and i386
architectures.Specific instances of this type can be retrieved from the fields of the apple_common.platform struct:
apple_common.platform.ios_device
apple_common.platform.ios_simulator
apple_common.platform.macos
apple_common.platform.tvos_device
apple_common.platform.tvos_simulator
apple_common.platform.watchos_device
apple_common.platform.watchos_simulator
More commonly, however, the apple configuration fragment has fields/methods that allow rules to determine the platform for which a target is being built.
Example:
p = apple_common.platform.ios_device print(p.name_in_plist) # 'iPhoneOS'
Members
is_device
bool apple_platform.is_deviceReturns
True
if this platform is a device platform or False
if it is a simulator platform.
name_in_plist
string apple_platform.name_in_plistThe name of the platform as it appears in the
CFBundleSupportedPlatforms
entry of an Info.plist file and in Xcode's platforms directory, without the extension (for example, iPhoneOS
or iPhoneSimulator
).This name, when converted to lowercase (e.g.,
iphoneos
, iphonesimulator
), can be passed to Xcode's command-line tools like ibtool
and actool
when they expect a platform name.
platform_type
apple_platform_type apple_platform.platform_typeReturns the platform type of this platform.