Bazel rules for creating macOS applications and bundles.

Rules

macos_application

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.

name

A unique name for this target.

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.

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.

binary_type

This attribute is public as an implementation detail while we migrate the architecture of the rules. Do not change its value.

bundle_extension

The extension, without a leading dot, that will be used to name the bundle. If this attribute is not set, then the default extension is determined by the application's product_type.

bundle_id

The bundle ID (reverse-DNS path followed by app name) for this target.

bundle_loader

This attribute is public as an implementation detail while we migrate the architecture of the rules. Do not change its value.

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.

codesign_inputs

A list of dependencies targets that provide inputs that will be used by codesign (referenced with codesignopts).

codesignopts

A list of strings representing extra flags that should be passed to codesign.

deps

A list of dependencies targets that will be linked into this target's binary. Any resources, such as asset catalogs, that are referenced by those targets will also be transitively included in the final bundle.

dylibs

This attribute is public as an implementation detail while we migrate the architecture of the rules. Do not change its value.

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.

entitlements_validation

An entitlements_validation_mode to control the validation of the requested entitlements against the provisioning profile to ensure they are supported.

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.

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.

extensions

A list of macOS extensions to include in the final application bundle.

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.

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.

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.

linkopts

A list of strings representing extra flags that should be passed to the linker.

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").

platform_type

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.

resources

A list of resources or files bundled with the bundle. The resources will be stored in the appropriate resources location within the bundle.

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.

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.

version

An apple_bundle_version target that represents the version for this target. See apple_bundle_version.

xpc_services

A list of macOS XPC Services to include in the final application bundle.

macos_build_test

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",
    ],
)

name

A unique name for this target.

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").

platform_type

targets

The targets to check for successful build.

macos_bundle

Builds and bundles a macOS Loadable Bundle.

name

A unique name for this target.

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.

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.

binary_type

This attribute is public as an implementation detail while we migrate the architecture of the rules. Do not change its value.

bundle_extension

The extension, without a leading dot, that will be used to name the bundle. If this attribute is not set, then the default extension is determined by the application's product_type.

bundle_id

The bundle ID (reverse-DNS path followed by app name) for this target.

bundle_loader

This attribute is public as an implementation detail while we migrate the architecture of the rules. Do not change its value.

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.

codesign_inputs

A list of dependencies targets that provide inputs that will be used by codesign (referenced with codesignopts).

codesignopts

A list of strings representing extra flags that should be passed to codesign.

deps

A list of dependencies targets that will be linked into this target's binary. Any resources, such as asset catalogs, that are referenced by those targets will also be transitively included in the final bundle.

dylibs

This attribute is public as an implementation detail while we migrate the architecture of the rules. Do not change its value.

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.

entitlements_validation

An entitlements_validation_mode to control the validation of the requested entitlements against the provisioning profile to ensure they are supported.

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.

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.

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.

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.

linkopts

A list of strings representing extra flags that should be passed to the linker.

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").

platform_type

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.

resources

A list of resources or files bundled with the bundle. The resources will be stored in the appropriate resources location within the bundle.

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.

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.

version

An apple_bundle_version target that represents the version for this target. See apple_bundle_version.

macos_command_line_application

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.

name

A unique name for this target.

binary_type

This attribute is public as an implementation detail while we migrate the architecture of the rules. Do not change its value.

bundle_id

The bundle ID (reverse-DNS path followed by app name) of the command line application. If present, this value will be embedded in an Info.plist in the application binary.

bundle_loader

This attribute is public as an implementation detail while we migrate the architecture of the rules. Do not change its value.

codesign_inputs

A list of dependencies targets that provide inputs that will be used by codesign (referenced with codesignopts).

codesignopts

A list of strings representing extra flags that should be passed to codesign.

deps

A list of dependencies targets that will be linked into this target's binary. Any resources, such as asset catalogs, that are referenced by those targets will also be transitively included in the final bundle.

dylibs

This attribute is public as an implementation detail while we migrate the architecture of the rules. Do not change its value.

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.

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.

launchdplists

linkopts

A list of strings representing extra flags that should be passed to the linker.

minimum_os_version

A required string indicating the minimum OS version supported by the target, represented as a dotted version number (for example, "10.11").

platform_type

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.

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.

version

An apple_bundle_version target that represents the version for this target. See apple_bundle_version.

macos_dylib

Builds a macOS Dylib binary.

name

A unique name for this target.

binary_type

This attribute is public as an implementation detail while we migrate the architecture of the rules. Do not change its value.

bundle_id

The bundle ID (reverse-DNS path followed by app name) of the command line application. If present, this value will be embedded in an Info.plist in the application binary.

bundle_loader

This attribute is public as an implementation detail while we migrate the architecture of the rules. Do not change its value.

codesign_inputs

A list of dependencies targets that provide inputs that will be used by codesign (referenced with codesignopts).

codesignopts

A list of strings representing extra flags that should be passed to codesign.

deps

A list of dependencies targets that will be linked into this target's binary. Any resources, such as asset catalogs, that are referenced by those targets will also be transitively included in the final bundle.

dylibs

This attribute is public as an implementation detail while we migrate the architecture of the rules. Do not change its value.

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.

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.

linkopts

A list of strings representing extra flags that should be passed to the linker.

minimum_os_version

A required string indicating the minimum OS version supported by the target, represented as a dotted version number (for example, "10.11").

platform_type

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.

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.

version

An apple_bundle_version target that represents the version for this target. See apple_bundle_version.

macos_extension

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). If you are building a Widget Extension, you must set provides_main = True to indicate that your code provides the entry point so that Bazel doesn't direct the linker to use the system framework's entry point instead.

name

A unique name for this target.

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.

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.

