Skip to main content

apple_toolchain

An apple_toolchain() rule defines the set of tools and settings used to build Apple targets. It specifies paths to compilers, linkers, code signing utilities, resource compilers, and other tools from the Apple SDK and Xcode. Rules such as apple_binary(), apple_library(), and apple_bundle() reference an apple_toolchain() to determine which tools and SDK to use during compilation, linking, and bundling.

Function Signature

def apple_toolchain(
*,
name: str,
default_target_platform: None | str = None,
target_compatible_with: list[str] = [],
compatible_with: list[str] = [],
exec_compatible_with: list[str] = [],
visibility: list[str] = [],
within_view: list[str] = ["PUBLIC"],
metadata: OpaqueMetadata = {},
tests: list[str] = [],
modifiers: OpaqueMetadata = [],
_apple_platforms: dict[str, str] = {},
_internal_platform_path: None | str = None,
_internal_sdk_path: None | str = None,
actool: str,
app_intents_metadata_processor: None | str = None,
app_intents_nl_training_processor: None | str = None,
architecture: str = "",
build_version: None | str = None,
codesign: str,
codesign_allocate: str,
codesign_identities_command: None | str = None,
compile_resources_locally: bool = False,
contacts: list[str] = [],
copy_scene_kit_assets: str,
cxx_toolchain: str,
developer_path: None | str = None,
dsymutil: str,
dsymutil_flags: list[str] = [],
dwarfdump: None | str = None,
extra_linker_outputs: list[str] = [],
ibtool: str,
installer: str = "gh_facebook_buck2_shims_meta//xplat/buck2/platform/apple/python_installer:apple_installer",
labels: list[str] = [],
libtool: str,
licenses: list[str] = [],
lipo: str,
mapc: None | str = None,
merge_index_store: str = "prelude//apple/tools/index:merge_index_store",
metal: None | str = None,
metallib: None | str = None,
min_version: str = "",
momc: str,
objdump: None | str = None,
placeholder_tool: None | str = None,
platform_path: None | str = None,
requires_xcode_version_match: bool = False,
sdk_environment: None | str = None,
sdk_name: str = "",
sdk_path: None | str = None,
swift_toolchain: None | str = None,
version: None | str = None,
watch_kit_stub_binary: None | str = None,
work_around_dsymutil_lto_stack_overflow_bug: None | bool = None,
xcode_build_version: None | str = None,
xcode_version: str,
xctest: str,
) -> None

Parameters

  • name: (required)

    name of the target

  • default_target_platform: (defaults to: None)

    specifies the default target platform, used when no platforms are specified on the command line

  • target_compatible_with: (defaults to: [])

    a list of constraints that are required to be satisfied for this target to be compatible with a configuration

  • compatible_with: (defaults to: [])

    a list of constraints that are required to be satisfied for this target to be compatible with a configuration

  • exec_compatible_with: (defaults to: [])

    a list of constraints that are required to be satisfied for this target to be compatible with an execution platform

  • visibility: (defaults to: [])

    a list of visibility patterns restricting what targets can depend on this one

  • within_view: (defaults to: ["PUBLIC"])

    a list of visibility patterns restricting what this target can depend on

  • metadata: (defaults to: {})

    a key-value map of metadata associated with this target

  • tests: (defaults to: [])

    a list of targets that provide tests for this one

  • modifiers: (defaults to: [])

    an array of modifiers associated with this target

  • contacts: (defaults to: [])

    A list of organizational contacts for this rule. These could be individuals who you would contact in the event of a failure or other issue with the rule.

    contacts = [ 'Joe Sixpack', 'Erika Mustermann' ]
  • labels: (defaults to: [])

    Set of arbitrary strings which allow you to annotate a build rule with tags that can be searched for over an entire dependency tree using buck query().

  • licenses: (defaults to: [])

    Set of license files for this library. To get the list of license files for a given build rule and all of its dependencies, you can use buck query