blob: 969538d4b11a5718722d2c5c8eba30e6c50b27c0 [file] [edit]
---
title: 'apple\_common'
---
Functions for Starlark to access internals of the apple rule implementations.
## Members
* [apple\_host\_system\_env](#apple_host_system_env)
* [apple\_toolchain](#apple_toolchain)
* [dotted\_version](#dotted_version)
* [platform](#platform)
* [platform\_type](#platform_type)
* [target\_apple\_env](#target_apple_env)
* [XcodeProperties](#XcodeProperties)
* [XcodeVersionConfig](#XcodeVersionConfig)
## apple\_host\_system\_env
```
dict apple_common.apple_host_system_env(xcode_config)
```
Returns a [dict](/versions/9.0.0/rules/lib/core/dict) of environment variables that should be set for actions that need to run build tools on an Apple host system, such as the version of Xcode that should be used. The keys are variable names and the values are their corresponding values.
### Parameters
| Parameter | Description |
| --- | --- |
| `xcode_config` | required A provider containing information about the Xcode configuration. |
## apple\_toolchain
```
unknown apple_common.apple_toolchain()
```
Utilities for resolving items from the apple toolchain.
## dotted\_version
```
DottedVersion apple_common.dotted_version(version)
```
Creates a new [DottedVersion](/versions/9.0.0/rules/lib/builtins/DottedVersion) instance.
### Parameters
| Parameter | Description |
| --- | --- |
| `version` | [string](/versions/9.0.0/rules/lib/core/string); required The string representation of the DottedVersion. |
## platform
```
struct apple_common.platform
```
An enum-like struct that contains the following fields corresponding to Apple platforms:
* `ios_device`
* `ios_simulator`
* `macos`
* `tvos_device`
* `tvos_simulator`
* `visionos_device`
* `visionos_simulator`
* `watchos_device`
* `watchos_simulator`
These values can be passed to methods that expect a platform, like [XcodeVersionConfig.sdk\_version\_for\_platform](/versions/9.0.0/rules/lib/providers/XcodeVersionConfig#sdk_version_for_platform).
## platform\_type
```
struct apple_common.platform_type
```
An enum-like struct that contains the following fields corresponding to Apple platform types:
* `ios`
* `macos`
* `tvos`
* `visionos`
* `watchos`
These values can be passed to methods that expect a platform type.
## target\_apple\_env
```
dict apple_common.target_apple_env(xcode_config, platform)
```
Returns a `dict` of environment variables that should be set for actions that build targets of the given Apple platform type. For example, this dictionary contains variables that denote the platform name and SDK version with which to build. The keys are variable names and the values are their corresponding values.
### Parameters
| Parameter | Description |
| --- | --- |
| `xcode_config` | required |
| `platform` | required |
## XcodeProperties
```
Provider apple_common.XcodeProperties
```
The constructor/key for the `XcodeVersionProperties` provider.
If a target propagates the `XcodeVersionProperties` provider, use this as the key with which to retrieve it. Example:
```
dep = ctx.attr.deps[0]
p = dep[apple_common.XcodeVersionProperties]
```
## XcodeVersionConfig
```
Provider apple_common.XcodeVersionConfig
```
The constructor/key for the `XcodeVersionConfig` provider.