Skip to content

Latest commit

 

History

History
742 lines (606 loc) · 140 KB

rules-macos.md

File metadata and controls

742 lines (606 loc) · 140 KB

Bazel rules for creating macOS applications and bundles.

macos_application

macos_application(name, deps, resources, additional_contents, additional_linker_inputs, app_icons,
                  app_intents, bundle_id, bundle_id_suffix, bundle_name, codesign_inputs,
                  codesignopts, entitlements, entitlements_validation, executable_name,
                  exported_symbols_lists, extensions, families, frameworks, include_symbols_in_bundle,
                  infoplists, ipa_post_processor, linkopts, locales_to_include,
                  minimum_deployment_os_version, minimum_os_version, platform_type,
                  provisioning_profile, shared_capabilities, stamp, strings, version, xpc_services)

Builds and bundles a macOS Application.

This rule creates an application that is a .app bundle. If you want to build a simple command line tool as a standalone binary, use macos_command_line_application instead.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
deps A list of dependent targets that will be linked into this target's binary(s). Any resources, such as asset catalogs, that are referenced by those targets will also be transitively included in the final bundle(s). List of labels optional []
resources A list of resources or files bundled with the bundle. The resources will be stored in the appropriate resources location within the bundle. List of labels optional []
additional_contents Files that should be copied into specific subdirectories of the Contents folder in the bundle. The keys of this dictionary are labels pointing to single files, filegroups, or targets; the corresponding value is the name of the subdirectory of Contents where they should be placed.