binary_type

This attribute is public as an implementation detail while we migrate the architecture of the rules. Do not change its value.

bundle_id

The bundle ID (reverse-DNS path followed by app name) for this target.

bundle_loader

This attribute is public as an implementation detail while we migrate the architecture of the rules. Do not change its value.

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.

codesign_inputs

A list of dependencies targets that provide inputs that will be used by codesign (referenced with codesignopts).

codesignopts

A list of strings representing extra flags that should be passed to codesign.

deps

A list of dependencies targets that will be linked into this target's binary. Any resources, such as asset catalogs, that are referenced by those targets will also be transitively included in the final bundle.

dylibs

This attribute is public as an implementation detail while we migrate the architecture of the rules. Do not change its value.

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.

entitlements_validation

An entitlements_validation_mode to control the validation of the requested entitlements against the provisioning profile to ensure they are supported.

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.

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.

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.

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.

linkopts

A list of strings representing extra flags that should be passed to the linker.

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").

platform_type

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.

resources

A list of resources or files bundled with the bundle. The resources will be stored in the appropriate resources location within the bundle.

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.

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.

version

An apple_bundle_version target that represents the version for this target. See apple_bundle_version.

macos_kernel_extension

Builds and bundles a macOS Kernel Extension.

name

A unique name for this target.

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.

binary_type

This attribute is public as an implementation detail while we migrate the architecture of the rules. Do not change its value.

bundle_id

The bundle ID (reverse-DNS path followed by app name) for this target.

bundle_loader

This attribute is public as an implementation detail while we migrate the architecture of the rules. Do not change its value.

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.

codesign_inputs

A list of dependencies targets that provide inputs that will be used by codesign (referenced with codesignopts).

codesignopts

A list of strings representing extra flags that should be passed to codesign.

deps

A list of dependencies targets that will be linked into this target's binary. Any resources, such as asset catalogs, that are referenced by those targets will also be transitively included in the final bundle.

dylibs

This attribute is public as an implementation detail while we migrate the architecture of the rules. Do not change its value.

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.

entitlements_validation

An entitlements_validation_mode to control the validation of the requested entitlements against the provisioning profile to ensure they are supported.

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.

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.

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.

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.

linkopts

A list of strings representing extra flags that should be passed to the linker.

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").

platform_type

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.

resources

A list of resources or files bundled with the bundle. The resources will be stored in the appropriate resources location within the bundle.

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.

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.

version

An apple_bundle_version target that represents the version for this target. See apple_bundle_version.

macos_spotlight_importer

Builds and bundles a macOS Spotlight Importer.

name

A unique name for this target.

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.

binary_type

This attribute is public as an implementation detail while we migrate the architecture of the rules. Do not change its value.

bundle_id

The bundle ID (reverse-DNS path followed by app name) for this target.

bundle_loader

This attribute is public as an implementation detail while we migrate the architecture of the rules. Do not change its value.

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.

codesign_inputs

A list of dependencies targets that provide inputs that will be used by codesign (referenced with codesignopts).

codesignopts

A list of strings representing extra flags that should be passed to codesign.

deps

A list of dependencies targets that will be linked into this target's binary. Any resources, such as asset catalogs, that are referenced by those targets will also be transitively included in the final bundle.

dylibs

This attribute is public as an implementation detail while we migrate the architecture of the rules. Do not change its value.

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.

entitlements_validation

An entitlements_validation_mode to control the validation of the requested entitlements against the provisioning profile to ensure they are supported.

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.

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.

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.

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.

linkopts

A list of strings representing extra flags that should be passed to the linker.

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").

platform_type

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.

resources

A list of resources or files bundled with the bundle. The resources will be stored in the appropriate resources location within the bundle.

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.

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.

version

An apple_bundle_version target that represents the version for this target. See apple_bundle_version.

macos_ui_test

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.

name

A unique name for this target.

data

Files to be made available to the test during its execution.

deps

env

Dictionary of environment variables that should be set during the test execution.

platform_type

runner

The runner target that will provide the logic on how to run the tests. Needs to provide the AppleTestRunnerInfo provider.

test_host

macos_unit_test

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.

name

A unique name for this target.

data

Files to be made available to the test during its execution.

deps

env

Dictionary of environment variables that should be set during the test execution.

platform_type

runner

The runner target that will provide the logic on how to run the tests. Needs to provide the AppleTestRunnerInfo provider.

test_host

macos_xpc_service

Builds and bundles a macOS XPC Service.

name

A unique name for this target.

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.

binary_type

This attribute is public as an implementation detail while we migrate the architecture of the rules. Do not change its value.

bundle_id

The bundle ID (reverse-DNS path followed by app name) for this target.

bundle_loader

This attribute is public as an implementation detail while we migrate the architecture of the rules. Do not change its value.

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.

codesign_inputs

A list of dependencies targets that provide inputs that will be used by codesign (referenced with codesignopts).

codesignopts

A list of strings representing extra flags that should be passed to codesign.

deps

A list of dependencies targets that will be linked into this target's binary. Any resources, such as asset catalogs, that are referenced by those targets will also be transitively included in the final bundle.

dylibs

This attribute is public as an implementation detail while we migrate the architecture of the rules. Do not change its value.

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.

entitlements_validation

An entitlements_validation_mode to control the validation of the requested entitlements against the provisioning profile to ensure they are supported.

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.

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.

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.

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.

linkopts

A list of strings representing extra flags that should be passed to the linker.

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").

platform_type

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.

resources

A list of resources or files bundled with the bundle. The resources will be stored in the appropriate resources location within the bundle.

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.

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.

version

An apple_bundle_version target that represents the version for this target. See apple_bundle_version.