The relative directory structure of filegroup contents is preserved when they are copied into the desired Contents subdirectory.
Dictionary: Label -> String optional {}
additional_linker_inputs A list of input files to be passed to the linker. List of labels optional []
app_icons Files that comprise the app icons for the application. Each file must have a containing directory named *..xcassets/*..appiconset and there may be only one such ..appiconset directory in the list. List of labels optional []
app_intents List of dependencies implementing the AppIntents protocol. List of labels optional []
bundle_id The bundle ID (reverse-DNS path followed by app name) for this target. Only use this attribute if the bundle ID is not intended to be composed through an assigned base bundle ID rule found within signed_capabilities. String optional ""
bundle_id_suffix A string to act as the suffix of the composed bundle ID. If this target's bundle ID is composed from a base bundle ID rule found within signed_capabilities, then this string will be appended to the end of the bundle ID following a "." separator. String optional "_"
bundle_name The desired name of the bundle (without the extension). If this attribute is not set, then the name of the target will be used instead. String optional ""
codesign_inputs A list of dependencies targets that provide inputs that will be used by codesign (referenced with codesignopts). List of labels optional []
codesignopts A list of strings representing extra flags that should be passed to codesign. List of strings optional []
entitlements The entitlements file required for device builds of this target. If absent, the default entitlements from the provisioning profile will be used.

The following variables are substituted in the entitlements file: $(CFBundleIdentifier) with the bundle ID of the application and $(AppIdentifierPrefix) with the value of the ApplicationIdentifierPrefix key from the target's provisioning profile.
Label optional None
entitlements_validation An entitlements_validation_mode to control the validation of the requested entitlements against the provisioning profile to ensure they are supported. String optional "loose"
executable_name The desired name of the executable, if the bundle has an executable. If this attribute is not set, then the name of the bundle_name attribute will be used if it is set; if not, then the name of the target will be used instead. String optional ""
exported_symbols_lists A list of targets containing exported symbols lists files for the linker to control symbol resolution.

Each file is expected to have a list of global symbol names that will remain as global symbols in the compiled binary owned by this framework. All other global symbols will be treated as if they were marked as __private_extern__ (aka visibility=hidden) and will not be global in the output file.

See the man page documentation for ld(1) on macOS for more details.
List of labels optional []
extensions A list of macOS extensions to include in the final application bundle. List of labels optional []
families A list of device families supported by this rule. At least one must be specified. List of strings optional ["mac"]
frameworks A list of framework targets (see macos_framework) that this target depends on. List of labels optional []
include_symbols_in_bundle If true and --output_groups=+dsyms is specified, generates $UUID.symbols files from all {binary: .dSYM, ...} pairs for the application and its dependencies, then packages them under the Symbols/ directory in the final application bundle. Boolean optional False
infoplists A list of .plist files that will be merged to form the Info.plist for this target. At least one file must be specified. Please see Info.plist Handling for what is supported. List of labels required
ipa_post_processor A tool that edits this target's archive after it is assembled but before it is signed. The tool is invoked with a single command-line argument that denotes the path to a directory containing the unzipped contents of the archive; this target's bundle will be the directory's only contents.

Any changes made by the tool must be made in this directory, and the tool's execution must be hermetic given these inputs to ensure that the result can be safely cached.
Label optional None
linkopts A list of strings representing extra flags that should be passed to the linker. List of strings optional []
locales_to_include A list of locales to include in the bundle. Only *.lproj directories that are matched will be copied as a part of the build. This value takes precedence (and is preferred) over locales defined using --define "apple.locales_to_include=...". List of strings optional []
minimum_deployment_os_version A required string indicating the minimum deployment OS version supported by the target, represented as a dotted version number (for example, "9.0"). This is different from minimum_os_version, which is effective at compile time. Ensure version specific APIs are guarded with available clauses. String optional ""
minimum_os_version A required string indicating the minimum OS version supported by the target, represented as a dotted version number (for example, "9.0"). String required
platform_type - String optional "macos"
provisioning_profile The provisioning profile (.provisionprofile file) to use when creating the bundle. This value is optional for simulator builds as the simulator doesn't fully enforce entitlements, but is required for device builds. Label optional None
shared_capabilities A list of shared apple_capability_set rules to represent the capabilities that a code sign aware Apple bundle rule output should have. These can define the formal prefix for the target's bundle_id and can further be merged with information provided by entitlements, if defined by any capabilities found within the apple_capability_set. List of labels optional []
stamp Enable link stamping. Whether to encode build information into the binary. Possible values:

* stamp = 1: Stamp the build information into the binary. Stamped binaries are only rebuilt when their dependencies change. Use this if there are tests that depend on the build information. * stamp = 0: Always replace build information by constant values. This gives good build result caching. * stamp = -1: Embedding of build information is controlled by the --[no]stamp flag.
Integer optional -1
strings A list of .strings files, often localizable. These files are converted to binary plists (if they are not already) and placed in the root of the final bundle, unless a file's immediate containing directory is named *.lproj, in which case it will be placed under a directory with the same name in the bundle. List of labels optional []
version An apple_bundle_version target that represents the version for this target. See apple_bundle_version. Label optional None
xpc_services A list of macOS XPC Services to include in the final application bundle. List of labels optional []

macos_build_test

macos_build_test(name, minimum_os_version, platform_type, targets)

Test rule to check that the given library targets (Swift, Objective-C, C++) build for macOS.

Typical usage:

macos_build_test(
    name = "my_build_test",
    minimum_os_version = "10.14",
    targets = [
        "//some/package:my_library",
    ],
)

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
minimum_os_version A required string indicating the minimum OS version that will be used as the deployment target when building the targets, represented as a dotted version number (for example, "9.0"). String required
platform_type - String optional "macos"
targets The targets to check for successful build. List of labels optional []

macos_bundle

macos_bundle(name, deps, resources, additional_contents, additional_linker_inputs, app_icons,
             bundle_extension, bundle_id, bundle_id_suffix, bundle_loader, bundle_name,
             codesign_inputs, codesignopts, entitlements, entitlements_validation, executable_name,
             exported_symbols_lists, families, infoplists, ipa_post_processor, linkopts,
             minimum_deployment_os_version, minimum_os_version, platform_type, provisioning_profile,
             shared_capabilities, stamp, strings, version)

Builds and bundles a macOS Loadable Bundle.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
deps A list of dependent targets that will be linked into this target's binary(s). Any resources, such as asset catalogs, that are referenced by those targets will also be transitively included in the final bundle(s). List of labels optional []
resources A list of resources or files bundled with the bundle. The resources will be stored in the appropriate resources location within the bundle. List of labels optional []
additional_contents Files that should be copied into specific subdirectories of the Contents folder in the bundle. The keys of this dictionary are labels pointing to single files, filegroups, or targets; the corresponding value is the name of the subdirectory of Contents where they should be placed.

The relative directory structure of filegroup contents is preserved when they are copied into the desired Contents subdirectory.
Dictionary: Label -> String optional {}
additional_linker_inputs A list of input files to be passed to the linker. List of labels optional []
app_icons Files that comprise the app icons for the application. Each file must have a containing directory named *..xcassets/*..appiconset and there may be only one such ..appiconset directory in the list. List of labels optional []
bundle_extension The extension, without a leading dot, that will be used to name the bundle. If this attribute is not set, then the extension will be .bundle. String optional ""
bundle_id The bundle ID (reverse-DNS path followed by app name) for this target. Only use this attribute if the bundle ID is not intended to be composed through an assigned base bundle ID rule found within signed_capabilities. String optional ""
bundle_id_suffix A string to act as the suffix of the composed bundle ID. If this target's bundle ID is composed from a base bundle ID rule found within signed_capabilities, then this string will be appended to the end of the bundle ID following a "." separator. String optional "bundle_name"
bundle_loader The target representing the executable that will be loading this bundle. Undefined symbols from the bundle are checked against this execuable during linking as if it were one of the dynamic libraries the bundle was linked with. Label optional None
bundle_name The desired name of the bundle (without the extension). If this attribute is not set, then the name of the target will be used instead. String optional ""
codesign_inputs A list of dependencies targets that provide inputs that will be used by codesign (referenced with codesignopts). List of labels optional []
codesignopts A list of strings representing extra flags that should be passed to codesign. List of strings optional []
entitlements The entitlements file required for device builds of this target. If absent, the default entitlements from the provisioning profile will be used.

The following variables are substituted in the entitlements file: $(CFBundleIdentifier) with the bundle ID of the application and $(AppIdentifierPrefix) with the value of the ApplicationIdentifierPrefix key from the target's provisioning profile.
Label optional None
entitlements_validation An entitlements_validation_mode to control the validation of the requested entitlements against the provisioning profile to ensure they are supported. String optional "loose"
executable_name The desired name of the executable, if the bundle has an executable. If this attribute is not set, then the name of the bundle_name attribute will be used if it is set; if not, then the name of the target will be used instead. String optional ""
exported_symbols_lists A list of targets containing exported symbols lists files for the linker to control symbol resolution.

Each file is expected to have a list of global symbol names that will remain as global symbols in the compiled binary owned by this framework. All other global symbols will be treated as if they were marked as __private_extern__ (aka visibility=hidden) and will not be global in the output file.

See the man page documentation for ld(1) on macOS for more details.
List of labels optional []
families A list of device families supported by this rule. At least one must be specified. List of strings optional ["mac"]
infoplists A list of .plist files that will be merged to form the Info.plist for this target. At least one file must be specified. Please see Info.plist Handling for what is supported. List of labels required
ipa_post_processor A tool that edits this target's archive after it is assembled but before it is signed. The tool is invoked with a single command-line argument that denotes the path to a directory containing the unzipped contents of the archive; this target's bundle will be the directory's only contents.

Any changes made by the tool must be made in this directory, and the tool's execution must be hermetic given these inputs to ensure that the result can be safely cached.
Label optional None
linkopts A list of strings representing extra flags that should be passed to the linker. List of strings optional []
minimum_deployment_os_version A required string indicating the minimum deployment OS version supported by the target, represented as a dotted version number (for example, "9.0"). This is different from minimum_os_version, which is effective at compile time. Ensure version specific APIs are guarded with available clauses. String optional ""
minimum_os_version A required string indicating the minimum OS version supported by the target, represented as a dotted version number (for example, "9.0"). String required
platform_type - String optional "macos"
provisioning_profile The provisioning profile (.provisionprofile file) to use when creating the bundle. This value is optional for simulator builds as the simulator doesn't fully enforce entitlements, but is required for device builds. Label optional None
shared_capabilities A list of shared apple_capability_set rules to represent the capabilities that a code sign aware Apple bundle rule output should have. These can define the formal prefix for the target's bundle_id and can further be merged with information provided by entitlements, if defined by any capabilities found within the apple_capability_set. List of labels optional []
stamp Enable link stamping. Whether to encode build information into the binary. Possible values:

* stamp = 1: Stamp the build information into the binary. Stamped binaries are only rebuilt when their dependencies change. Use this if there are tests that depend on the build information. * stamp = 0: Always replace build information by constant values. This gives good build result caching. * stamp = -1: Embedding of build information is controlled by the --[no]stamp flag.
Integer optional -1
strings A list of .strings files, often localizable. These files are converted to binary plists (if they are not already) and placed in the root of the final bundle, unless a file's immediate containing directory is named *.lproj, in which case it will be placed under a directory with the same name in the bundle. List of labels optional []
version An apple_bundle_version target that represents the version for this target. See apple_bundle_version. Label optional None

macos_command_line_application

macos_command_line_application(name, deps, additional_linker_inputs, base_bundle_id, bundle_id,
                               bundle_id_suffix, codesign_inputs, codesignopts,
                               exported_symbols_lists, infoplists, launchdplists, linkopts,
                               minimum_deployment_os_version, minimum_os_version, platform_type,
                               provisioning_profile, stamp, version)

Builds a macOS Command Line Application binary.

A command line application is a standalone binary file, rather than a .app bundle like those produced by macos_application. Unlike a plain apple_binary target, however, this rule supports versioning and embedding an Info.plist into the binary and allows the binary to be code-signed.

Targets created with macos_command_line_application can be executed using bazel run.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
deps A list of dependent targets that will be linked into this target's binary(s). Any resources, such as asset catalogs, that are referenced by those targets will also be transitively included in the final bundle(s). List of labels optional []
additional_linker_inputs A list of input files to be passed to the linker. List of labels optional []
base_bundle_id The base bundle ID rule to dictate the form that a given bundle rule's bundle ID prefix should take. Label optional None
bundle_id The bundle ID (reverse-DNS path followed by app name) for this target. Only use this attribute if the bundle ID is not intended to be composed through an assigned base bundle ID referenced by base_bundle_id. String optional ""
bundle_id_suffix A string to act as the suffix of the composed bundle ID. If this target's bundle ID is composed from the base bundle ID rule referenced by base_bundle_id, then this string will be appended to the end of the bundle ID following a "." separator. String optional "_"
codesign_inputs A list of dependencies targets that provide inputs that will be used by codesign (referenced with codesignopts). List of labels optional []
codesignopts A list of strings representing extra flags that should be passed to codesign. List of strings optional []
exported_symbols_lists A list of targets containing exported symbols lists files for the linker to control symbol resolution.

Each file is expected to have a list of global symbol names that will remain as global symbols in the compiled binary owned by this framework. All other global symbols will be treated as if they were marked as __private_extern__ (aka visibility=hidden) and will not be global in the output file.

See the man page documentation for ld(1) on macOS for more details.
List of labels optional []
infoplists A list of .plist files that will be merged to form the Info.plist that represents the application and is embedded into the binary. Please see Info.plist Handling for what is supported. List of labels optional []
launchdplists A list of system wide and per-user daemon/agent configuration files, as specified by the launch plist manual that can be found via man launchd.plist. These are XML files that can be loaded into launchd with launchctl, and are required of command line applications that are intended to be used as launch daemons and agents on macOS. All launchd.plists referenced by this attribute will be merged into a single plist and written directly into the __TEXT,__launchd_plist section of the linked binary. List of labels optional []
linkopts A list of strings representing extra flags that should be passed to the linker. List of strings optional []
minimum_deployment_os_version A required string indicating the minimum deployment OS version supported by the target, represented as a dotted version number (for example, "9.0"). This is different from minimum_os_version, which is effective at compile time. Ensure version specific APIs are guarded with available clauses. String optional ""
minimum_os_version A required string indicating the minimum OS version supported by the target, represented as a dotted version number (for example, "9.0"). String required
platform_type - String optional "macos"
provisioning_profile The provisioning profile (.provisionprofile file) to use when creating the bundle. This value is optional for simulator builds as the simulator doesn't fully enforce entitlements, but is required for device builds. Label optional None
stamp Enable link stamping. Whether to encode build information into the binary. Possible values:

* stamp = 1: Stamp the build information into the binary. Stamped binaries are only rebuilt when their dependencies change. Use this if there are tests that depend on the build information. * stamp = 0: Always replace build information by constant values. This gives good build result caching. * stamp = -1: Embedding of build information is controlled by the --[no]stamp flag.
Integer optional -1
version An apple_bundle_version target that represents the version for this target. See apple_bundle_version. Label optional None

macos_dylib

macos_dylib(name, deps, additional_linker_inputs, base_bundle_id, bundle_id, bundle_id_suffix,
            codesign_inputs, codesignopts, exported_symbols_lists, infoplists, linkopts,
            minimum_deployment_os_version, minimum_os_version, platform_type, provisioning_profile,
            stamp, version)

Builds a macOS Dylib binary.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
deps A list of dependent targets that will be linked into this target's binary(s). Any resources, such as asset catalogs, that are referenced by those targets will also be transitively included in the final bundle(s). List of labels optional []
additional_linker_inputs A list of input files to be passed to the linker. List of labels optional []
base_bundle_id The base bundle ID rule to dictate the form that a given bundle rule's bundle ID prefix should take. Label optional None
bundle_id The bundle ID (reverse-DNS path followed by app name) for this target. Only use this attribute if the bundle ID is not intended to be composed through an assigned base bundle ID referenced by base_bundle_id. String optional ""
bundle_id_suffix A string to act as the suffix of the composed bundle ID. If this target's bundle ID is composed from the base bundle ID rule referenced by base_bundle_id, then this string will be appended to the end of the bundle ID following a "." separator. String optional "_"
codesign_inputs A list of dependencies targets that provide inputs that will be used by codesign (referenced with codesignopts). List of labels optional []
codesignopts A list of strings representing extra flags that should be passed to codesign. List of strings optional []
exported_symbols_lists A list of targets containing exported symbols lists files for the linker to control symbol resolution.

Each file is expected to have a list of global symbol names that will remain as global symbols in the compiled binary owned by this framework. All other global symbols will be treated as if they were marked as __private_extern__ (aka visibility=hidden) and will not be global in the output file.

See the man page documentation for ld(1) on macOS for more details.
List of labels optional []
infoplists A list of .plist files that will be merged to form the Info.plist that represents the application and is embedded into the binary. Please see Info.plist Handling for what is supported. List of labels optional []
linkopts A list of strings representing extra flags that should be passed to the linker. List of strings optional []
minimum_deployment_os_version A required string indicating the minimum deployment OS version supported by the target, represented as a dotted version number (for example, "9.0"). This is different from minimum_os_version, which is effective at compile time. Ensure version specific APIs are guarded with available clauses. String optional ""
minimum_os_version A required string indicating the minimum OS version supported by the target, represented as a dotted version number (for example, "9.0"). String required
platform_type - String optional "macos"
provisioning_profile The provisioning profile (.provisionprofile file) to use when creating the bundle. This value is optional for simulator builds as the simulator doesn't fully enforce entitlements, but is required for device builds. Label optional None
stamp Enable link stamping. Whether to encode build information into the binary. Possible values:

* stamp = 1: Stamp the build information into the binary. Stamped binaries are only rebuilt when their dependencies change. Use this if there are tests that depend on the build information. * stamp = 0: Always replace build information by constant values. This gives good build result caching. * stamp = -1: Embedding of build information is controlled by the --[no]stamp flag.
Integer optional -1
version An apple_bundle_version target that represents the version for this target. See apple_bundle_version. Label optional None

macos_dynamic_framework

macos_dynamic_framework(name, deps, resources, hdrs, additional_linker_inputs, base_bundle_id,
                        bundle_id, bundle_id_suffix, bundle_name, bundle_only, codesign_inputs,
                        codesignopts, executable_name, exported_symbols_lists, extension_safe,
                        families, frameworks, infoplists, ipa_post_processor, linkopts,
                        minimum_deployment_os_version, minimum_os_version, platform_type,
                        provisioning_profile, stamp, strings, version)

Builds and bundles a macOS dynamic framework that is consumable by Xcode.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
deps A list of dependent targets that will be linked into this target's binary(s). Any resources, such as asset catalogs, that are referenced by those targets will also be transitively included in the final bundle(s). List of labels optional []
resources A list of resources or files bundled with the bundle. The resources will be stored in the appropriate resources location within the bundle. List of labels optional []
hdrs - List of labels optional []
additional_linker_inputs A list of input files to be passed to the linker. List of labels optional []
base_bundle_id The base bundle ID rule to dictate the form that a given bundle rule's bundle ID prefix should take. Label optional None
bundle_id The bundle ID (reverse-DNS path followed by app name) for this target. Only use this attribute if the bundle ID is not intended to be composed through an assigned base bundle ID referenced by base_bundle_id. String optional ""
bundle_id_suffix A string to act as the suffix of the composed bundle ID. If this target's bundle ID is composed from the base bundle ID rule referenced by base_bundle_id, then this string will be appended to the end of the bundle ID following a "." separator. String optional "bundle_name"
bundle_name The desired name of the bundle (without the extension). If this attribute is not set, then the name of the target will be used instead. String optional ""
bundle_only Avoid linking the dynamic framework, but still include it in the app. This is useful when you want to manually dlopen the framework at runtime. Boolean optional False
codesign_inputs A list of dependencies targets that provide inputs that will be used by codesign (referenced with codesignopts). List of labels optional []
codesignopts A list of strings representing extra flags that should be passed to codesign. List of strings optional []
executable_name The desired name of the executable, if the bundle has an executable. If this attribute is not set, then the name of the bundle_name attribute will be used if it is set; if not, then the name of the target will be used instead. String optional ""
exported_symbols_lists A list of targets containing exported symbols lists files for the linker to control symbol resolution.

Each file is expected to have a list of global symbol names that will remain as global symbols in the compiled binary owned by this framework. All other global symbols will be treated as if they were marked as __private_extern__ (aka visibility=hidden) and will not be global in the output file.

See the man page documentation for ld(1) on macOS for more details.
List of labels optional []
extension_safe If true, compiles and links this framework with -application-extension, restricting the binary to use only extension-safe APIs. Boolean optional False
families A list of device families supported by this rule. At least one must be specified. List of strings optional ["mac"]
frameworks A list of framework targets (see macos_framework) that this target depends on. List of labels optional []
infoplists A list of .plist files that will be merged to form the Info.plist for this target. At least one file must be specified. Please see Info.plist Handling for what is supported. List of labels required
ipa_post_processor A tool that edits this target's archive after it is assembled but before it is signed. The tool is invoked with a single command-line argument that denotes the path to a directory containing the unzipped contents of the archive; this target's bundle will be the directory's only contents.

Any changes made by the tool must be made in this directory, and the tool's execution must be hermetic given these inputs to ensure that the result can be safely cached.
Label optional None
linkopts A list of strings representing extra flags that should be passed to the linker. List of strings optional []
minimum_deployment_os_version A required string indicating the minimum deployment OS version supported by the target, represented as a dotted version number (for example, "9.0"). This is different from minimum_os_version, which is effective at compile time. Ensure version specific APIs are guarded with available clauses. String optional ""
minimum_os_version A required string indicating the minimum OS version supported by the target, represented as a dotted version number (for example, "9.0"). String required
platform_type - String optional "macos"
provisioning_profile The provisioning profile (.mobileprovision file) to use when creating the bundle. This value is optional for simulator builds as the simulator doesn't fully enforce entitlements, but is required for device builds. Label optional None
stamp Enable link stamping. Whether to encode build information into the binary. Possible values:

* stamp = 1: Stamp the build information into the binary. Stamped binaries are only rebuilt when their dependencies change. Use this if there are tests that depend on the build information. * stamp = 0: Always replace build information by constant values. This gives good build result caching. * stamp = -1: Embedding of build information is controlled by the --[no]stamp flag.
Integer optional -1
strings A list of .strings files, often localizable. These files are converted to binary plists (if they are not already) and placed in the root of the final bundle, unless a file's immediate containing directory is named *.lproj, in which case it will be placed under a directory with the same name in the bundle. List of labels optional []
version An apple_bundle_version target that represents the version for this target. See apple_bundle_version. Label optional None

macos_extension

macos_extension(name, deps, resources, additional_contents, additional_linker_inputs, app_icons,
                bundle_id, bundle_id_suffix, bundle_name, codesign_inputs, codesignopts, entitlements,
                entitlements_validation, executable_name, exported_symbols_lists,
                extensionkit_extension, families, frameworks, infoplists, ipa_post_processor,
                linkopts, locales_to_include, minimum_deployment_os_version, minimum_os_version,
                platform_type, provisioning_profile, shared_capabilities, stamp, strings, version)

Builds and bundles a macOS Application Extension.

Most macOS app extensions use a plug-in-based architecture where the executable's entry point is provided by a system framework. However, macOS 11 introduced Widget Extensions that use a traditional main entry point (typically expressed through Swift's @main attribute).

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
deps A list of dependent targets that will be linked into this target's binary(s). Any resources, such as asset catalogs, that are referenced by those targets will also be transitively included in the final bundle(s). List of labels optional []
resources A list of resources or files bundled with the bundle. The resources will be stored in the appropriate resources location within the bundle. List of labels optional []
additional_contents Files that should be copied into specific subdirectories of the Contents folder in the bundle. The keys of this dictionary are labels pointing to single files, filegroups, or targets; the corresponding value is the name of the subdirectory of Contents where they should be placed.

The relative directory structure of filegroup contents is preserved when they are copied into the desired Contents subdirectory.
Dictionary: Label -> String optional {}
additional_linker_inputs A list of input files to be passed to the linker. List of labels optional []
app_icons Files that comprise the app icons for the application. Each file must have a containing directory named *..xcassets/*..appiconset and there may be only one such ..appiconset directory in the list. List of labels optional []
bundle_id The bundle ID (reverse-DNS path followed by app name) for this target. Only use this attribute if the bundle ID is not intended to be composed through an assigned base bundle ID rule found within signed_capabilities. String optional ""
bundle_id_suffix A string to act as the suffix of the composed bundle ID. If this target's bundle ID is composed from a base bundle ID rule found within signed_capabilities, then this string will be appended to the end of the bundle ID following a "." separator. String optional "bundle_name"
bundle_name The desired name of the bundle (without the extension). If this attribute is not set, then the name of the target will be used instead. String optional ""
codesign_inputs A list of dependencies targets that provide inputs that will be used by codesign (referenced with codesignopts). List of labels optional []
codesignopts A list of strings representing extra flags that should be passed to codesign. List of strings optional []
entitlements The entitlements file required for device builds of this target. If absent, the default entitlements from the provisioning profile will be used.

The following variables are substituted in the entitlements file: $(CFBundleIdentifier) with the bundle ID of the application and $(AppIdentifierPrefix) with the value of the ApplicationIdentifierPrefix key from the target's provisioning profile.
Label optional None
entitlements_validation An entitlements_validation_mode to control the validation of the requested entitlements against the provisioning profile to ensure they are supported. String optional "loose"
executable_name The desired name of the executable, if the bundle has an executable. If this attribute is not set, then the name of the bundle_name attribute will be used if it is set; if not, then the name of the target will be used instead. String optional ""
exported_symbols_lists A list of targets containing exported symbols lists files for the linker to control symbol resolution.

Each file is expected to have a list of global symbol names that will remain as global symbols in the compiled binary owned by this framework. All other global symbols will be treated as if they were marked as __private_extern__ (aka visibility=hidden) and will not be global in the output file.

See the man page documentation for ld(1) on macOS for more details.
List of labels optional []
extensionkit_extension Indicates if this target should be treated as an ExtensionKit extension. Boolean optional False
families A list of device families supported by this rule. At least one must be specified. List of strings optional ["mac"]
frameworks A list of framework targets (see macos_framework) that this target depends on. List of labels optional []
infoplists A list of .plist files that will be merged to form the Info.plist for this target. At least one file must be specified. Please see Info.plist Handling for what is supported. List of labels required
ipa_post_processor A tool that edits this target's archive after it is assembled but before it is signed. The tool is invoked with a single command-line argument that denotes the path to a directory containing the unzipped contents of the archive; this target's bundle will be the directory's only contents.

Any changes made by the tool must be made in this directory, and the tool's execution must be hermetic given these inputs to ensure that the result can be safely cached.
Label optional None
linkopts A list of strings representing extra flags that should be passed to the linker. List of strings optional []
locales_to_include A list of locales to include in the bundle. Only *.lproj directories that are matched will be copied as a part of the build. This value takes precedence (and is preferred) over locales defined using --define "apple.locales_to_include=...". List of strings optional []
minimum_deployment_os_version A required string indicating the minimum deployment OS version supported by the target, represented as a dotted version number (for example, "9.0"). This is different from minimum_os_version, which is effective at compile time. Ensure version specific APIs are guarded with available clauses. String optional ""
minimum_os_version A required string indicating the minimum OS version supported by the target, represented as a dotted version number (for example, "9.0"). String required
platform_type - String optional "macos"
provisioning_profile The provisioning profile (.provisionprofile file) to use when creating the bundle. This value is optional for simulator builds as the simulator doesn't fully enforce entitlements, but is required for device builds. Label optional None
shared_capabilities A list of shared apple_capability_set rules to represent the capabilities that a code sign aware Apple bundle rule output should have. These can define the formal prefix for the target's bundle_id and can further be merged with information provided by entitlements, if defined by any capabilities found within the apple_capability_set. List of labels optional []
stamp Enable link stamping. Whether to encode build information into the binary. Possible values:

* stamp = 1: Stamp the build information into the binary. Stamped binaries are only rebuilt when their dependencies change. Use this if there are tests that depend on the build information. * stamp = 0: Always replace build information by constant values. This gives good build result caching. * stamp = -1: Embedding of build information is controlled by the --[no]stamp flag.
Integer optional -1
strings A list of .strings files, often localizable. These files are converted to binary plists (if they are not already) and placed in the root of the final bundle, unless a file's immediate containing directory is named *.lproj, in which case it will be placed under a directory with the same name in the bundle. List of labels optional []
version An apple_bundle_version target that represents the version for this target. See apple_bundle_version. Label optional None

macos_framework

macos_framework(name, deps, resources, hdrs, additional_linker_inputs, base_bundle_id, bundle_id,
                bundle_id_suffix, bundle_name, bundle_only, codesign_inputs, codesignopts,
                executable_name, exported_symbols_lists, extension_safe, families, frameworks,
                infoplists, ipa_post_processor, linkopts, minimum_deployment_os_version,
                minimum_os_version, platform_type, provisioning_profile, stamp, strings, version)

Builds and bundles an macOS Dynamic Framework.

To use this framework for your app and extensions, list it in the frameworks attributes of those macos_application and/or macos_extension rules.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
deps A list of dependent targets that will be linked into this target's binary(s). Any resources, such as asset catalogs, that are referenced by those targets will also be transitively included in the final bundle(s). List of labels optional []
resources A list of resources or files bundled with the bundle. The resources will be stored in the appropriate resources location within the bundle. List of labels optional []
hdrs - List of labels optional []
additional_linker_inputs A list of input files to be passed to the linker. List of labels optional []
base_bundle_id The base bundle ID rule to dictate the form that a given bundle rule's bundle ID prefix should take. Label optional None
bundle_id The bundle ID (reverse-DNS path followed by app name) for this target. Only use this attribute if the bundle ID is not intended to be composed through an assigned base bundle ID referenced by base_bundle_id. String optional ""
bundle_id_suffix A string to act as the suffix of the composed bundle ID. If this target's bundle ID is composed from the base bundle ID rule referenced by base_bundle_id, then this string will be appended to the end of the bundle ID following a "." separator. String optional "bundle_name"
bundle_name The desired name of the bundle (without the extension). If this attribute is not set, then the name of the target will be used instead. String optional ""
bundle_only Avoid linking the dynamic framework, but still include it in the app. This is useful when you want to manually dlopen the framework at runtime. Boolean optional False
codesign_inputs A list of dependencies targets that provide inputs that will be used by codesign (referenced with codesignopts). List of labels optional []
codesignopts A list of strings representing extra flags that should be passed to codesign. List of strings optional []
executable_name The desired name of the executable, if the bundle has an executable. If this attribute is not set, then the name of the bundle_name attribute will be used if it is set; if not, then the name of the target will be used instead. String optional ""
exported_symbols_lists A list of targets containing exported symbols lists files for the linker to control symbol resolution.

Each file is expected to have a list of global symbol names that will remain as global symbols in the compiled binary owned by this framework. All other global symbols will be treated as if they were marked as __private_extern__ (aka visibility=hidden) and will not be global in the output file.

See the man page documentation for ld(1) on macOS for more details.
List of labels optional []
extension_safe If true, compiles and links this framework with -application-extension, restricting the binary to use only extension-safe APIs. Boolean optional False
families A list of device families supported by this rule. At least one must be specified. List of strings optional ["mac"]
frameworks A list of framework targets (see macos_framework) that this target depends on. List of labels optional []
infoplists A list of .plist files that will be merged to form the Info.plist for this target. At least one file must be specified. Please see Info.plist Handling for what is supported. List of labels required
ipa_post_processor A tool that edits this target's archive after it is assembled but before it is signed. The tool is invoked with a single command-line argument that denotes the path to a directory containing the unzipped contents of the archive; this target's bundle will be the directory's only contents.

Any changes made by the tool must be made in this directory, and the tool's execution must be hermetic given these inputs to ensure that the result can be safely cached.
Label optional None
linkopts A list of strings representing extra flags that should be passed to the linker. List of strings optional []
minimum_deployment_os_version A required string indicating the minimum deployment OS version supported by the target, represented as a dotted version number (for example, "9.0"). This is different from minimum_os_version, which is effective at compile time. Ensure version specific APIs are guarded with available clauses. String optional ""
minimum_os_version A required string indicating the minimum OS version supported by the target, represented as a dotted version number (for example, "9.0"). String required
platform_type - String optional "macos"
provisioning_profile The provisioning profile (.mobileprovision file) to use when creating the bundle. This value is optional for simulator builds as the simulator doesn't fully enforce entitlements, but is required for device builds. Label optional None
stamp Enable link stamping. Whether to encode build information into the binary. Possible values:

* stamp = 1: Stamp the build information into the binary. Stamped binaries are only rebuilt when their dependencies change. Use this if there are tests that depend on the build information. * stamp = 0: Always replace build information by constant values. This gives good build result caching. * stamp = -1: Embedding of build information is controlled by the --[no]stamp flag.
Integer optional -1
strings A list of .strings files, often localizable. These files are converted to binary plists (if they are not already) and placed in the root of the final bundle, unless a file's immediate containing directory is named *.lproj, in which case it will be placed under a directory with the same name in the bundle. List of labels optional []
version An apple_bundle_version target that represents the version for this target. See apple_bundle_version. Label optional None

macos_kernel_extension

macos_kernel_extension(name, deps, resources, additional_contents, additional_linker_inputs,
                       bundle_id, bundle_id_suffix, bundle_name, codesign_inputs, codesignopts,
                       entitlements, entitlements_validation, executable_name, exported_symbols_lists,
                       families, infoplists, ipa_post_processor, linkopts,
                       minimum_deployment_os_version, minimum_os_version, platform_type,
                       provisioning_profile, shared_capabilities, stamp, strings, version)

Builds and bundles a macOS Kernel Extension.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
deps A list of dependent targets that will be linked into this target's binary(s). Any resources, such as asset catalogs, that are referenced by those targets will also be transitively included in the final bundle(s). List of labels optional []
resources A list of resources or files bundled with the bundle. The resources will be stored in the appropriate resources location within the bundle. List of labels optional []
additional_contents Files that should be copied into specific subdirectories of the Contents folder in the bundle. The keys of this dictionary are labels pointing to single files, filegroups, or targets; the corresponding value is the name of the subdirectory of Contents where they should be placed.

The relative directory structure of filegroup contents is preserved when they are copied into the desired Contents subdirectory.
Dictionary: Label -> String optional {}
additional_linker_inputs A list of input files to be passed to the linker. List of labels optional []
bundle_id The bundle ID (reverse-DNS path followed by app name) for this target. Only use this attribute if the bundle ID is not intended to be composed through an assigned base bundle ID rule found within signed_capabilities. String optional ""
bundle_id_suffix A string to act as the suffix of the composed bundle ID. If this target's bundle ID is composed from a base bundle ID rule found within signed_capabilities, then this string will be appended to the end of the bundle ID following a "." separator. String optional "_"
bundle_name The desired name of the bundle (without the extension). If this attribute is not set, then the name of the target will be used instead. String optional ""
codesign_inputs A list of dependencies targets that provide inputs that will be used by codesign (referenced with codesignopts). List of labels optional []
codesignopts A list of strings representing extra flags that should be passed to codesign. List of strings optional []
entitlements The entitlements file required for device builds of this target. If absent, the default entitlements from the provisioning profile will be used.

The following variables are substituted in the entitlements file: $(CFBundleIdentifier) with the bundle ID of the application and $(AppIdentifierPrefix) with the value of the ApplicationIdentifierPrefix key from the target's provisioning profile.
Label optional None
entitlements_validation An entitlements_validation_mode to control the validation of the requested entitlements against the provisioning profile to ensure they are supported. String optional "loose"
executable_name The desired name of the executable, if the bundle has an executable. If this attribute is not set, then the name of the bundle_name attribute will be used if it is set; if not, then the name of the target will be used instead. String optional ""
exported_symbols_lists A list of targets containing exported symbols lists files for the linker to control symbol resolution.

Each file is expected to have a list of global symbol names that will remain as global symbols in the compiled binary owned by this framework. All other global symbols will be treated as if they were marked as __private_extern__ (aka visibility=hidden) and will not be global in the output file.

See the man page documentation for ld(1) on macOS for more details.
List of labels optional []
families A list of device families supported by this rule. At least one must be specified. List of strings optional ["mac"]
infoplists A list of .plist files that will be merged to form the Info.plist for this target. At least one file must be specified. Please see Info.plist Handling for what is supported. List of labels required
ipa_post_processor A tool that edits this target's archive after it is assembled but before it is signed. The tool is invoked with a single command-line argument that denotes the path to a directory containing the unzipped contents of the archive; this target's bundle will be the directory's only contents.

Any changes made by the tool must be made in this directory, and the tool's execution must be hermetic given these inputs to ensure that the result can be safely cached.
Label optional None
linkopts A list of strings representing extra flags that should be passed to the linker. List of strings optional []
minimum_deployment_os_version A required string indicating the minimum deployment OS version supported by the target, represented as a dotted version number (for example, "9.0"). This is different from minimum_os_version, which is effective at compile time. Ensure version specific APIs are guarded with available clauses. String optional ""
minimum_os_version A required string indicating the minimum OS version supported by the target, represented as a dotted version number (for example, "9.0"). String required
platform_type - String optional "macos"
provisioning_profile The provisioning profile (.provisionprofile file) to use when creating the bundle. This value is optional for simulator builds as the simulator doesn't fully enforce entitlements, but is required for device builds. Label optional None
shared_capabilities A list of shared apple_capability_set rules to represent the capabilities that a code sign aware Apple bundle rule output should have. These can define the formal prefix for the target's bundle_id and can further be merged with information provided by entitlements, if defined by any capabilities found within the apple_capability_set. List of labels optional []
stamp Enable link stamping. Whether to encode build information into the binary. Possible values:

* stamp = 1: Stamp the build information into the binary. Stamped binaries are only rebuilt when their dependencies change. Use this if there are tests that depend on the build information. * stamp = 0: Always replace build information by constant values. This gives good build result caching. * stamp = -1: Embedding of build information is controlled by the --[no]stamp flag.
Integer optional -1
strings A list of .strings files, often localizable. These files are converted to binary plists (if they are not already) and placed in the root of the final bundle, unless a file's immediate containing directory is named *.lproj, in which case it will be placed under a directory with the same name in the bundle. List of labels optional []
version An apple_bundle_version target that represents the version for this target. See apple_bundle_version. Label optional None

macos_quick_look_plugin

macos_quick_look_plugin(name, deps, resources, additional_contents, additional_linker_inputs,
                        bundle_id, bundle_id_suffix, bundle_name, codesign_inputs, codesignopts,
                        entitlements, entitlements_validation, executable_name,
                        exported_symbols_lists, families, infoplists, ipa_post_processor, linkopts,
                        minimum_deployment_os_version, minimum_os_version, platform_type,
                        provisioning_profile, shared_capabilities, stamp, strings, version)

Builds and bundles a macOS Quick Look Plugin.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
deps A list of dependent targets that will be linked into this target's binary(s). Any resources, such as asset catalogs, that are referenced by those targets will also be transitively included in the final bundle(s). List of labels optional []
resources A list of resources or files bundled with the bundle. The resources will be stored in the appropriate resources location within the bundle. List of labels optional []
additional_contents Files that should be copied into specific subdirectories of the Contents folder in the bundle. The keys of this dictionary are labels pointing to single files, filegroups, or targets; the corresponding value is the name of the subdirectory of Contents where they should be placed.

The relative directory structure of filegroup contents is preserved when they are copied into the desired Contents subdirectory.
Dictionary: Label -> String optional {}
additional_linker_inputs A list of input files to be passed to the linker. List of labels optional []
bundle_id The bundle ID (reverse-DNS path followed by app name) for this target. Only use this attribute if the bundle ID is not intended to be composed through an assigned base bundle ID rule found within signed_capabilities. String optional ""
bundle_id_suffix A string to act as the suffix of the composed bundle ID. If this target's bundle ID is composed from a base bundle ID rule found within signed_capabilities, then this string will be appended to the end of the bundle ID following a "." separator. String optional "_"
bundle_name The desired name of the bundle (without the extension). If this attribute is not set, then the name of the target will be used instead. String optional ""
codesign_inputs A list of dependencies targets that provide inputs that will be used by codesign (referenced with codesignopts). List of labels optional []
codesignopts A list of strings representing extra flags that should be passed to codesign. List of strings optional []
entitlements The entitlements file required for device builds of this target. If absent, the default entitlements from the provisioning profile will be used.

The following variables are substituted in the entitlements file: $(CFBundleIdentifier) with the bundle ID of the application and $(AppIdentifierPrefix) with the value of the ApplicationIdentifierPrefix key from the target's provisioning profile.
Label optional None
entitlements_validation An entitlements_validation_mode to control the validation of the requested entitlements against the provisioning profile to ensure they are supported. String optional "loose"
executable_name The desired name of the executable, if the bundle has an executable. If this attribute is not set, then the name of the bundle_name attribute will be used if it is set; if not, then the name of the target will be used instead. String optional ""
exported_symbols_lists A list of targets containing exported symbols lists files for the linker to control symbol resolution.

Each file is expected to have a list of global symbol names that will remain as global symbols in the compiled binary owned by this framework. All other global symbols will be treated as if they were marked as __private_extern__ (aka visibility=hidden) and will not be global in the output file.

See the man page documentation for ld(1) on macOS for more details.
List of labels optional []
families A list of device families supported by this rule. At least one must be specified. List of strings optional ["mac"]
infoplists A list of .plist files that will be merged to form the Info.plist for this target. At least one file must be specified. Please see Info.plist Handling for what is supported. List of labels required
ipa_post_processor A tool that edits this target's archive after it is assembled but before it is signed. The tool is invoked with a single command-line argument that denotes the path to a directory containing the unzipped contents of the archive; this target's bundle will be the directory's only contents.

Any changes made by the tool must be made in this directory, and the tool's execution must be hermetic given these inputs to ensure that the result can be safely cached.
Label optional None
linkopts A list of strings representing extra flags that should be passed to the linker. List of strings optional []
minimum_deployment_os_version A required string indicating the minimum deployment OS version supported by the target, represented as a dotted version number (for example, "9.0"). This is different from minimum_os_version, which is effective at compile time. Ensure version specific APIs are guarded with available clauses. String optional ""
minimum_os_version A required string indicating the minimum OS version supported by the target, represented as a dotted version number (for example, "9.0"). String required
platform_type - String optional "macos"
provisioning_profile The provisioning profile (.provisionprofile file) to use when creating the bundle. This value is optional for simulator builds as the simulator doesn't fully enforce entitlements, but is required for device builds. Label optional None
shared_capabilities A list of shared apple_capability_set rules to represent the capabilities that a code sign aware Apple bundle rule output should have. These can define the formal prefix for the target's bundle_id and can further be merged with information provided by entitlements, if defined by any capabilities found within the apple_capability_set. List of labels optional []
stamp Enable link stamping. Whether to encode build information into the binary. Possible values:

* stamp = 1: Stamp the build information into the binary. Stamped binaries are only rebuilt when their dependencies change. Use this if there are tests that depend on the build information. * stamp = 0: Always replace build information by constant values. This gives good build result caching. * stamp = -1: Embedding of build information is controlled by the --[no]stamp flag.
Integer optional -1
strings A list of .strings files, often localizable. These files are converted to binary plists (if they are not already) and placed in the root of the final bundle, unless a file's immediate containing directory is named *.lproj, in which case it will be placed under a directory with the same name in the bundle. List of labels optional []
version An apple_bundle_version target that represents the version for this target. See apple_bundle_version. Label optional None

macos_spotlight_importer

macos_spotlight_importer(name, deps, resources, additional_contents, additional_linker_inputs,
                         bundle_id, bundle_id_suffix, bundle_name, codesign_inputs, codesignopts,
                         entitlements, entitlements_validation, executable_name,
                         exported_symbols_lists, families, infoplists, ipa_post_processor, linkopts,
                         minimum_deployment_os_version, minimum_os_version, platform_type,
                         provisioning_profile, shared_capabilities, stamp, strings, version)

Builds and bundles a macOS Spotlight Importer.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
deps A list of dependent targets that will be linked into this target's binary(s). Any resources, such as asset catalogs, that are referenced by those targets will also be transitively included in the final bundle(s). List of labels optional []
resources A list of resources or files bundled with the bundle. The resources will be stored in the appropriate resources location within the bundle. List of labels optional []
additional_contents Files that should be copied into specific subdirectories of the Contents folder in the bundle. The keys of this dictionary are labels pointing to single files, filegroups, or targets; the corresponding value is the name of the subdirectory of Contents where they should be placed.

The relative directory structure of filegroup contents is preserved when they are copied into the desired Contents subdirectory.
Dictionary: Label -> String optional {}
additional_linker_inputs A list of input files to be passed to the linker. List of labels optional []
bundle_id The bundle ID (reverse-DNS path followed by app name) for this target. Only use this attribute if the bundle ID is not intended to be composed through an assigned base bundle ID rule found within signed_capabilities. String optional ""
bundle_id_suffix A string to act as the suffix of the composed bundle ID. If this target's bundle ID is composed from a base bundle ID rule found within signed_capabilities, then this string will be appended to the end of the bundle ID following a "." separator. String optional "_"
bundle_name The desired name of the bundle (without the extension). If this attribute is not set, then the name of the target will be used instead. String optional ""
codesign_inputs A list of dependencies targets that provide inputs that will be used by codesign (referenced with codesignopts). List of labels optional []
codesignopts A list of strings representing extra flags that should be passed to codesign. List of strings optional []
entitlements The entitlements file required for device builds of this target. If absent, the default entitlements from the provisioning profile will be used.

The following variables are substituted in the entitlements file: $(CFBundleIdentifier) with the bundle ID of the application and $(AppIdentifierPrefix) with the value of the ApplicationIdentifierPrefix key from the target's provisioning profile.
Label optional None
entitlements_validation An entitlements_validation_mode to control the validation of the requested entitlements against the provisioning profile to ensure they are supported. String optional "loose"
executable_name The desired name of the executable, if the bundle has an executable. If this attribute is not set, then the name of the bundle_name attribute will be used if it is set; if not, then the name of the target will be used instead. String optional ""
exported_symbols_lists A list of targets containing exported symbols lists files for the linker to control symbol resolution.

Each file is expected to have a list of global symbol names that will remain as global symbols in the compiled binary owned by this framework. All other global symbols will be treated as if they were marked as __private_extern__ (aka visibility=hidden) and will not be global in the output file.

See the man page documentation for ld(1) on macOS for more details.
List of labels optional []
families A list of device families supported by this rule. At least one must be specified. List of strings optional ["mac"]
infoplists A list of .plist files that will be merged to form the Info.plist for this target. At least one file must be specified. Please see Info.plist Handling for what is supported. List of labels required
ipa_post_processor A tool that edits this target's archive after it is assembled but before it is signed. The tool is invoked with a single command-line argument that denotes the path to a directory containing the unzipped contents of the archive; this target's bundle will be the directory's only contents.

Any changes made by the tool must be made in this directory, and the tool's execution must be hermetic given these inputs to ensure that the result can be safely cached.
Label optional None
linkopts A list of strings representing extra flags that should be passed to the linker. List of strings optional []
minimum_deployment_os_version A required string indicating the minimum deployment OS version supported by the target, represented as a dotted version number (for example, "9.0"). This is different from minimum_os_version, which is effective at compile time. Ensure version specific APIs are guarded with available clauses. String optional ""
minimum_os_version A required string indicating the minimum OS version supported by the target, represented as a dotted version number (for example, "9.0"). String required
platform_type - String optional "macos"
provisioning_profile The provisioning profile (.provisionprofile file) to use when creating the bundle. This value is optional for simulator builds as the simulator doesn't fully enforce entitlements, but is required for device builds. Label optional None
shared_capabilities A list of shared apple_capability_set rules to represent the capabilities that a code sign aware Apple bundle rule output should have. These can define the formal prefix for the target's bundle_id and can further be merged with information provided by entitlements, if defined by any capabilities found within the apple_capability_set. List of labels optional []
stamp Enable link stamping. Whether to encode build information into the binary. Possible values:

* stamp = 1: Stamp the build information into the binary. Stamped binaries are only rebuilt when their dependencies change. Use this if there are tests that depend on the build information. * stamp = 0: Always replace build information by constant values. This gives good build result caching. * stamp = -1: Embedding of build information is controlled by the --[no]stamp flag.
Integer optional -1
strings A list of .strings files, often localizable. These files are converted to binary plists (if they are not already) and placed in the root of the final bundle, unless a file's immediate containing directory is named *.lproj, in which case it will be placed under a directory with the same name in the bundle. List of labels optional []
version An apple_bundle_version target that represents the version for this target. See apple_bundle_version. Label optional None

macos_static_framework

macos_static_framework(name, deps, resources, hdrs, additional_linker_inputs, avoid_deps,
                       bundle_name, codesign_inputs, codesignopts, exclude_resources, executable_name,
                       exported_symbols_lists, families, ipa_post_processor, linkopts,
                       minimum_deployment_os_version, minimum_os_version, platform_type, stamp,
                       strings, umbrella_header, version)

Builds and bundles a macOS static framework for third-party distribution.

A static framework is bundled like a dynamic framework except that the embedded binary is a static library rather than a dynamic library. It is intended to create distributable static SDKs or artifacts that can be easily imported into other Xcode projects; it is specifically not intended to be used as a dependency of other Bazel targets. For that use case, use the corresponding objc_library targets directly.

Unlike other macOS bundles, the fat binary in an macos_static_framework may simultaneously contain simulator and device architectures (that is, you can build a single framework artifact that works for all architectures by specifying --macos_cpus=x86_64,arm64 when you build).

macos_static_framework supports Swift, but there are some constraints:

  • macos_static_framework with Swift only works with Xcode 12 and above, since the required Swift functionality for module compatibility is available in Swift 5.1.
  • macos_static_framework only supports a single direct swift_library target that does not depend transitively on any other swift_library targets. The Swift compiler expects a framework to contain a single Swift module, and each swift_library target is its own module by definition.
  • macos_static_framework does not support mixed Objective-C and Swift public interfaces. This means that the umbrella_header and hdrs attributes are unavailable when using swift_library dependencies. You are allowed to depend on objc_library from the main swift_library dependency, but note that only the swift_library's public interface will be available to users of the static framework.

When using Swift, the macos_static_framework bundles swiftinterface and swiftdocs file for each of the required architectures. It also bundles an umbrella header which is the header generated by the single swift_library target. Finally, it also bundles a module.modulemap file pointing to the umbrella header for Objetive-C module compatibility. This umbrella header and modulemap can be skipped by disabling the swift.no_generated_header feature ( i.e. --features=-swift.no_generated_header).

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
deps A list of dependent targets that will be linked into this target's binary(s). Any resources, such as asset catalogs, that are referenced by those targets will also be transitively included in the final bundle(s). List of labels optional []
resources A list of resources or files bundled with the bundle. The resources will be stored in the appropriate resources location within the bundle. List of labels optional []
hdrs A list of .h files that will be publicly exposed by this framework. These headers should have framework-relative imports, and if non-empty, an umbrella header named %{bundle_name}.h will also be generated that imports all of the headers listed here. List of labels optional []
additional_linker_inputs A list of input files to be passed to the linker. List of labels optional []
avoid_deps A list of library targets on which this framework depends in order to compile, but the transitive closure of which will not be linked into the framework's binary. List of labels optional []
bundle_name The desired name of the bundle (without the extension). If this attribute is not set, then the name of the target will be used instead. String optional ""
codesign_inputs A list of dependencies targets that provide inputs that will be used by codesign (referenced with codesignopts). List of labels optional []
codesignopts A list of strings representing extra flags that should be passed to codesign. List of strings optional []
exclude_resources Indicates whether resources should be excluded from the bundle. This can be used to avoid unnecessarily bundling resources if the static framework is being distributed in a different fashion, such as a Cocoapod. Boolean optional False
executable_name The desired name of the executable, if the bundle has an executable. If this attribute is not set, then the name of the bundle_name attribute will be used if it is set; if not, then the name of the target will be used instead. String optional ""
exported_symbols_lists A list of targets containing exported symbols lists files for the linker to control symbol resolution.

Each file is expected to have a list of global symbol names that will remain as global symbols in the compiled binary owned by this framework. All other global symbols will be treated as if they were marked as __private_extern__ (aka visibility=hidden) and will not be global in the output file.

See the man page documentation for ld(1) on macOS for more details.
List of labels optional []
families A list of device families supported by this rule. At least one must be specified. List of strings optional ["mac"]
ipa_post_processor A tool that edits this target's archive after it is assembled but before it is signed. The tool is invoked with a single command-line argument that denotes the path to a directory containing the unzipped contents of the archive; this target's bundle will be the directory's only contents.

Any changes made by the tool must be made in this directory, and the tool's execution must be hermetic given these inputs to ensure that the result can be safely cached.
Label optional None
linkopts A list of strings representing extra flags that should be passed to the linker. List of strings optional []
minimum_deployment_os_version A required string indicating the minimum deployment OS version supported by the target, represented as a dotted version number (for example, "9.0"). This is different from minimum_os_version, which is effective at compile time. Ensure version specific APIs are guarded with available clauses. String optional ""
minimum_os_version A required string indicating the minimum OS version supported by the target, represented as a dotted version number (for example, "9.0"). String required
platform_type - String optional "macos"
stamp Enable link stamping. Whether to encode build information into the binary. Possible values:

* stamp = 1: Stamp the build information into the binary. Stamped binaries are only rebuilt when their dependencies change. Use this if there are tests that depend on the build information. * stamp = 0: Always replace build information by constant values. This gives good build result caching. * stamp = -1: Embedding of build information is controlled by the --[no]stamp flag.
Integer optional -1
strings A list of .strings files, often localizable. These files are converted to binary plists (if they are not already) and placed in the root of the final bundle, unless a file's immediate containing directory is named *.lproj, in which case it will be placed under a directory with the same name in the bundle. List of labels optional []
umbrella_header An optional single .h file to use as the umbrella header for this framework. Usually, this header will have the same name as this target, so that clients can load the header using the #import <MyFramework/MyFramework.h> format. If this attribute is not specified (the common use case), an umbrella header will be generated under the same name as this target. Label optional None
version An apple_bundle_version target that represents the version for this target. See apple_bundle_version. Label optional None

macos_ui_test

macos_ui_test(name, deps, data, bundle_name, env, minimum_deployment_os_version, minimum_os_version,
              platform_type, runner, test_coverage_manifest, test_filter, test_host,
              test_host_is_bundle_loader)

Builds and bundles an iOS UI .xctest test bundle. Runs the tests using the provided test runner when invoked with bazel test. When using Tulsi to run tests built with this target, runner will not be used since Xcode is the test runner in that case.

Note: macOS UI tests are not currently supported in the default test runner.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
deps - List of labels required
data Files to be made available to the test during its execution. List of labels optional []
bundle_name The desired name of the bundle (without the extension). If this attribute is not set, then the name of the target will be used instead. String optional ""
env Dictionary of environment variables that should be set during the test execution. The values of the dictionary are subject to "Make" variable expansion. Dictionary: String -> String optional {}
minimum_deployment_os_version A required string indicating the minimum deployment OS version supported by the target, represented as a dotted version number (for example, "9.0"). This is different from minimum_os_version, which is effective at compile time. Ensure version specific APIs are guarded with available clauses. String optional ""
minimum_os_version A required string indicating the minimum OS version supported by the target, represented as a dotted version number (for example, "9.0"). String required
platform_type - String optional "macos"
runner The runner target that will provide the logic on how to run the tests. Needs to provide the AppleTestRunnerInfo provider. Label required
test_coverage_manifest A file that will be used in lcov export calls to limit the scope of files instrumented with coverage. Label optional None
test_filter Test filter string that will be passed into the test runner to select which tests will run. String optional ""
test_host - Label optional None
test_host_is_bundle_loader Whether the 'test_host' should be used as the -bundle_loader to allow testing the symbols from the test host app Boolean optional True

macos_unit_test

macos_unit_test(name, deps, data, bundle_name, env, minimum_deployment_os_version,
                minimum_os_version, platform_type, runner, test_coverage_manifest, test_filter,
                test_host, test_host_is_bundle_loader)

Builds and bundles a macOS unit .xctest test bundle. Runs the tests using the provided test runner when invoked with bazel test. When using Tulsi to run tests built with this target, runner will not be used since Xcode is the test runner in that case.

macos_unit_test targets can work in two modes: as app or library tests. If the test_host attribute is set to an macos_application target, the tests will run within that application's context. If no test_host is provided, the tests will run outside the context of an macOS application. Because of this, certain functionalities might not be present (e.g. UI layout, NSUserDefaults). You can find more information about testing for Apple platforms here.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
deps - List of labels required
data Files to be made available to the test during its execution. List of labels optional []
bundle_name The desired name of the bundle (without the extension). If this attribute is not set, then the name of the target will be used instead. String optional ""
env Dictionary of environment variables that should be set during the test execution. The values of the dictionary are subject to "Make" variable expansion. Dictionary: String -> String optional {}
minimum_deployment_os_version A required string indicating the minimum deployment OS version supported by the target, represented as a dotted version number (for example, "9.0"). This is different from minimum_os_version, which is effective at compile time. Ensure version specific APIs are guarded with available clauses. String optional ""
minimum_os_version A required string indicating the minimum OS version supported by the target, represented as a dotted version number (for example, "9.0"). String required
platform_type - String optional "macos"
runner The runner target that will provide the logic on how to run the tests. Needs to provide the AppleTestRunnerInfo provider. Label required
test_coverage_manifest A file that will be used in lcov export calls to limit the scope of files instrumented with coverage. Label optional None
test_filter Test filter string that will be passed into the test runner to select which tests will run. String optional ""
test_host - Label optional None
test_host_is_bundle_loader Whether the 'test_host' should be used as the -bundle_loader to allow testing the symbols from the test host app Boolean optional True

macos_xpc_service

macos_xpc_service(name, deps, resources, additional_contents, additional_linker_inputs, bundle_id,
                  bundle_id_suffix, bundle_name, codesign_inputs, codesignopts, entitlements,
                  entitlements_validation, executable_name, exported_symbols_lists, families,
                  infoplists, ipa_post_processor, linkopts, minimum_deployment_os_version,
                  minimum_os_version, platform_type, provisioning_profile, shared_capabilities, stamp,
                  strings, version)

Builds and bundles a macOS XPC Service.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
deps A list of dependent targets that will be linked into this target's binary(s). Any resources, such as asset catalogs, that are referenced by those targets will also be transitively included in the final bundle(s). List of labels optional []
resources A list of resources or files bundled with the bundle. The resources will be stored in the appropriate resources location within the bundle. List of labels optional []
additional_contents Files that should be copied into specific subdirectories of the Contents folder in the bundle. The keys of this dictionary are labels pointing to single files, filegroups, or targets; the corresponding value is the name of the subdirectory of Contents where they should be placed.

The relative directory structure of filegroup contents is preserved when they are copied into the desired Contents subdirectory.
Dictionary: Label -> String optional {}
additional_linker_inputs A list of input files to be passed to the linker. List of labels optional []
bundle_id The bundle ID (reverse-DNS path followed by app name) for this target. Only use this attribute if the bundle ID is not intended to be composed through an assigned base bundle ID rule found within signed_capabilities. String optional ""
bundle_id_suffix A string to act as the suffix of the composed bundle ID. If this target's bundle ID is composed from a base bundle ID rule found within signed_capabilities, then this string will be appended to the end of the bundle ID following a "." separator. String optional "_"
bundle_name The desired name of the bundle (without the extension). If this attribute is not set, then the name of the target will be used instead. String optional ""
codesign_inputs A list of dependencies targets that provide inputs that will be used by codesign (referenced with codesignopts). List of labels optional []
codesignopts A list of strings representing extra flags that should be passed to codesign. List of strings optional []
entitlements The entitlements file required for device builds of this target. If absent, the default entitlements from the provisioning profile will be used.

The following variables are substituted in the entitlements file: $(CFBundleIdentifier) with the bundle ID of the application and $(AppIdentifierPrefix) with the value of the ApplicationIdentifierPrefix key from the target's provisioning profile.
Label optional None
entitlements_validation An entitlements_validation_mode to control the validation of the requested entitlements against the provisioning profile to ensure they are supported. String optional "loose"
executable_name The desired name of the executable, if the bundle has an executable. If this attribute is not set, then the name of the bundle_name attribute will be used if it is set; if not, then the name of the target will be used instead. String optional ""
exported_symbols_lists A list of targets containing exported symbols lists files for the linker to control symbol resolution.

Each file is expected to have a list of global symbol names that will remain as global symbols in the compiled binary owned by this framework. All other global symbols will be treated as if they were marked as __private_extern__ (aka visibility=hidden) and will not be global in the output file.

See the man page documentation for ld(1) on macOS for more details.
List of labels optional []
families A list of device families supported by this rule. At least one must be specified. List of strings optional ["mac"]
infoplists A list of .plist files that will be merged to form the Info.plist for this target. At least one file must be specified. Please see Info.plist Handling for what is supported. List of labels required
ipa_post_processor A tool that edits this target's archive after it is assembled but before it is signed. The tool is invoked with a single command-line argument that denotes the path to a directory containing the unzipped contents of the archive; this target's bundle will be the directory's only contents.

Any changes made by the tool must be made in this directory, and the tool's execution must be hermetic given these inputs to ensure that the result can be safely cached.
Label optional None
linkopts A list of strings representing extra flags that should be passed to the linker. List of strings optional []
minimum_deployment_os_version A required string indicating the minimum deployment OS version supported by the target, represented as a dotted version number (for example, "9.0"). This is different from minimum_os_version, which is effective at compile time. Ensure version specific APIs are guarded with available clauses. String optional ""
minimum_os_version A required string indicating the minimum OS version supported by the target, represented as a dotted version number (for example, "9.0"). String required
platform_type - String optional "macos"
provisioning_profile The provisioning profile (.provisionprofile file) to use when creating the bundle. This value is optional for simulator builds as the simulator doesn't fully enforce entitlements, but is required for device builds. Label optional None
shared_capabilities A list of shared apple_capability_set rules to represent the capabilities that a code sign aware Apple bundle rule output should have. These can define the formal prefix for the target's bundle_id and can further be merged with information provided by entitlements, if defined by any capabilities found within the apple_capability_set. List of labels optional []
stamp Enable link stamping. Whether to encode build information into the binary. Possible values:

* stamp = 1: Stamp the build information into the binary. Stamped binaries are only rebuilt when their dependencies change. Use this if there are tests that depend on the build information. * stamp = 0: Always replace build information by constant values. This gives good build result caching. * stamp = -1: Embedding of build information is controlled by the --[no]stamp flag.
Integer optional -1
strings A list of .strings files, often localizable. These files are converted to binary plists (if they are not already) and placed in the root of the final bundle, unless a file's immediate containing directory is named *.lproj, in which case it will be placed under a directory with the same name in the bundle. List of labels optional []
version An apple_bundle_version target that represents the version for this target. See apple_bundle_version. Label optional None