Try the new Bazel Central Registry UI →
rules_appleAPI docs @5.0.0-rc2

@rules_apple@rules_apple//apple:apple.bzl

Rules that apply to all Apple platforms.

Rules

apple_dynamic_framework_import

This rule encapsulates an already-built dynamic framework. It is defined by a list of
files in exactly one .framework directory. apple_dynamic_framework_import targets
need to be added to library targets through the deps attribute.

Examples

apple_dynamic_framework_import( name = "my_dynamic_framework", framework_imports = glob(["my_dynamic_framework.framework/**"]), ) objc_library( name = "foo_lib", ..., deps = [ ":my_dynamic_framework", ], )
AttributeTypeDescription
*namename

A unique name for this target.

*framework_importslist of labels

The list of files under a .framework directory which are provided to Apple based targets that depend
on this target.

depslist of labels

A list of targets that are dependencies of the target being built, which will be linked into that
target.

Default: []
dsym_importslist of labels

The list of files under a .dSYM directory, that is the imported framework's dSYM bundle.

Default: []
bundle_onlyboolean

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.

Default: False
apple_dynamic_xcframework_import

This rule encapsulates an already-built XCFramework. Defined by a list of files in a .xcframework
directory. apple_xcframework_import targets need to be added as dependencies to library targets
through the deps attribute.

Example

apple_dynamic_xcframework_import( name = "my_dynamic_xcframework", xcframework_imports = glob(["my_dynamic_framework.xcframework/**"]), ) objc_library( name = "foo_lib", ..., deps = [ ":my_dynamic_xcframework", ], )
AttributeTypeDescription
*namename

A unique name for this target.

*xcframework_importslist of labels

List of files under a .xcframework directory which are provided to Apple based targets that depend
on this target.

depslist of labels

List of targets that are dependencies of the target being built, which will provide headers and be
linked into that target.

Default: []
bundle_onlyboolean

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.

Default: False
library_identifiersdictionary: String → String

Unnecssary and ignored, will be removed in the future.

Default: {}
apple_static_framework_import

This rule encapsulates an already-built static framework. It is defined by a list of
files in exactly one .framework directory. apple_static_framework_import targets
need to be added to library targets through the deps attribute.

Examples

apple_static_framework_import( name = "my_static_framework", framework_imports = glob(["my_static_framework.framework/**"]), ) objc_library( name = "foo_lib", ..., deps = [ ":my_static_framework", ], )
AttributeTypeDescription
*namename

A unique name for this target.

*framework_importslist of labels

The list of files under a .framework directory which are provided to Apple based targets that depend
on this target.

sdk_dylibslist of strings

Names of SDK .dylib libraries to link with. For instance, libz or libarchive. libc++ is
included automatically if the binary has any C++ or Objective-C++ sources in its dependency tree.
When linking a binary, all libraries named in that binary's transitive dependency graph are used.

Default: []
sdk_frameworkslist of strings

Names of SDK frameworks to link with (e.g. AddressBook, QuartzCore). UIKit and Foundation
are always included when building for the iOS, tvOS, visionOS, and watchOS platforms. For macOS, only
Foundation is always included. When linking a top level binary, all SDK frameworks listed in that
binary's transitive dependency graph are linked.

Default: []
weak_sdk_frameworkslist of strings

Names of SDK frameworks to weakly link with. For instance, MediaAccessibility. In difference to
regularly linked SDK frameworks, symbols from weakly linked frameworks do not cause an error if they
are not present at runtime.

Default: []
depslist of labels

A list of targets that are dependencies of the target being built, which will provide headers and be
linked into that target.

Default: []
datalist of labels

List of files needed by this target at runtime.

Files and targets named in the data attribute will appear in the *.runfiles
area of this target, if it has one. This may include data files needed by a
binary or library, or other programs needed by it.

Default: []
alwayslinkboolean

If true, any binary that depends (directly or indirectly) on this framework will link in all the
object files for the framework file, even if some contain no symbols referenced by the binary. This
is useful if your code isn't explicitly called by code in the binary; for example, if you rely on
runtime checks for protocol conformances added in extensions in the library but do not directly
reference any other symbols in the object file that adds that conformance.

Default: False
has_swiftboolean

A boolean indicating if the target has Swift source code. This helps flag Apple frameworks that do
not include Swift interface or Swift module files.

Default: False
apple_static_library

This rule produces single- or multi-architecture ("fat") static libraries targeting
Apple platforms.

The lipo tool is used to combine files of multiple architectures. One of
several flags may control which architectures are included in the output,
depending on the value of the platform_type attribute.

NOTE: In most situations, users should prefer the platform- and
product-type-specific rules, such as apple_static_xcframework. This
rule is being provided for the purpose of transitioning users from the built-in
implementation of apple_static_library in Bazel core so that it can be removed.

AttributeTypeDescription
*namename

A unique name for this target.

additional_linker_inputslist of labels

A list of input files to be passed to the linker.

Default: []
avoid_depslist of labels

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.

Default: []
datalist of labels

Files to be made available to the library archive upon execution.

Default: []
depslist of labels

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.

Default: []
linkoptslist of strings

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

Default: []
*minimum_os_versionstring

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

*platform_typestring

The target Apple platform for which to create a binary. This dictates which SDK
is used for compilation/linking and which flag is used to determine the
architectures to target. For example, if ios is specified, then the output
binaries/libraries will be created combining all architectures specified by
--ios_multi_cpus. Options are:

  • ios: architectures gathered from --ios_multi_cpus.
  • macos: architectures gathered from --macos_cpus.
  • tvos: architectures gathered from --tvos_cpus.
  • visionos: architectures gathered from --visionos_cpus.
  • watchos: architectures gathered from --watchos_cpus.
sdk_frameworkslist of strings

Names of SDK frameworks to link with (e.g., AddressBook, QuartzCore).
UIKit and Foundation are always included, even if this attribute is
provided and does not list them.

This attribute is discouraged; in general, targets should list system
framework dependencies in the library targets where that framework is used,
not in the top-level bundle.

Default: []
sdk_dylibslist of strings

Names of SDK .dylib libraries to link with (e.g., libz or libarchive).
libc++ is included automatically if the binary has any C++ or Objective-C++
sources in its dependency tree. When linking a binary, all libraries named in
that binary's transitive dependency graph are used.

Default: []
weak_sdk_frameworkslist of strings

Names of SDK frameworks to weakly link with (e.g., MediaAccessibility).
Unlike regularly linked SDK frameworks, symbols from weakly linked
frameworks do not cause the binary to fail to load if they are not present in
the version of the framework available at runtime.

This attribute is discouraged; in general, targets should list system
framework dependencies in the library targets where that framework is used,
not in the top-level bundle.

Default: []
apple_static_xcframework

Generates an XCFramework with static libraries for third-party distribution.

AttributeTypeDescription
*namename

A unique name for this target.

bundle_idstring

Optional bundle ID (reverse-DNS path followed by framework name) for each of the embedded frameworks.
If present, this value will be embedded in an Info.plist within each framework bundle, similar to
apple_xcframework (dynamic frameworks).

Default: ""
executable_namestring

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.

Default: ""
avoid_depslist of labels

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, nor bundled into final XCFramework.

Default: []
bundle_namestring

The desired name of the XCFramework bundle (without the extension) and the binaries for all embedded
static libraries. If this attribute is not set, then the name of the target will be used instead.

Default: ""
*depslist of labels

A list of files directly referencing libraries to be represented for each given platform split in
the XCFramework. These libraries will be embedded within each platform split.

families_requireddictionary: String → List of strings

A list of device families supported by this extension, with platforms such as ios as keys. Valid
values are iphone and ipad for ios; at least one must be specified if a platform is defined.
Currently, this only affects processing of ios resources.

Default: {}
infoplistslist of labels

A list of .plist files that will be merged to form the Info.plist for each of the embedded
frameworks. Only used if bundle_id is provided.

Default: []
iosdictionary: String → List of strings

A dictionary of strings indicating which platform variants should be built for the ios platform (
device or simulator) as keys, and arrays of strings listing which architectures should be
built for those platform variants (for example, x86_64, arm64) as their values.

Default: {}
macoslist of strings

A list of strings indicating which architecture should be built for the macOS platform (for example, x86_64, arm64).

Default: []
tvosdictionary: String → List of strings

A dictionary of strings indicating which platform variants should be built for the tvOS platform (
device or simulator) as keys, and arrays of strings listing which architectures should be
built for those platform variants (for example, x86_64, arm64) as their values.

Default: {}
visionosdictionary: String → List of strings

A dictionary of strings indicating which platform variants should be built for the visionOS platform
(device or simulator) as keys, and arrays of strings listing which architectures should be
built for those platform variants (for example, arm64) as their values.

Default: {}
minimum_deployment_os_versionsdictionary: String → String

A dictionary of strings indicating the minimum deployment OS version supported by the target,
represented as a dotted version number (for example, "9.0") as values, with their respective
platforms such as ios as keys. This is different from minimum_os_versions, which is effective
at compile time. Ensure version specific APIs are guarded with available clauses.

Default: {}
*minimum_os_versionsdictionary: String → String

A dictionary of strings indicating the minimum OS version supported by the target, represented as a
dotted version number (for example, "8.0") as values, with their respective platforms such as ios,
tvos, or visionos as keys:

minimum_os_versions = {
    "ios": "13.0",
    "tvos": "15.0",
    "visionos": "1.0",
}
public_hdrslist of labels

A list of files directly referencing header files to be used as the publicly visible interface for
each of these embedded libraries. These header files will be embedded within each platform split,
typically in a subdirectory such as Headers.

Default: []
umbrella_headerlabel

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.

Default: None
versionlabel

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

Default: None
apple_static_xcframework_import

This rule encapsulates an already-built XCFramework with static libraries. Defined by a list of
files in a .xcframework directory. apple_xcframework_import targets need to be added as dependencies
to library targets through the deps attribute.

Examples

apple_static_xcframework_import( name = "my_static_xcframework", xcframework_imports = glob(["my_static_framework.xcframework/**"]), ) objc_library( name = "foo_lib", ..., deps = [ ":my_static_xcframework", ], )
AttributeTypeDescription
*namename

A unique name for this target.

alwayslinkboolean

If true, any binary that depends (directly or indirectly) on this XCFramework will link in all the
object files for the XCFramework bundle, even if some contain no symbols referenced by the binary.
This is useful if your code isn't explicitly called by code in the binary; for example, if you rely
on runtime checks for protocol conformances added in extensions in the library but do not directly
reference any other symbols in the object file that adds that conformance.

Default: False
depslist of labels

List of targets that are dependencies of the target being built, which will provide headers and be
linked into that target.

Default: []
datalist of labels

List of files needed by this target at runtime.

Files and targets named in the data attribute will appear in the *.runfiles
area of this target, if it has one. This may include data files needed by a
binary or library, or other programs needed by it.

Default: []
has_swiftboolean

A boolean indicating if the target has Swift source code. This helps flag XCFrameworks that do not
include Swift interface files.

Default: False
includeslist of strings

List of #include/#import search paths to add to this target and all depending
targets.

The paths are interpreted relative to the single platform directory inside the
XCFramework for the platform being built.

These flags are added for this rule and every rule that depends on it. (Note:
not the rules it depends upon!) Be very careful, since this may have
far-reaching effects.

Default: []
linkoptslist of strings

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

Default: []
sdk_dylibslist of strings

Names of SDK .dylib libraries to link with. For instance, libz or libarchive. libc++ is
included automatically if the binary has any C++ or Objective-C++ sources in its dependency tree.
When linking a binary, all libraries named in that binary's transitive dependency graph are used.

Default: []
sdk_frameworkslist of strings

Names of SDK frameworks to link with (e.g. AddressBook, QuartzCore). UIKit and Foundation
are always included when building for the iOS, tvOS, visionOS and watchOS platforms. For macOS, only
Foundation is always included. When linking a top level binary, all SDK frameworks listed in that
binary's transitive dependency graph are linked.

Default: []
weak_sdk_frameworkslist of strings

Names of SDK frameworks to weakly link with. For instance, MediaAccessibility. In difference to
regularly linked SDK frameworks, symbols from weakly linked frameworks do not cause an error if they
are not present at runtime.

Default: []
*xcframework_importslist of labels

List of files under a .xcframework directory which are provided to Apple based targets that depend
on this target.

library_identifiersdictionary: String → String

Unnecssary and ignored, will be removed in the future.

Default: {}
apple_universal_binary

This rule produces a multi-architecture ("fat") binary targeting Apple platforms.
The lipo tool is used to combine built binaries of multiple architectures.

AttributeTypeDescription
*namename

A unique name for this target.

*minimum_os_versionstring

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

minimum_deployment_os_versionstring

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.

Default: ""
*platform_typestring

The target Apple platform for which to create a binary. This dictates which SDK
is used for compilation/linking and which flag is used to determine the
architectures to target. For example, if ios is specified, then the output
binaries/libraries will be created combining all architectures specified by
--ios_multi_cpus. Options are:

  • ios: architectures gathered from --ios_multi_cpus.
  • macos: architectures gathered from --macos_cpus.
  • tvos: architectures gathered from --tvos_cpus.
  • watchos: architectures gathered from --watchos_cpus.
*binarylabel

Target to generate a 'fat' binary from.

forced_cpuslist of strings

An optional list of target CPUs for which the universal binary should be built.

If this attribute is present, the value of the platform-specific CPU flag (--ios_multi_cpus,
--macos_cpus, --tvos_cpus, --visionos_cpus, or --watchos_cpus) will be ignored and the
binary will be built for all of the specified architectures instead.

This is primarily useful to force macOS tools to be built as universal binaries using
forced_cpus = ["x86_64", "arm64"], without requiring the user to pass additional flags when
invoking Bazel.

Default: []
apple_xcframework

Builds and bundles an XCFramework for third-party distribution.

AttributeTypeDescription
*namename

A unique name for this target.

codesign_inputslist of labels

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

Default: []
codesignoptslist of strings

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

Default: []
exported_symbols_listslist of labels

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.

Default: []
linkoptslist of strings

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

Default: []
additional_linker_inputslist of labels

A list of input files to be passed to the linker.

Default: []
stampinteger

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.
Default: -1
depslist of labels

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

Default: []
*bundle_idstring

The bundle ID (reverse-DNS path followed by app name) for each of the embedded frameworks. If
present, this value will be embedded in an Info.plist within each framework bundle.

bundle_namestring

The desired name of the xcframework bundle (without the extension) and the bundles for all embedded
frameworks. If this attribute is not set, then the name of the target will be used instead.

Default: ""
datalist of labels

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

Default: []
extension_safeboolean

If true, compiles and links this framework with -application-extension, restricting the binary to
use only extension-safe APIs.

Default: False
families_requireddictionary: String → List of strings

A list of device families supported by this extension, with platforms such as ios as keys. Valid
values are iphone and ipad for ios; at least one must be specified if a platform is defined.
Currently, this only affects processing of ios resources.

Default: {}
*infoplistslist of labels

A list of .plist files that will be merged to form the Info.plist for each of the embedded
frameworks. At least one file must be specified. Please see
Info.plist Handling
for what is supported.

iosdictionary: String → List of strings

A dictionary of strings indicating which platform variants should be built for the iOS platform (
device or simulator) as keys, and arrays of strings listing which architectures should be
built for those platform variants (for example, x86_64, arm64) as their values.

Default: {}
macoslist of strings

A list of strings indicating which architecture should be built for the macOS platform (for example, x86_64, arm64).

Default: []
tvosdictionary: String → List of strings

A dictionary of strings indicating which platform variants should be built for the tvOS platform (
device or simulator) as keys, and arrays of strings listing which architectures should be
built for those platform variants (for example, x86_64, arm64) as their values.

Default: {}
visionosdictionary: String → List of strings

A dictionary of strings indicating which platform variants should be built for the visionOS platform
(device or simulator) as keys, and arrays of strings listing which architectures should be
built for those platform variants (for example, arm64) as their values.

Default: {}
minimum_deployment_os_versionsdictionary: String → String

A dictionary of strings indicating the minimum deployment OS version supported by the target,
represented as a dotted version number (for example, "9.0") as values, with their respective
platforms such as ios as keys. This is different from minimum_os_versions, which is effective
at compile time. Ensure version specific APIs are guarded with available clauses.

Default: {}
*minimum_os_versionsdictionary: String → String

A dictionary of strings indicating the minimum OS version supported by the target, represented as a
dotted version number (for example, "8.0") as values, with their respective platforms such as ios,
or tvos as keys:

minimum_os_versions = {
    "ios": "13.0",
    "tvos": "15.0",
    "visionos": "1.0",
}
public_hdrslist of labels

A list of files directly referencing header files to be used as the publicly visible interface for
each of these embedded frameworks. These header files will be embedded within each bundle,
typically in a subdirectory such as Headers.

Default: []
versionlabel

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

Default: None
umbrella_headerlabel

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.

Default: None
local_provisioning_profile

This rule declares a bazel target that you can pass to the
provisioning_profile attribute of rules that support it. It discovers a
provisioning profile for the given attributes either on the user's local
machine, or with the optional fallback_profiles passed to
provisioning_profile_repository.

This rule will automatically pick the newest
profile if there are multiple profiles matching the given criteria.

By default this rule will search for a .mobileprovision file with the same name
as the rule itself, you can pass profile_name to use a different name, you
can pass team_id if you'd like to disambiguate between 2 Apple developer accounts
that have the same profile name. You may also pass .provisionprofile to
profile_extension to search for a macOS provisioning profile instead.

Example

load("//apple:apple.bzl", "local_provisioning_profile") local_provisioning_profile( name = "app_debug_profile", profile_name = "Development App", team_id = "abc123", ) ios_application( name = "app", ... provisioning_profile = ":app_debug_profile", ) local_provisioning_profile( name = "app_release_profile", ) ios_application( name = "release_app", ... provisioning_profile = ":app_release_profile", )
AttributeTypeDescription
*namename

A unique name for this target.

profile_extensionstring

The extension for the provisioning profile which may differ by platform.

Default: ".mobileprovision"
profile_namestring

Name of the profile to use, if it's not provided the name of the rule is used

Default: ""
team_idstring

Team ID of the profile to find. This is useful for disambiguating between multiple profiles with the same name on different developer accounts.

Default: ""

Module Extensions

provisioning_profile_repository_extension

See provisioning_profile_repository for more information and examples.

Tag Classes
setup
AttributeTypeDescription
fallback_profileslabel
Default: None

Repository Rules

provisioning_profile_repository

This rule declares an external repository for discovering locally installed
provisioning profiles. This is consumed by local_provisioning_profile.
You can optionally set 'fallback_profiles' to point at a stable location of
profiles if a newer version of the desired profile does not exist on the local
machine. This is useful for checking in the current version of the profile, but
not having to update it every time a new device or certificate is added.

Example

In your MODULE.bazel file:

You only need this in the case you want to setup fallback profiles, otherwise
it can be ommitted when using bzlmod.

provisioning_profile_repository = use_extension("@rules_apple//apple:apple.bzl", "provisioning_profile_repository_extension") provisioning_profile_repository.setup( fallback_profiles = "//path/to/some:filegroup", # Profiles to use if one isn't found locally )

In your BUILD files (see local_provisioning_profile for more examples):

load("//apple:apple.bzl", "local_provisioning_profile") local_provisioning_profile( name = "app_debug_profile", profile_name = "Development App", team_id = "abc123", ) ios_application( name = "app", ... provisioning_profile = ":app_debug_profile", )
Environment Variables
HOME
AttributeTypeDescription
*namename

A unique name for this repository.

fallback_profileslabel
Default: None

@rules_apple@rules_apple//apple:docc.bzl

Defines rules for building Apple DocC targets.

Rules

docc_archive

Builds a .doccarchive for the given dependency.
The target created by this rule can also be run to preview the generated documentation in Xcode.

NOTE: At this time Swift is the only supported language for this rule.

Example:

load("@rules_apple//apple:docc.bzl", "docc_archive") docc_archive( name = "Lib.doccarchive", dep = ":Lib", fallback_bundle_identifier = "com.example.lib", fallback_bundle_version = "1.0.0", fallback_display_name = "Lib", )
AttributeTypeDescription
*namename

A unique name for this target.

deplabel
Default: None
default_code_listing_languagestring

A fallback default language for code listings if no value is provided in the documentation bundle's Info.plist file.

Default: ""
diagnostic_levelstring

Filters diagnostics above this level from output
This filter level is inclusive. If a level of information is specified, diagnostics with a severity up to and including information will be printed.
Must be one of "error", "warning", "information", or "hint"

Default: ""
emit_extension_block_symbolsstring

Defines if the symbol graph information for extension blocks should be
emitted in addition to the default symbol graph information.

This value must be either "0" or "1".When the value is "1", the symbol
graph information for extension blocks will be emitted in addition to
the default symbol graph information. The default value is "0".

Default: "0"
enable_inherited_docsboolean

Inherit documentation for inherited symbols.

Default: False
*fallback_bundle_identifierstring

A fallback bundle identifier if no value is provided in the documentation bundle's Info.plist file.

*fallback_bundle_versionstring

A fallback bundle version if no value is provided in the documentation bundle's Info.plist file.

*fallback_display_namestring

A fallback display name if no value is provided in the documentation bundle's Info.plist file.

hosting_base_pathstring

The base path your documentation website will be hosted at. For example, to deploy your site to 'example.com/my_name/my_project/documentation' instead of 'example.com/documentation', pass '/my_name/my_project' as the base path.

Default: ""
kindslist of strings

The kinds of entities to filter generated documentation for.

Default: []
minimum_access_levelstring

"
The minimum access level of the declarations that should be emitted in the symbol graphs.
This value must be either fileprivate, internal, private, or public. The default value is public.

Default: "public"
transform_for_static_hostingboolean
Default: True

@rules_apple@rules_apple//apple:dtrace.bzl

Bazel rules for working with dtrace.

Rules

dtrace_compile

Compiles
dtrace files with probes
to generate header files to use those probes in C languages. The header files
generated will have the same name as the source files but with a .h
extension. Headers will be generated in a label scoped workspace relative file
structure. For example with a directory structure of

  Workspace
  foo/
    bar.d

and a target named dtrace_gen the header path would be
<GENFILES>/dtrace_gen/foo/bar.h.

AttributeTypeDescription
*namename

A unique name for this target.

dtracelabel

dtrace binary to use.

Default: None
srcslist of labels

dtrace(.d) source files to be compiled.

Default: []

@rules_apple@rules_apple//apple:header_map.bzl

Rules for creating header maps.

Rules

header_map

Creates a binary .hmap file from the given headers suitable for passing to clang.

Headermaps can be used in -I and -iquote compile flags (as well as in includes) to tell clang where to find headers.
This can be used to allow headers to be imported at a consistent path regardless of the package structure being used.

For example, if you have a package structure like this:

```
MyLib/
    headers/
        MyLib.h
    MyLib.c
    BUILD
```

And you want to import MyLib.h from MyLib.c using angle bracket imports: #import <MyLib/MyLib.h>
You can create a header map like this:

```bzl
header_map(
    name = "MyLib.hmap",
    hdrs = ["headers/MyLib.h"],
)
```

This generates a binary headermap that looks like:

```
MyLib.h -> headers/MyLib.h
MyLib/MyLib.h -> headers/MyLib.h
```

Then update deps, copts and includes to use the header map:

```bzl
objc_library(
    name = "MyLib",
    module_name = "MyLib",
    srcs = ["MyLib.c"],
    hdrs = ["headers/MyLib.h"],
    deps = [":MyLib.hmap"],
    copts = ["-I.]
    includes = ["MyLib.hmap"]
)
```
AttributeTypeDescription
*namename

A unique name for this target.

module_namestring

The prefix to be used for header imports

Default: ""
hdrslist of labels

The list of headers included in the header_map

Default: []
depslist of labels

Targets whose direct headers should be added to the list of hdrs and rooted at the module_name

Default: []

@rules_apple@rules_apple//apple:ios.bzl

Bazel rules for creating iOS applications and bundles.

Rules

ios_application

Builds and bundles an iOS Application.

AttributeTypeDescription
*namename

A unique name for this target.

app_iconslist of labels

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. In Xcode 26+ for iOS/macOS/watchOS, an *.icon
bundle can be provided along with the *..xcassets bundle to support 26 and
pre-26 Apple OS rendering.

Default: []
primary_app_iconstring

An optional String to identify the name of the primary app icon when alternate app icons have been
provided for the app. This should match both the *.icon bundle in iOS/macOS/watchOS 26+ and the
*..xcassets/.appiconset bundle's AppIcon resource in previous versions of
iOS/macOS/watchOS.

Default: ""
app_intentslist of labels

List of dependencies implementing the AppIntents protocol.

Default: []
codesign_inputslist of labels

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

Default: []
codesignoptslist of strings

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

Default: []
exported_symbols_listslist of labels

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.

Default: []
linkoptslist of strings

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

Default: []
additional_linker_inputslist of labels

A list of input files to be passed to the linker.

Default: []
stampinteger

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.
Default: -1
depslist of labels

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

Default: []
bundle_namestring

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.

Default: ""
executable_namestring

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.

Default: ""
stringslist of labels

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.

Default: []
resourceslist of labels

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

Default: []
versionlabel

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

Default: None
*familieslist of strings

A list of device families supported by this rule. At least one must be specified.

infoplistslist of labels

A list of .plist files that will be merged to form the Info.plist for this target. If not provided,
a default Info.plist will be used. Please see
Info.plist Handling
for what is supported.

Default: ["@rules_apple//apple/internal/templates:default_application_infoplist"]
ipa_post_processorlabel

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.

Default: None
launch_imageslist of labels

Files that comprise the launch images for the application. Each file must have a containing
directory named *.xcassets/*.launchimage and there may be only one such .launchimage directory
in the list.

Default: []
locales_to_includelist of strings

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

Default: []
*minimum_os_versionstring

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

minimum_deployment_os_versionstring

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.

Default: ""
platform_typestring
Default: "ios"
settings_bundlelabel

A resource bundle (e.g. apple_bundle_import) target that contains the files that make up the
application's settings bundle. These files will be copied into the root of the final application
bundle in a directory named Settings.bundle.

Default: None
bundle_idstring

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.

Default: ""
bundle_id_suffixstring

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.

Default: "_"
provisioning_profilelabel

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.

Default: None
entitlementslabel

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.

Default: None
entitlements_validationstring

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

Default: "loose"
shared_capabilitieslist of labels

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.

Default: []
alternate_iconslist of labels

Files that comprise the alternate app icons for the application. Each file must have a containing directory
named after the alternate icon identifier.

Default: []
app_clipslist of labels

A list of iOS app clips to include in the final application bundle.

Default: []
extensionslist of labels

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

Default: []
frameworkslist of labels

A list of framework targets (see
ios_framework)
that this target depends on.

Default: []
include_symbols_in_bundleboolean

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.

Default: False
launch_storyboardlabel

The .storyboard or .xib file that should be used as the launch screen for the application. The
provided file will be compiled into the appropriate format (.storyboardc or .nib) and placed in
the root of the final bundle. The generated file will also be registered in the bundle's
Info.plist under the key UILaunchStoryboardName.

Default: None
sdk_frameworkslist of strings

Names of SDK frameworks to link with (e.g., AddressBook, QuartzCore).
UIKit and Foundation are always included, even if this attribute is
provided and does not list them.

This attribute is discouraged; in general, targets should list system
framework dependencies in the library targets where that framework is used,
not in the top-level bundle.

Default: []
watch_applicationlabel

A watchos_application target that represents an Apple Watch application or a
watchos_single_target_application target that represents a single-target Apple Watch application
that should be embedded in the application bundle.

Default: None
ios_app_clip

Builds and bundles an iOS App Clip.

AttributeTypeDescription
*namename

A unique name for this target.

app_iconslist of labels

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. In Xcode 26+ for iOS/macOS/watchOS, an *.icon
bundle can be provided along with the *..xcassets bundle to support 26 and
pre-26 Apple OS rendering.

Default: []
codesign_inputslist of labels

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

Default: []
codesignoptslist of strings

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

Default: []
exported_symbols_listslist of labels

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.

Default: []
linkoptslist of strings

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

Default: []
additional_linker_inputslist of labels

A list of input files to be passed to the linker.

Default: []
stampinteger

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.
Default: -1
depslist of labels

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

Default: []
bundle_namestring

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.

Default: ""
executable_namestring

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.

Default: ""
stringslist of labels

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.

Default: []
resourceslist of labels

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

Default: []
versionlabel

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

Default: None
*familieslist of strings

A list of device families supported by this rule. At least one must be specified.

*infoplistslist of labels

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_processorlabel

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.

Default: None
locales_to_includelist of strings

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

Default: []
*minimum_os_versionstring

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

minimum_deployment_os_versionstring

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.

Default: ""
platform_typestring
Default: "ios"
bundle_idstring

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.

Default: ""
bundle_id_suffixstring

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.

Default: "bundle_name"
provisioning_profilelabel

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.

Default: None
entitlementslabel

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.

Default: None
entitlements_validationstring

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

Default: "loose"
shared_capabilitieslist of labels

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.

Default: []
frameworkslist of labels

A list of framework targets (see
ios_framework)
that this target depends on.

Default: []
launch_storyboardlabel

The .storyboard or .xib file that should be used as the launch screen for the app clip. The
provided file will be compiled into the appropriate format (.storyboardc or .nib) and placed in
the root of the final bundle. The generated file will also be registered in the bundle's
Info.plist under the key UILaunchStoryboardName.

Default: None
extensionslist of labels

A list of ios_extension live activity extensions to include in the final app clip bundle.
It is only possible to embed live activity WidgetKit extensions.
Visit Apple developer documentation page for more info https://developer.apple.com/documentation/appclip/offering-live-activities-with-your-app-clip.

Default: []
ios_dynamic_framework

Builds and bundles an iOS dynamic framework that is consumable by Xcode.

AttributeTypeDescription
*namename

A unique name for this target.

codesign_inputslist of labels

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

Default: []
codesignoptslist of strings

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

Default: []
exported_symbols_listslist of labels

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.

Default: []
linkoptslist of strings

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

Default: []
additional_linker_inputslist of labels

A list of input files to be passed to the linker.

Default: []
stampinteger

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.
Default: -1
depslist of labels

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

Default: []
bundle_namestring

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.

Default: ""
executable_namestring

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.

Default: ""
stringslist of labels

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.

Default: []
resourceslist of labels

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

Default: []
versionlabel

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

Default: None
familieslist of strings

A list of device families supported by this rule. At least one must be specified.

Default: ["iphone", "ipad"]
*infoplistslist of labels

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_processorlabel

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.

Default: None
*minimum_os_versionstring

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

minimum_deployment_os_versionstring

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.

Default: ""
platform_typestring
Default: "ios"
bundle_idstring

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.

Default: ""
bundle_id_suffixstring

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.

Default: "bundle_name"
provisioning_profilelabel

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.

Default: None
base_bundle_idlabel

The base bundle ID rule to dictate the form that a given bundle rule's bundle ID prefix should take.

Default: None
bundle_onlyboolean

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.

Default: False
extension_safeboolean

If true, compiles and links this framework with -application-extension, restricting the binary to
use only extension-safe APIs.

Default: False
frameworkslist of labels

A list of framework targets (see
ios_framework)
that this target depends on.

Default: []
hdrslist of labels
Default: []
ios_extension

Builds and bundles an iOS Application Extension.

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

AttributeTypeDescription
*namename

A unique name for this target.

app_iconslist of labels

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. In Xcode 26+ for iOS/macOS/watchOS, an *.icon
bundle can be provided along with the *..xcassets bundle to support 26 and
pre-26 Apple OS rendering.

Default: []
app_intentslist of labels

List of dependencies implementing the AppIntents protocol.

Default: []
codesign_inputslist of labels

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

Default: []
codesignoptslist of strings

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

Default: []
exported_symbols_listslist of labels

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.

Default: []
linkoptslist of strings

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

Default: []
additional_linker_inputslist of labels

A list of input files to be passed to the linker.

Default: []
stampinteger

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.
Default: -1
depslist of labels

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

Default: []
bundle_namestring

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.

Default: ""
executable_namestring

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.

Default: ""
stringslist of labels

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.

Default: []
resourceslist of labels

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

Default: []
versionlabel

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

Default: None
*familieslist of strings

A list of device families supported by this rule. At least one must be specified.

extensionkit_extensionboolean

Indicates if this target should be treated as an ExtensionKit extension.

Default: False
*infoplistslist of labels

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_processorlabel

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.

Default: None
locales_to_includelist of strings

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

Default: []
*minimum_os_versionstring

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

minimum_deployment_os_versionstring

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.

Default: ""
platform_typestring
Default: "ios"
bundle_idstring

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.

Default: ""
bundle_id_suffixstring

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.

Default: "bundle_name"
provisioning_profilelabel

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.

Default: None
entitlementslabel

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.

Default: None
entitlements_validationstring

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

Default: "loose"
shared_capabilitieslist of labels

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.

Default: []
frameworkslist of labels

A list of framework targets (see
ios_framework)
that this target depends on.

Default: []
sdk_frameworkslist of strings

Names of SDK frameworks to link with (e.g., AddressBook, QuartzCore).
UIKit and Foundation are always included, even if this attribute is
provided and does not list them.

This attribute is discouraged; in general, targets should list system
framework dependencies in the library targets where that framework is used,
not in the top-level bundle.

Default: []
ios_framework

Builds and bundles an iOS Dynamic Framework.

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

AttributeTypeDescription
*namename

A unique name for this target.

codesign_inputslist of labels

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

Default: []
codesignoptslist of strings

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

Default: []
exported_symbols_listslist of labels

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.

Default: []
linkoptslist of strings

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

Default: []
additional_linker_inputslist of labels

A list of input files to be passed to the linker.

Default: []
stampinteger

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.
Default: -1
depslist of labels

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

Default: []
bundle_namestring

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.

Default: ""
executable_namestring

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.

Default: ""
stringslist of labels

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.

Default: []
resourceslist of labels

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

Default: []
versionlabel

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

Default: None
*familieslist of strings

A list of device families supported by this rule. At least one must be specified.

*infoplistslist of labels

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_processorlabel

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.

Default: None
*minimum_os_versionstring

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

minimum_deployment_os_versionstring

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.

Default: ""
platform_typestring
Default: "ios"
bundle_idstring

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.

Default: ""
bundle_id_suffixstring

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.

Default: "bundle_name"
provisioning_profilelabel

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.

Default: None
base_bundle_idlabel

The base bundle ID rule to dictate the form that a given bundle rule's bundle ID prefix should take.

Default: None
bundle_onlyboolean

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.

Default: False
frameworkslist of labels

A list of framework targets (see
ios_framework)
that this target depends on.

Default: []
extension_safeboolean

If true, compiles and links this framework with -application-extension, restricting the binary to
use only extension-safe APIs.

Default: False
hdrslist of labels
Default: []
ios_imessage_application

Builds and bundles an iOS iMessage Application.

iOS iMessage applications do not have any dependencies, as it works mostly as a wrapper
for either an iOS iMessage extension or a Sticker Pack extension.

AttributeTypeDescription
*namename

A unique name for this target.

app_iconslist of labels

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. In Xcode 26+ for iOS/macOS/watchOS, an *.icon
bundle can be provided along with the *..xcassets bundle to support 26 and
pre-26 Apple OS rendering.

Default: []
bundle_namestring

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.

Default: ""
executable_namestring

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.

Default: ""
stringslist of labels

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.

Default: []
resourceslist of labels

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

Default: []
versionlabel

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

Default: None
*familieslist of strings

A list of device families supported by this rule. At least one must be specified.

*infoplistslist of labels

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_processorlabel

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.

Default: None
locales_to_includelist of strings

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

Default: []
*minimum_os_versionstring

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

minimum_deployment_os_versionstring

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.

Default: ""
platform_typestring
Default: "ios"
bundle_idstring

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.

Default: ""
bundle_id_suffixstring

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.

Default: "_"
provisioning_profilelabel

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.

Default: None
entitlementslabel

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.

Default: None
entitlements_validationstring

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

Default: "loose"
shared_capabilitieslist of labels

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.

Default: []
*extensionlabel

Single label referencing either an ios_imessage_extension or ios_sticker_pack_extension target.
Required.

ios_sticker_pack_extension

Builds and bundles an iOS Sticker Pack Extension.

AttributeTypeDescription
*namename

A unique name for this target.

app_iconslist of labels

Files that comprise the app icons for the application. Each file must have a containing directory
named *..xcstickers/*..stickersiconset and there may be only one such
..stickersiconset directory in the list. In Xcode 26+ for iOS/macOS/watchOS, an *.icon
bundle can be provided along with the *..xcstickers bundle to support 26 and
pre-26 Apple OS rendering.

Default: []
bundle_namestring

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.

Default: ""
executable_namestring

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.

Default: ""
stringslist of labels

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.

Default: []
resourceslist of labels

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

Default: []
versionlabel

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

Default: None
*familieslist of strings

A list of device families supported by this rule. At least one must be specified.

*infoplistslist of labels

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_processorlabel

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.

Default: None
*minimum_os_versionstring

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

minimum_deployment_os_versionstring

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.

Default: ""
platform_typestring
Default: "ios"
bundle_idstring

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.

Default: ""
bundle_id_suffixstring

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.

Default: "bundle_name"
provisioning_profilelabel

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.

Default: None
entitlementslabel

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.

Default: None
entitlements_validationstring

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

Default: "loose"
shared_capabilitieslist of labels

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.

Default: []
sticker_assetslist of labels

List of sticker files to bundle. The collection of assets should be under a folder named
*.*.xcstickers. The icons go in a *.stickersiconset (instead of *.appiconset); and the files
for the stickers should all be in Sticker Pack directories, so *.stickerpack/*.sticker or
*.stickerpack/*.stickersequence.

Default: []
ios_imessage_extension

Builds and bundles an iOS iMessage Extension.

AttributeTypeDescription
*namename

A unique name for this target.

app_iconslist of labels

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. In Xcode 26+ for iOS/macOS/watchOS, an *.icon
bundle can be provided along with the *..xcassets bundle to support 26 and
pre-26 Apple OS rendering.

Default: []
codesign_inputslist of labels

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

Default: []
codesignoptslist of strings

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

Default: []
exported_symbols_listslist of labels

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.

Default: []
linkoptslist of strings

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

Default: []
additional_linker_inputslist of labels

A list of input files to be passed to the linker.

Default: []
stampinteger

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.
Default: -1
depslist of labels

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

Default: []
bundle_namestring

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.

Default: ""
executable_namestring

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.

Default: ""
stringslist of labels

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.

Default: []
resourceslist of labels

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

Default: []
versionlabel

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

Default: None
*familieslist of strings

A list of device families supported by this rule. At least one must be specified.

*infoplistslist of labels

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_processorlabel

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.

Default: None
locales_to_includelist of strings

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

Default: []
*minimum_os_versionstring

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

minimum_deployment_os_versionstring

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.

Default: ""
platform_typestring
Default: "ios"
bundle_idstring

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.

Default: ""
bundle_id_suffixstring

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.

Default: "bundle_name"
provisioning_profilelabel

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.

Default: None
entitlementslabel

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.

Default: None
entitlements_validationstring

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

Default: "loose"
shared_capabilitieslist of labels

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.

Default: []
frameworkslist of labels

A list of framework targets (see
ios_framework)
that this target depends on.

Default: []
ios_kernel_extension

Builds and bundles an iOS Kernel Extension.

AttributeTypeDescription
*namename

A unique name for this target.

codesign_inputslist of labels

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

Default: []
codesignoptslist of strings

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

Default: []
exported_symbols_listslist of labels

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.

Default: []
linkoptslist of strings

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

Default: []
additional_linker_inputslist of labels

A list of input files to be passed to the linker.

Default: []
stampinteger

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.
Default: -1
depslist of labels

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

Default: []
bundle_namestring

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.

Default: ""
executable_namestring

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.

Default: ""
stringslist of labels

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.

Default: []
resourceslist of labels

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

Default: []
versionlabel

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

Default: None
familieslist of strings

A list of device families supported by this rule. At least one must be specified.

Default: ["iphone", "ipad"]
*infoplistslist of labels

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_processorlabel

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.

Default: None
*minimum_os_versionstring

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

minimum_deployment_os_versionstring

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.

Default: ""
platform_typestring
Default: "ios"
bundle_idstring

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.

Default: ""
bundle_id_suffixstring

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.

Default: "_"
provisioning_profilelabel

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.

Default: None
entitlementslabel

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.

Default: None
entitlements_validationstring

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

Default: "loose"
shared_capabilitieslist of labels

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.

Default: []
ios_static_framework

Builds and bundles an iOS 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 iOS bundles, the fat binary in an ios_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
--ios_multi_cpus=i386,x86_64,armv7,arm64 when you build).

ios_static_framework supports Swift, but there are some constraints:

  • ios_static_framework with Swift only works with Xcode 11 and above, since
    the required Swift functionality for module compatibility is available in
    Swift 5.1.
  • ios_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.
  • ios_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 ios_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).

AttributeTypeDescription
*namename

A unique name for this target.

codesign_inputslist of labels

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

Default: []
codesignoptslist of strings

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

Default: []
exported_symbols_listslist of labels

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.

Default: []
linkoptslist of strings

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

Default: []
additional_linker_inputslist of labels

A list of input files to be passed to the linker.

Default: []
stampinteger

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.
Default: -1
depslist of labels

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

Default: []
bundle_namestring

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.

Default: ""
executable_namestring

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.

Default: ""
stringslist of labels

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.

Default: []
resourceslist of labels

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

Default: []
versionlabel

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

Default: None
familieslist of strings

A list of device families supported by this rule. At least one must be specified.

Default: ["iphone", "ipad"]
ipa_post_processorlabel

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.

Default: None
*minimum_os_versionstring

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

minimum_deployment_os_versionstring

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.

Default: ""
platform_typestring
Default: "ios"
avoid_depslist of labels

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.

Default: []
exclude_resourcesboolean

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.

Default: False
hdrslist of labels

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.

Default: []
umbrella_headerlabel

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.

Default: None
ios_test_runner

Rule to identify an iOS runner that runs tests for iOS.

The runner will create a new simulator according to the given arguments to run
tests.

Outputs:
AppleTestRunnerInfo:
test_runner_template: Template file that contains the specific mechanism
with which the tests will be performed.
execution_requirements: Dictionary that represents the specific hardware
requirements for this test.
Runfiles:
files: The files needed during runtime for the test to be performed.

AttributeTypeDescription
*namename

A unique name for this target.

create_simulator_actionlabel

A binary that produces a UDID for a simulator that matches the given device type and OS version. The UDID will be used to run the tests on the correct simulator. The binary must print only the UDID to stdout. This is only invoked when the $REUSE_GLOBAL_SIMULATOR environment variable is set.

When executed, the binary will have the following environment variables available to it:

<ul> <li>`SIMULATOR_DEVICE_TYPE`: The device type of the simulator to create. The supported types correspond to the output of `xcrun simctl list devicetypes`. E.g., iPhone 6, iPad Air. The value will either be the value of the `device_type` attribute, the `ios_simulator_device` build setting, or an empty string that should imply a default device.</li> <li>`SIMULATOR_OS_VERSION`: The os version of the simulator to create. The supported os versions correspond to the output of `xcrun simctl list runtimes`. ' 'E.g., 11.2, 9.3. The value will either be the value of the `os_version` attribute, the `ios_simulator_version` build setting, or an empty string that should imply a default OS version for the selected simulator runtime.</li> <li>`SIMULATOR_SDK_VERSION`: The SDK version of the simulator to create. The supported SDK builds correspond to the output of `xcrun simctl runtime match list`. E.g., 11.2, 9.3. The value will be derived from the `default_ios_sdk_version` for the current Xcode version.</li> </ul>
Default: "@rules_apple//apple/testing/default_runner:simulator_creator"
device_typestring

The device type of the iOS simulator to run test. The supported types correspond
to the output of xcrun simctl list devicetypes. E.g., iPhone 6, iPad Air.
By default, it is the latest supported iPhone type.'

Default: ""
execution_requirementsdictionary: String → String

Dictionary of strings to strings which specifies the execution requirements for
the runner. In most common cases, this should not be used.

Default: {"requires-darwin": ""}
os_versionstring

The os version of the iOS simulator to run test. The supported os versions
correspond to the output of xcrun simctl list runtimes. ' 'E.g., 11.2, 9.3.
By default, it is the latest supported version of the device type.'

Default: ""
post_actionlabel

A binary to run following test execution. Runs after testing but before test result handling and coverage processing. Sets the $TEST_EXIT_CODE environment variable, in addition to any other variables available to the test runner.

Default: None
post_action_determines_exit_codeboolean

When true, the exit code of the test run will be set to the exit code of the post_action. This is useful for tests that need to fail the test run based on their own criteria.

Default: False
pre_actionlabel

A binary to run prior to test execution. Runs after simulator creation. Sets any environment variables available to the test runner.

Default: None
test_environmentdictionary: String → String

Optional dictionary with the environment variables that are to be propagated
into the XCTest invocation.

Default: {}
ios_xctestrun_runner

This rule creates a test runner for iOS tests that uses xctestrun files to run
hosted tests, and uses xctest directly to run logic tests.

You can use this rule directly if you need to override 'device_type' or
'os_version', otherwise you can use the predefined runners:

"@rules_apple//apple/testing/default_runner:ios_xctestrun_ordered_runner"

or:

"@rules_apple//apple/testing/default_runner:ios_xctestrun_random_runner"

Depending on if you want random test ordering or not. Set these as the runner
attribute on your ios_unit_test target:

ios_unit_test( name = "Tests", minimum_os_version = "15.5", runner = "@rules_apple//apple/testing/default_runner:ios_xctestrun_random_runner", deps = [":TestsLib"], )

If you would like this test runner to generate xcresult bundles for your tests,
pass --test_env=CREATE_XCRESULT_BUNDLE=1. It is preferable to use the
create_xcresult_bundle on the test runner itself instead of this parameter.

This rule automatically handles running x86_64 tests on arm64 hosts. The only
exception is that if you want to generate xcresult bundles or run tests in
random order, the test must have a test host. This is because of a limitation
in Xcode.

AttributeTypeDescription
*namename

A unique name for this target.

attachment_lifetimestring

Attachment lifetime to set in the xctestrun file when running the test bundle - "keepNever" (default), "keepAlways"
or "deleteOnSuccess". This affects presence of attachments in the XCResult output. This does not force using
xcodebuild or an XCTestRun file but the value will be used in that case.

Default: "keepNever"
clean_up_simulator_actionlabel

A binary that cleans up any simulators created by the create_simulator_action. Runs after the post_action, regardless of test success or failure.

When executed, the binary will have the following environment variables available to it:

<ul> <li>`SIMULATOR_UDID`: The UDID of the simulator to clean up. This will be the same UDID produced by the `create_simulator_action` and used to run the tests.</li> <li>`SIMULATOR_REUSE_SIMULATOR`: Whether to an existing simulator was reused or if a new one was created. The value will be set to "1" if the `reuse_simulator` attribute is true, and unset otherwise. Whether or not this variable is respected should be treated as an implementation detail of the simulator cleanup tool.</li> </ul>
Default: "@rules_apple//apple/testing/default_runner:simulator_cleanup"
command_line_argslist of strings

CommandLineArguments to pass to xctestrun file when running the test bundle. This means it
will always use xcodebuild test-without-building to run the test bundle.

Default: []
create_simulator_actionlabel

A binary that produces a UDID for a simulator that matches the given device type and OS version. Runs before the pre_action. The UDID will be used to run the tests on the correct simulator. The binary must print only the UDID to stdout.

When executed, the binary will have the following environment variables available to it:

<ul> <li>`SIMULATOR_DEVICE_TYPE`: The device type of the simulator to create. The supported types correspond to the output of `xcrun simctl list devicetypes`. E.g., iPhone 6, iPad Air. The value will either be the value of the `device_type` attribute, or the `ios_simulator_device` build setting.</li> <li>`SIMULATOR_OS_VERSION`: The OS version of the simulator to create. The supported OS versions correspond to the output of `xcrun simctl list runtimes`. E.g., 11.2, 9.3. The value will either be the value of the `os_version` attribute, or the `ios_simulator_version` build setting.</li> <li>`SIMULATOR_REUSE_SIMULATOR`: Whether to reuse an existing simulator or create a new one. The value will be set to "1" if the `reuse_simulator` attribute is true, and unset otherwise. Whether or not this variable is respected should be treated as an implementation detail of the simulator creator tool.</li> <li>`SIMULATOR_SDK_VERSION`: The SDK version of the simulator to create. The supported SDK builds correspond to the output of `xcrun simctl runtime match list`. E.g., 11.2, 9.3. The value will be derived from the `default_ios_sdk_version` for the current Xcode version.</li> </ul>
Default: "@rules_apple//apple/testing/default_runner:simulator_creator"
create_xcresult_bundleboolean

Force the test runner to always create an XCResult bundle. This means it will
always use xcodebuild test-without-building to run the test bundle.

Default: False
destination_timeoutinteger

Use the specified timeout when searching for a destination device. The default is 30 seconds.

Default: 0
device_typestring

The device type of the iOS simulator to run test. The supported types correspond
to the output of xcrun simctl list devicetypes. E.g., iPhone X, iPad Air.
By default, it reads from the ios_simulator_device build setting or falls back to some device.

Default: ""
os_versionstring

The os version of the iOS simulator to run test. The supported os versions
correspond to the output of xcrun simctl list runtimes. E.g., 15.5.
By default, it reads the ios_simulator_version build setting and then falls back to the latest
supported version.

Default: ""
post_actionlabel

A binary to run following test execution. Runs after testing but before test result handling and coverage processing. Sets the $TEST_EXIT_CODE, $TEST_LOG_FILE, and $SIMULATOR_UDID environment variables, the $TEST_XCRESULT_BUNDLE_PATH environment variable if the test run produces an XCResult bundle, and any other variables available to the test runner.

Default: None
post_action_determines_exit_codeboolean

When true, the exit code of the test run will be set to the exit code of the post_action. This is useful for tests that need to fail the test run based on their own criteria.

Default: False
pre_actionlabel

A binary to run prior to test execution. Runs after simulator creation. Sets the $SIMULATOR_UDID environment variable, in addition to any other variables available to the test runner.

Default: None
randomboolean

Whether to run the tests in random order to identify unintended state
dependencies.

Default: False
reuse_simulatorboolean

Toggle simulator reuse. The default behavior is to reuse an existing device of the same type and OS version. When disabled, a new simulator is created before testing starts and shutdown when the runner completes.

Default: True
xcodebuild_argslist of strings

Arguments to pass to xcodebuild when running the test bundle. This means it
will always use xcodebuild test-without-building to run the test bundle.

Default: []
ios_build_test

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

Typical usage:

ios_build_test( name = "my_build_test", minimum_os_version = "12.0", targets = [ "//some/package:my_library", ], )
AttributeTypeDescription
*namename

A unique name for this target.

*minimum_os_versionstring

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

targetslist of labels

The targets to check for successful build.

Default: []
platform_typestring
Default: "ios"

@rules_apple@rules_apple//apple:linker.bzl

Rules related to Apple linker.

Rules

apple_order_file

Injects the provided .order files into Apple link lines, concatenating and deduplicating them before supplying the appropriate linker flags.
The rule short-circuits in non-optimized compilations because generating order files is intended for release/deployment builds where they improve runtime locality.

Example:

apple_order_file( name = "app_order_file", deps = [ "my_file.order", "my_second_order_file.order", ], ) ios_application( name = "app", deps = [":app_order_file"], )

Set stats = True if you want the linker to emit information about how it used the order file.

AttributeTypeDescription
*namename

A unique name for this target.

*depslist of labels

The raw text order files to be used in the iOS application.

statsboolean

Indicate whether to log stats about how the linker used the order file.

Default: False

@rules_apple@rules_apple//apple:macos.bzl

Bazel rules for creating macOS applications and bundles.

Rules

macos_quick_look_plugin

Builds and bundles a macOS Quick Look Plugin.

AttributeTypeDescription
*namename

A unique name for this target.

codesign_inputslist of labels

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

Default: []
codesignoptslist of strings

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

Default: []
exported_symbols_listslist of labels

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.

Default: []
linkoptslist of strings

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

Default: []
additional_linker_inputslist of labels

A list of input files to be passed to the linker.

Default: []
stampinteger

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.
Default: -1
depslist of labels

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

Default: []
bundle_namestring

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.

Default: ""
executable_namestring

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.

Default: ""
stringslist of labels

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.

Default: []
resourceslist of labels

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

Default: []
versionlabel

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

Default: None
familieslist of strings

A list of device families supported by this rule. At least one must be specified.

Default: ["mac"]
*infoplistslist of labels

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_processorlabel

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.

Default: None
*minimum_os_versionstring

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

minimum_deployment_os_versionstring

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.

Default: ""
platform_typestring
Default: "macos"
bundle_idstring

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.

Default: ""
bundle_id_suffixstring

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.

Default: "_"
provisioning_profilelabel

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.

Default: None
entitlementslabel

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.

Default: None
entitlements_validationstring

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

Default: "loose"
shared_capabilitieslist of labels

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.

Default: []
additional_contentsdictionary: Label → String

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.

Default: {}
macos_spotlight_importer

Builds and bundles a macOS Spotlight Importer.

AttributeTypeDescription
*namename

A unique name for this target.

codesign_inputslist of labels

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

Default: []
codesignoptslist of strings

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

Default: []
exported_symbols_listslist of labels

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.

Default: []
linkoptslist of strings

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

Default: []
additional_linker_inputslist of labels

A list of input files to be passed to the linker.

Default: []
stampinteger

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.
Default: -1
depslist of labels

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

Default: []
bundle_namestring

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.

Default: ""
executable_namestring

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.

Default: ""
stringslist of labels

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.

Default: []
resourceslist of labels

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

Default: []
versionlabel

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

Default: None
familieslist of strings

A list of device families supported by this rule. At least one must be specified.

Default: ["mac"]
*infoplistslist of labels

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_processorlabel

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.

Default: None
*minimum_os_versionstring

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

minimum_deployment_os_versionstring

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.

Default: ""
platform_typestring
Default: "macos"
bundle_idstring

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.

Default: ""
bundle_id_suffixstring

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.

Default: "_"
provisioning_profilelabel

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.

Default: None
entitlementslabel

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.

Default: None
entitlements_validationstring

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

Default: "loose"
shared_capabilitieslist of labels

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.

Default: []
additional_contentsdictionary: Label → String

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.

Default: {}
macos_xpc_service

Builds and bundles a macOS XPC Service.

AttributeTypeDescription
*namename

A unique name for this target.

codesign_inputslist of labels

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

Default: []
codesignoptslist of strings

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

Default: []
exported_symbols_listslist of labels

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.

Default: []
linkoptslist of strings

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

Default: []
additional_linker_inputslist of labels

A list of input files to be passed to the linker.

Default: []
stampinteger

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.
Default: -1
depslist of labels

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

Default: []
bundle_namestring

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.

Default: ""
executable_namestring

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.

Default: ""
stringslist of labels

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.

Default: []
resourceslist of labels

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

Default: []
versionlabel

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

Default: None
ipa_post_processorlabel

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.

Default: None
familieslist of strings

A list of device families supported by this rule. At least one must be specified.

Default: ["mac"]
*infoplistslist of labels

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.

*minimum_os_versionstring

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

minimum_deployment_os_versionstring

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.

Default: ""
platform_typestring
Default: "macos"
bundle_idstring

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.

Default: ""
bundle_id_suffixstring

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.

Default: "_"
provisioning_profilelabel

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.

Default: None
entitlementslabel

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.

Default: None
entitlements_validationstring

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

Default: "loose"
shared_capabilitieslist of labels

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.

Default: []
additional_contentsdictionary: Label → String

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.

Default: {}
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", ], )
AttributeTypeDescription
*namename

A unique name for this target.

*minimum_os_versionstring

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

targetslist of labels

The targets to check for successful build.

Default: []
platform_typestring
Default: "macos"

@rules_apple@rules_apple//apple:providers.bzl

Providers

Defines providers and related types used throughout the rules in this repository.

Most users will not need to use these providers to simply create and build Apple
targets, but if you want to write your own custom rules that interact with these
rules, then you will use these providers to communicate between them.

These providers are part of the public API of the bundling rules. Other rules that want to propagate
information to the bundling rules or that want to consume the bundling rules as their own inputs
should use these to handle the relevant information that they need.

Public initializers must be defined in apple:providers.bzl instead of apple/internal:providers.bzl.
These should build from the "raw initializer" where possible, but not export it, to allow for a safe
boundary with well-defined public APIs for broader usage.

Functions & Macros

apple_provider.make_apple_bundle_version_info

Creates a new instance of the AppleBundleVersionInfo provider.

Parameters
*version_file

Required. See the docs on AppleBundleVersionInfo.

apple_provider.make_apple_test_runner_info

Creates a new instance of the AppleTestRunnerInfo provider.

Parameters
kwargs

A set of keyword arguments expected to match the fields of AppleTestRunnerInfo.
See the documentation for AppleTestRunnerInfo for what these must be.

apple_provider.merge_apple_framework_import_info

Merges multiple AppleFrameworkImportInfo into one.

Parameters
*apple_framework_import_infos

List of AppleFrameworkImportInfo to be merged.

Providers

AppleBaseBundleIdInfo

Provides the base bundle ID prefix for an Apple rule.

Fields
base_bundle_id

String. The bundle ID prefix, composed from an organization ID and an optional variant name.

AppleBundleInfo

This provider propagates general information about an Apple bundle that is not
specific to any particular bundle type. It is propagated by most bundling
rules (applications, extensions, frameworks, test bundles, and so forth).

Fields
archive

File. The archive that contains the built bundle.

archive_root

String. The file system path (relative to the workspace root) where the signed
bundle was constructed (before archiving). Other rules should not depend on
this field; it is intended to support IDEs that want to read that path from the
provider to avoid performance issues from unzipping the output archive.

binary

File. The binary (executable, dynamic library, etc.) that was bundled. The
physical file is identical to the one inside the bundle except that it is
always unsigned, so note that it is not a path to the binary inside your
output bundle. The primary purpose of this field is to provide a way to access
the binary directly at analysis time; for example, for code coverage.

bundle_extension

String. The bundle extension.

bundle_id

String. The bundle identifier (i.e., CFBundleIdentifier in
Info.plist) of the bundle.

bundle_name

String. The name of the bundle, without the extension.

entitlements

File. Entitlements file used, if any.

executable_name

string. The name of the executable that was bundled.

extension_safe

Boolean. True if the target propagating this provider was
compiled and linked with -application-extension, restricting it to
extension-safe APIs only.

infoplist

File. The complete (binary-formatted) Info.plist file for the bundle.

minimum_deployment_os_version

string. The minimum deployment OS version (as a dotted version
number like "9.0") that this bundle was built to support. This is different from
minimum_os_version, which is effective at compile time. Ensure version
specific APIs are guarded with available clauses.

minimum_os_version

String. The minimum OS version (as a dotted version
number like "9.0") that this bundle was built to support.

platform_type

String. The platform type for the bundle (i.e. ios for iOS bundles).

product_type

String. The dot-separated product type identifier associated
with the bundle (for example, com.apple.product-type.application).

uses_swift

Boolean. True if Swift is used by the target propagating this
provider. This does not consider embedded bundles; for example, an
Objective-C application containing a Swift extension would have this field
set to true for the extension but false for the application.

AppleBinaryInfo

Provides information about an Apple binary target.

This provider propagates general information about an Apple binary that is not
specific to any particular binary type.

Fields
binary

File. The binary (executable, dynamic library, etc.) file that the target represents.

infoplist

File. The complete (binary-formatted) Info.plist embedded in the binary.

product_type

String. The dot-separated product type identifier associated with the binary (for example,
com.apple.product-type.tool).

AppleBundleVersionInfo

Provides versioning information for an Apple bundle.

Fields
version_file

Required. A File containing JSON-formatted text describing the version number information
propagated by the target.

It contains two keys:

  • build_version, which corresponds to CFBundleVersion.

  • short_version_string, which corresponds to CFBundleShortVersionString.

AppleCodesigningDossierInfo

Provides information around the use of a code signing dossier.

Fields
dossier

A File reference to the code signing dossier zip that acts as a direct dependency of the given
target if one was generated.

AppleDebugOutputsInfo

Holds debug outputs of an Apple binary rule.

This provider is DEPRECATED. Preferably use AppleDsymBundleInfo instead.

The only field is output_map, which is a dictionary of:
{ arch: { "dsym_binary": File, "linkmap": File }

Where arch is any Apple architecture such as "arm64" or "armv7".

Fields
outputs_map
AppleDsymBundleInfo

Provides information for an Apple dSYM bundle.

Fields
direct_dsyms

List containing File references to each of the dSYM bundles that act as direct dependencies of
the given target if any were generated.

transitive_dsyms

depset containing File references to each of the dSYM bundles that act as transitive
dependencies of the given target if any were generated.

AppleDynamicFrameworkInfo

Contains information about an Apple dynamic framework.

Fields
framework_dirs

The framework path names used as link inputs in order to link against the
dynamic framework.

framework_files

The full set of artifacts that should be included as inputs to link against the
dynamic framework.

binary

The dylib binary artifact of the dynamic framework.

cc_info

A CcInfo which contains information about the transitive dependencies linked
into the binary.

AppleExecutableBinaryInfo

Contains the executable binary output that was built using
link_multi_arch_binary with the executable binary type.

Fields
binary

The executable binary artifact output by link_multi_arch_binary.

cc_info

A CcInfo which contains information about the transitive dependencies linked
into the binary.

AppleExtraOutputsInfo

Provides information about extra outputs that should be produced from the build.

This provider propagates supplemental files that should be produced as outputs
even if the bundle they are associated with is not a direct output of the rule.
For example, an application that contains an extension will build both targets
but only the application will be a rule output. However, if dSYM bundles are
also being generated, we do want to produce the dSYMs for both application and
extension as outputs of the build, not just the dSYMs of the explicit target
being built (the application).

Fields
files

depset of Files. These files will be propagated from embedded bundles (such
as frameworks and extensions) to the top-level bundle (such as an application)
to ensure that they are explicitly produced as outputs of the build.

AppleFrameworkBundleInfo

Denotes a target is an Apple framework bundle.

This provider does not reference 3rd party or precompiled frameworks.
Propagated by Apple framework rules: ios_framework, and tvos_framework.

AppleFrameworkImportInfo

Provider that propagates information about 3rd party imported framework targets.

Propagated by framework and XCFramework import rules: apple_dynamic_framework_import,
apple_dynamic_xcframework_import, apple_static_framework_import, and
apple_static_xcframework_import

Fields
framework_imports

depset of Files that represent framework imports that need to be bundled in the top level
application bundle under the Frameworks directory.

dsym_imports

Depset of Files that represent dSYM imports that need to be processed to
provide .symbols files for packaging into the .ipa file if requested in the
build with --define=apple.package_symbols=(yes|true|1).

build_archs

depset of Strings that represent binary architectures reported from the current build.

debug_info_binaries

Depset of Files that represent framework binaries and dSYM binaries that
provide debug info.

ApplePlatformInfo

Provides information for the currently selected Apple platforms.

Fields
target_arch

String representing the selected target architecture or cpu type.

target_build_config

'configuration' representing the selected target's build configuration.

target_environment

String representing the selected target environment (e.g. "device", "simulator").

target_os

String representing the selected Apple OS.

AppleResourceBundleInfo

Denotes that a target is an Apple resource bundle.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically an Apple resource bundle
(and not some other Apple bundle). Rule authors who wish to require that a
dependency is an Apple resource bundle should use this provider to describe that
requirement.

AppleResourceInfo

Provider that propagates buckets of resources that are differentiated by type.

Fields
alternate_icons

Alternate icons to be included in the App bundle.

asset_catalogs

Resources that need to be embedded into Assets.car.

datamodels

Datamodel files.

framework

Apple framework bundle from ios_framework and tvos_framework targets.

infoplists

Plist files to be merged and processed. Plist files that should not be merged into the root Info.plist should be propagated in plists. Because of this, infoplists should only be bucketed with the bucketize_typed method.

metals

Metal Shading Language source files to be compiled into a single .metallib file
and bundled at the top level.

mlmodels

Core ML model files that should be processed and bundled at the top level.

plists

Resource Plist files that should not be merged into Info.plist

pngs

PNG images which are not bundled in an .xcassets folder or an .icon folder in Xcode 26+.

processed

Typed resources that have already been processed.

storyboards

Storyboard files.

strings

Localization strings files.

texture_atlases

Texture atlas files.

unprocessed

Generic resources not mapped to the other types.

xcstrings

String catalog files.

xibs

XIB Interface files.

owners

depset of (resource, owner) pairs.

processed_origins

depset of (processed resource, resource list) pairs.

unowned_resources

depset of unowned resources.

AppleSharedCapabilityInfo

Provides information on a mergeable set of shared capabilities.

Fields
base_bundle_id

String. The bundle ID prefix, composed from an organization ID and an optional variant name.

AppleStaticXcframeworkBundleInfo

Denotes that a target is a static library XCFramework.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically an XCFramework bundle
(and not some other Apple bundle). Rule authors who wish to require that a
dependency is an XCFramework should use this provider to describe that
requirement.

AppleTestInfo

Provider that test targets propagate to be used for IDE integration.

Fields
test_bundle

The artifact representing the XCTest bundle for the test target.

test_host

The artifact representing the test host for the test target, if the test requires a test host.

AppleTestRunnerInfo

Provider that runner targets must propagate.

In addition to the fields, all the runfiles that the runner target declares will be added to the
test rules runfiles.

Fields
execution_requirements

Optional dictionary that represents the specific hardware requirements for this test.

execution_environment

Optional dictionary with the environment variables that are to be set in the test action, and are
not propagated into the XCTest invocation. These values will not be added into the %(test_env)s
substitution, but will be set in the test action.

test_environment

Optional dictionary with the environment variables that are to be propagated into the XCTest
invocation. These values will be included in the %(test_env)s substitution and will not be set in
the test action.

test_runner_template

Required template file that contains the specific mechanism with which the tests will be run. The
*_ui_test and *_unit_test rules will substitute the following values:
* %(test_host_path)s: Path to the app being tested.
* %(test_bundle_path)s: Path to the test bundle that contains the tests.
* %(test_env)s: Environment variables for the XCTest invocation (e.g FOO=BAR,BAZ=QUX).
* %(test_type)s: The test type, whether it is unit or UI.

AppleXcframeworkBundleInfo

Denotes that a target is an XCFramework.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically an XCFramework bundle
(and not some other Apple bundle). Rule authors who wish to require that a
dependency is an XCFramework should use this provider to describe that
requirement.

IosAppClipBundleInfo

Denotes that a target is an iOS app clip.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically an iOS app clip bundle (and
not some other Apple bundle). Rule authors who wish to require that a dependency
is an iOS app clip should use this provider to describe that requirement.

IosApplicationBundleInfo

Denotes that a target is an iOS application.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically an iOS application bundle
(and not some other Apple bundle). Rule authors who wish to require that a
dependency is an iOS application should use this provider to describe that
requirement.

IosExtensionBundleInfo

Denotes that a target is an iOS application extension.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically an iOS application
extension bundle (and not some other Apple bundle). Rule authors who wish to
require that a dependency is an iOS application extension should use this
provider to describe that requirement.

IosFrameworkBundleInfo

Denotes that a target is an iOS dynamic framework.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically an iOS dynamic framework
bundle (and not some other Apple bundle). Rule authors who wish to require that
a dependency is an iOS dynamic framework should use this provider to describe
that requirement.

IosImessageApplicationBundleInfo

Denotes that a target is an iOS iMessage application.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically an iOS iMessage application
bundle (and not some other Apple bundle). Rule authors who wish to require that
a dependency is an iOS iMessage application should use this provider to describe
that requirement.

IosImessageExtensionBundleInfo

Denotes that a target is an iOS iMessage extension.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically an iOS iMessage extension
bundle (and not some other Apple bundle). Rule authors who wish to require that
a dependency is an iOS iMessage extension should use this provider to describe
that requirement.

IosKernelExtensionBundleInfo

Denotes that a target is an iOS kernel extension.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically an iOS kernel extension
bundle (and not some other Apple bundle). Rule authors who wish to require that
a dependency is an iOS kernel extension should use this provider to describe that
requirement.

IosStaticFrameworkBundleInfo

Denotes that a target is an iOS static framework.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically an iOS static framework
bundle (and not some other Apple bundle). Rule authors who wish to require that
a dependency is an iOS static framework should use this provider to describe
that requirement.

IosXcTestBundleInfo

Denotes a target that is an iOS .xctest bundle.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically an iOS .xctest bundle (and
not some other Apple bundle). Rule authors who wish to require that a dependency
is an iOS .xctest bundle should use this provider to describe that requirement.

MacosApplicationBundleInfo

Denotes that a target is a macOS application.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically a macOS application bundle
(and not some other Apple bundle). Rule authors who wish to require that a
dependency is a macOS application should use this provider to describe that
requirement.

MacosBundleBundleInfo

Denotes that a target is a macOS loadable bundle.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically a macOS loadable bundle
(and not some other Apple bundle). Rule authors who wish to require that a
dependency is a macOS loadable bundle should use this provider to describe that
requirement.

MacosExtensionBundleInfo

Denotes that a target is a macOS application extension.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically a macOS application
extension bundle (and not some other Apple bundle). Rule authors who wish to
require that a dependency is a macOS application extension should use this
provider to describe that requirement.

MacosKernelExtensionBundleInfo

Denotes that a target is a macOS kernel extension.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically a macOS kernel extension
(and not some other Apple bundle). Rule authors who wish to require that a
dependency is a macOS kernel extension should use this provider to describe that
requirement.

MacosQuickLookPluginBundleInfo

Denotes that a target is a macOS Quick Look Generator bundle.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically a macOS Quick Look generator
bundle (and not some other Apple bundle). Rule authors who wish to require that
a dependency is a macOS Quick Look generator should use this provider to describe
that requirement.

MacosSpotlightImporterBundleInfo

Denotes that a target is a macOS Spotlight Importer bundle.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically a macOS Spotlight importer
(and not some other Apple bundle). Rule authors who wish to require that a
dependency is a macOS Spotlight importer should use this provider to describe that
requirement.

MacosXPCServiceBundleInfo

Denotes that a target is a macOS XPC Service bundle.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically a macOS XPC service
(and not some other Apple bundle). Rule authors who wish to require that a
dependency is a macOS XPC service should use this provider to describe that
requirement.

MacosXcTestBundleInfo

Denotes a target that is a macOS .xctest bundle.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically a macOS .xctest bundle
(and not some other Apple bundle). Rule authors who wish to require that a
dependency is a macOS .xctest bundle should use this provider to describe that
requirement.

TvosApplicationBundleInfo

Denotes that a target is a tvOS application.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically a tvOS application bundle
(and not some other Apple bundle). Rule authors who wish to require that a
dependency is a tvOS application should use this provider to describe that
requirement.

TvosExtensionBundleInfo

Denotes that a target is a tvOS application extension.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically a tvOS application
extension bundle (and not some other Apple bundle). Rule authors who wish to
require that a dependency is a tvOS application extension should use this
provider to describe that requirement.

TvosFrameworkBundleInfo

Denotes that a target is a tvOS dynamic framework.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically a tvOS dynamic framework
bundle (and not some other Apple bundle). Rule authors who wish to require that
a dependency is a tvOS dynamic framework should use this provider to describe
that requirement.

TvosStaticFrameworkBundleInfo

Denotes that a target is a tvOS static framework.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically a tvOS static framework
bundle (and not some other Apple bundle). Rule authors who wish to require that
a dependency is a tvOS static framework should use this provider to describe
that requirement.

TvosXcTestBundleInfo

Denotes a target that is a tvOS .xctest bundle.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically a tvOS .xctest bundle (and
not some other Apple bundle). Rule authors who wish to require that a dependency
is a tvOS .xctest bundle should use this provider to describe that requirement.

VisionosApplicationBundleInfo

Denotes that a target is a visionOS application.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically a visionOS application
bundle (and not some other Apple bundle). Rule authors who wish to require that a
dependency is a visionOS application should use this provider to describe that
requirement.

VisionosFrameworkBundleInfo

Denotes that a target is visionOS dynamic framework.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically a visionOS dynamic framework
bundle (and not some other Apple bundle). Rule authors who wish to require that
a dependency is a visionOS dynamic framework should use this provider to describe
that requirement.

VisionosExtensionBundleInfo

Denotes that a target is a visionOS application.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically a visionOS application
bundle (and not some other Apple bundle). Rule authors who wish to require that a
dependency is a visionOS application should use this provider to describe that
requirement.

VisionosXcTestBundleInfo

Denotes a target that is a visionOS .xctest bundle.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically a visionOS .xctest bundle
(and not some other Apple bundle). Rule authors who wish to require that a
dependency is a visionOS .xctest bundle should use this provider to describe
that requirement.

WatchosApplicationBundleInfo

Denotes that a target is a watchOS application.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically a watchOS application
bundle (and not some other Apple bundle). Rule authors who wish to require that
a dependency is a watchOS application should use this provider to describe that
requirement.

WatchosExtensionBundleInfo

Denotes that a target is a watchOS application extension.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically a watchOS application
extension bundle (and not some other Apple bundle). Rule authors who wish to
require that a dependency is a watchOS application extension should use this
provider to describe that requirement.

WatchosXcTestBundleInfo

Denotes a target that is a watchOS .xctest bundle.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically a watchOS .xctest bundle (and
not some other Apple bundle). Rule authors who wish to require that a dependency
is a watchOS .xctest bundle should use this provider to describe that requirement.

AppleBinaryInfoplistInfo

Provides information about the Info.plist that was linked into an Apple binary
target.

Fields
infoplist

File. The complete (binary-formatted) Info.plist embedded in the binary.

AppleDeviceTestRunnerInfo

Provider that device-based runner targets must propagate.

Fields
device_type

The device type of the iOS simulator to run test. The supported types correspond
to the output of xcrun simctl list devicetypes. E.g., iPhone X, iPad Air.

os_version

The os version of the iOS simulator to run test. The supported os versions
correspond to the output of xcrun simctl list runtimes. E.g., 15.5.

AppleProvisioningProfileInfo

Provides information about a provisioning profile.

Fields
provisioning_profile

File. The provisioning profile.

profile_name

string. The profile name (e.g. "iOS Team Provisioning Profile: com.example.app").

team_id

string. The Team ID the profile is associated with (e.g. "A12B3CDEFG"), or None if it's not
known at analysis time.

IosStickerPackExtensionBundleInfo

Denotes that a target is an iOS Sticker Pack extension.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically an iOS Sticker Pack extension
bundle (and not some other Apple bundle). Rule authors who wish to require that
a dependency is an iOS Sticker Pack extension should use this provider to describe
that requirement.

WatchosFrameworkBundleInfo

Denotes that a target is watchOS dynamic framework.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically a watchOS dynamic framework
bundle (and not some other Apple bundle). Rule authors who wish to require that
a dependency is a watchOS dynamic framework should use this provider to describe
that requirement.

WatchosStaticFrameworkBundleInfo

Denotes that a target is an watchOS static framework.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically a watchOS static framework
bundle (and not some other Apple bundle). Rule authors who wish to require that
a dependency is a watchOS static framework should use this provider to describe
that requirement.

MacosFrameworkBundleInfo

Denotes that a target is an macOS dynamic framework.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically an macOS dynamic framework
bundle (and not some other Apple bundle). Rule authors who wish to require that
a dependency is an macOS dynamic framework should use this provider to describe
that requirement.

MacosStaticFrameworkBundleInfo

Denotes that a target is an macOS static framework.

This provider does not contain any fields of its own at this time but is used as
a "marker" to indicate that a target is specifically an macOS static framework
bundle (and not some other Apple bundle). Rule authors who wish to require that
a dependency is an macOS static framework should use this provider to describe
that requirement.

DocCBundleInfo

Provides general information about a .docc bundle.

Fields
bundle

the path to the .docc bundle

bundle_files

the file targets contained within the .docc bundle

DocCSymbolGraphsInfo

Provides the symbol graphs required to archive a .docc bundle.

Fields
symbol_graphs

the depset of paths to the symbol graphs

@rules_apple@rules_apple//apple:resources.bzl

Rules related to Apple resources and resource bundles.

Functions & Macros

resources_common.bucketize

Separates the given resources into resource bucket types and returns an AppleResourceInfo.

This method wraps _bucketize_data and returns its tuple as an immutable Starlark structure to
help propagate the structure of the Apple bundle resources to the bundler.

Parameters
allowed_buckets

List of buckets allowed for bucketing. Files that do not fall into these
buckets will instead be placed into the "unprocessed" bucket. Defaults to None which
means all buckets are allowed.

Default: None
owner

An optional string that has a unique identifier to the target that should own the
resources. If an owner should be passed, it's usually equal to str(ctx.label).

Default: None
parent_dir_param

Either a string/None or a struct used to calculate the value of
parent_dir for each resource. If it is a struct, it will be considered a partial
context, and will be invoked with partial.call().

Default: None
*resources

List of resources to bucketize.

swift_module

The Swift module name to associate to these resources.

Default: None
resources_common.bucketize_data

Separates the given resources into resource bucket types.

This method takes a list of resources and constructs a tuple object for each, placing it inside
the correct bucket.

The parent_dir is calculated from the parent_dir_param object. This object can either be None
(the default), a string object, or a function object. If a function is provided, it should
accept only 1 parameter, which will be the File object representing the resource to bucket. This
mechanism gives us a simpler way to manage multiple use cases. For example, when used to
bucketize structured resources, the parent_dir_param can be a function that returns the relative
path to the owning package; or in an objc_library it can be None, signaling that these resources
should be placed in the root level.

If no bucket was detected based on the short path for a specific resource, it will be placed
into the "unprocessed" bucket. Resources in this bucket will not be processed and will be copied
as is. Once all resources have been placed in buckets, each of the lists will be minimized.

Finally, it will return a AppleResourceInfo provider with the resources bucketed per type.

Parameters
allowed_buckets

List of buckets allowed for bucketing. Files that do not fall into these
buckets will instead be placed into the "unprocessed" bucket. Defaults to None which
means all buckets are allowed.

Default: None
owner

An optional string that has a unique identifier to the target that should own the
resources. If an owner should be passed, it's usually equal to str(ctx.label).

Default: None
parent_dir_param

Either a string/None or a struct used to calculate the value of
parent_dir for each resource. If it is a struct, it will be considered a partial
context, and will be invoked with partial.call().

Default: None
*resources

List of resources to bucketize.

swift_module

The Swift module name to associate to these resources.

Default: None
resources_common.bucketize_typed

Collects and bucketizes a specific type of resource and returns an AppleResourceInfo.

Adds the given resources directly into a tuple under the field named in bucket_type. This avoids
the sorting mechanism that bucketize does, while grouping resources together using
parent_dir_param when available.

Parameters
*resources

List of resources to place in bucket_type or Dictionary of resources keyed by
target to place in bucket_type. This dictionary is supported by the
resources.collect() API.

*bucket_type

The AppleResourceInfo field under which to collect the resources.

owner

An optional string that has a unique identifier to the target that should own the
resources. If an owner should be passed, it's usually equal to str(ctx.label).

Default: None
parent_dir_param

Either a string/None or a struct used to calculate the value of
parent_dir for each resource. If it is a struct, it will be considered a partial
context, and will be invoked with partial.call().

Default: None
resources_common.bucketize_typed_data

Collects and bucketizes a specific type of resource.

Adds the given resources directly into a tuple under the field named in bucket_type. This avoids
the sorting mechanism that bucketize does, while grouping resources together using
parent_dir_param when available.

Parameters
*bucket_type

The AppleResourceInfo field under which to collect the resources.

owner

An optional string that has a unique identifier to the target that should own the
resources. If an owner should be passed, it's usually equal to str(ctx.label).

Default: None
parent_dir_param

Either a string/None or a struct used to calculate the value of
parent_dir for each resource. If it is a struct, it will be considered a partial
context, and will be invoked with partial.call().

Default: None
*resources

List of resources to place in bucket_type or Dictionary of resources keyed by
target to place in bucket_type. This dictionary is supported by the
resources.collect() API.

resources_common.bundle_relative_parent_dir

Returns the bundle relative path to the resource rooted at the bundle.

Looks for the first instance of a folder with the suffix specified by extension, and then
returns the directory path to the file within the bundle. For example, for a resource with path
my/package/Contents.bundle/directory/foo.txt and extension equal to "bundle", it would
return Contents.bundle/directory.

Parameters
*resource

The resource for which to calculate the bundle relative path.

*extension

The bundle extension to use when finding the relative path.

resources_common.collect

Collects all resource attributes present in the given attributes.

Iterates over the given res_attrs attributes collecting files to be processed as resources.
These are all placed into a list, and then returned.

Parameters
*attr

The attributes object on the current context. Can be either a ctx.attr/ctx.rule.attr
-like struct that has targets/lists as its values, or a ctx.split_attr-like struct
with the dictionary fan-out corresponding to split key.

res_attrs

List of attributes to iterate over collecting resources.

Default: []
split_attr_keys

If defined, a list of 1:2+ transition keys to merge values from.

Default: []
resources_common.deduplicate
Parameters
*resources_provider
*avoid_providers
*field_handler
default_owner
Default: None
resources_common.merge_providers

Merges multiple AppleResourceInfo providers into one.

Parameters
default_owner

The default owner to be used for resources which have a None value in the
owners dictionary. May be None, in which case no owner is marked.

Default: None
*providers

The list of providers to merge. This method will fail unless there is at least 1
provider in the list.

validate_all_resources_owned

Whether to validate that all resources are owned. This is
useful for top-level rules to ensure that the resources in AppleResourceInfo that
they are propagating are fully owned. If default_owner is set, this attribute does
nothing, as by definition the resources will all have a default owner.

Default: False
resources_common.minimize

Minimizes the given list of tuples into the smallest subset possible.

Takes the list of tuples that represent one resource bucket, and minimizes it so that 2 tuples
with resources that should be placed under the same location are merged into 1 tuple.

For tuples to be merged, they need to have the same parent_dir and swift_module.

Parameters
*bucket

List of tuples to be minimized.

resources_common.nest_in_bundle

Nests resources in a AppleResourceInfo provider under a new parent bundle directory.

This method is mostly used by rules that create resource bundles in order to nest other resource
bundle targets within themselves. For instance, apple_resource_bundle supports nesting other
bundles through the resources attribute. In these use cases, the dependency bundles are added as
nested bundles into the dependent bundle.

This method prepends the parent_dir field in the buckets with the given
nesting_bundle_dir argument.

Parameters
*provider_to_nest

A AppleResourceInfo provider with the resources to nest.

*nesting_bundle_dir

The new bundle directory under which to bundle the resources.

resources_common.populated_resource_fields

Returns a list of field names of the provider's resource buckets that are non empty.

Parameters
*provider
resources_common.process_bucketized_data

Registers actions for select resource types, given bucketized groupings of data.

This method performs the same actions as bucketize_data, and further
iterates through a subset of resource types to register actions to process
them as necessary before returning an AppleResourceInfo. This
AppleResourceInfo has an additional field, called "processed", featuring the
expected outputs for each of the actions declared in this method.

Parameters
*actions

The actions provider from ctx.actions.

*apple_mac_toolchain_info

struct of tools from the shared Apple
toolchain.

bucketized_owners

A list of tuples indicating the owner of each
bucketized resource.

Default: []
*buckets

A dictionary with bucketized resources organized by resource
type.

*bundle_id

The bundle ID to configure for this target.

output_discriminator

A string to differentiate between different target
intermediate files or None.

Default: None
*platform_prerequisites

Struct containing information on the platform
being targeted.

processing_owner

An optional string that has a unique identifier to the
target that should own the resources. If an owner should be passed,
it's usually equal to str(ctx.label).

Default: None
*product_type

The product type identifier used to describe the current
bundle type.

resource_types_to_process

A list of bucket types to process.

Default: ["infoplists", "plists", "pngs", "strings"]
*rule_label

The label of the target being analyzed.

unowned_resources

A list of "unowned" resources.

Default: []
resources_common.runfiles_resources_parent_dir

Returns the parent directory of the file.

Parameters
*resource

The resource for which to calculate the package relative path.

resources_common.structured_resources_parent_dir

Returns the package relative path for the parent directory of a resource.

Parameters
parent_dir

Parent directory to prepend to the package relative path.

Default: None
*resource

The resource for which to calculate the package relative path.

strip_prefixes

A list of prefixes to strip from the package relative
path. The first prefix that matches will be used.

Default: []
apple_core_ml_library

Macro to orchestrate an objc_library with generated sources for mlmodel files.

Parameters
*name
*mlmodel
kwargs
swift_apple_core_ml_library

Macro to orchestrate a swift_library with generated sources for mlmodel files.

Parameters
*name
*mlmodel
kwargs
objc_intent_library

Macro to orchestrate an objc_library with generated sources for intentdefiniton files.

Parameters
*name
*src
class_prefix
Default: None
testonly
Default: False
kwargs
swift_intent_library

This macro supports the integration of Intents .intentdefinition files into Apple rules.

It takes a single .intentdefinition file and creates a target that can be added as a dependency from objc_library or
swift_library targets.

It accepts the regular swift_library attributes too.

Parameters
*name

A unique name for the target.

*src

Reference to the .intentdefiniton file to process.

class_prefix

Class prefix to use for the generated classes.

Default: None
class_visibility

Visibility attribute for the generated classes (public, private, project).

Default: None
swift_version

Version of Swift to use for the generated classes.

Default: None
testonly

Set to True to enforce that this library is only used from test code.

Default: False
kwargs

Rules

apple_bundle_import

This rule encapsulates an already-built bundle. It is defined by a list of files
in exactly one .bundle directory. apple_bundle_import targets need to be
added to library targets through the data attribute, or to other resource
targets (i.e. apple_resource_bundle and apple_resource_group) through the
resources attribute.

AttributeTypeDescription
*namename

A unique name for this target.

*bundle_importslist of labels

The list of files under a .bundle directory to be propagated to the top-level bundling target.

apple_intent_library

This rule supports the integration of Intents .intentdefinition files into Apple rules.
It takes a single .intentdefinition file and creates a target that can be added as a dependency from objc_library or
swift_library targets. It accepts the regular objc_library attributes too.
This target generates a header named <target_name>.h that can be imported from within the package where this target
resides. For example, if this target's label is //my/package:intent, you can import the header as
#import "my/package/intent.h".

AttributeTypeDescription
*namename

A unique name for this target.

*srclabel

Label to a single .intentdefinition files from which to generate sources files.

*languagestring

Language of generated classes ("Objective-C", "Swift")

class_prefixstring

Class prefix to use for the generated classes.

Default: ""
swift_versionstring

Version of Swift to use for the generated classes.

Default: ""
class_visibilitystring

Visibility attribute for the generated classes ("public", "private", "project").

Default: ""
header_namestring

Name of the public header file (only when using Objective-C).

Default: ""
apple_metal_library

Compiles Metal shader language sources into a Metal library.

AttributeTypeDescription
*namename

A unique name for this target.

coptslist of strings

A list of compiler options passed to the metal compiler for each source.

Default: []
hdrslist of labels

A list of headers to make importable when compiling the metal library.

Default: []
outstring

An output .metallib filename. Defaults to default.metallib if unspecified.

Default: "default.metallib"
*srcslist of labels

A list of .metal source files that will be compiled into the library.

apple_precompiled_resource_bundle

This rule encapsulates a target which is provided to dependers as a bundle. An
apple_precompiled_resource_bundle's resources are put in a resource bundle in the top
level Apple bundle dependent. apple_precompiled_resource_bundle targets need to be added to
library targets through the data attribute.

AttributeTypeDescription
*namename

A unique name for this target.

bundle_idstring

The bundle ID for this target. It will replace $(PRODUCT_BUNDLE_IDENTIFIER) found in the files
from defined in the infoplists paramter.

Default: ""
bundle_namestring

The desired name of the bundle (without the .bundle extension). If this attribute is not set,
then the name of the target will be used instead.

Default: ""
infoplistslist of labels

A list of .plist files that will be merged to form the Info.plist that represents the extension.
At least one file must be specified.
Please see Info.plist Handling for what is supported.

Duplicate keys between infoplist files
will cause an error if and only if the values conflict.
Bazel will perform variable substitution on the Info.plist file for the following values (if they
are strings in the top-level dict of the plist):

${BUNDLE_NAME}: This target's name and bundle suffix (.bundle or .app) in the form name.suffix.
${PRODUCT_NAME}: This target's name.
${TARGET_NAME}: This target's name.
The key in ${} may be suffixed with :rfc1034identifier (for example
${PRODUCT_NAME::rfc1034identifier}) in which case Bazel will replicate Xcode's behavior and replace
non-RFC1034-compliant characters with -.

Default: []
resourceslist of labels

Files to include in the resource bundle. Files that are processable resources, like .xib,
.storyboard, .strings, .png, and others, will be processed by the Apple bundling rules that have
those files as dependencies. Other file types that are not processed will be copied verbatim. These
files are placed in the root of the resource bundle (e.g. Payload/foo.app/bar.bundle/...) in most
cases. However, if they appear to be localized (i.e. are contained in a directory called *.lproj),
they will be placed in a directory of the same name in the app bundle.

You can also add other apple_precompiled_resource_bundle and apple_bundle_import targets into resources,
and the resource bundle structures will be propagated into the final bundle.

Default: []
strip_structured_resources_prefixeslist of strings

A list of prefixes to strip from the paths of structured resources. For each
structured resource, if the path starts with one of these prefixes, the first
matching prefix will be removed from the path when the resource is placed in
the bundle root. This is useful for removing intermediate directories from the
resource paths.

For example, if structured_resources contains ["intermediate/res/foo.png"],
and strip_structured_resources_prefixes contains ["intermediate"],
res/foo.png will end up inside the bundle.

Default: []
structured_resourceslist of labels

Files to include in the final resource bundle. They are not processed or compiled in any way
besides the processing done by the rules that actually generate them. These files are placed in the
bundle root in the same structure passed to this argument, so ["res/foo.png"] will end up in
res/foo.png inside the bundle.

Default: []
apple_resource_bundle

This rule encapsulates a target which is provided to dependers as a bundle. An
apple_resource_bundle's resources are put in a resource bundle in the top
level Apple bundle dependent. apple_resource_bundle targets need to be added to
library targets through the data attribute.

AttributeTypeDescription
*namename

A unique name for this target.

bundle_idstring

The bundle ID for this target. It will replace $(PRODUCT_BUNDLE_IDENTIFIER) found in the files
from defined in the infoplists paramter.

Default: ""
bundle_namestring

The desired name of the bundle (without the .bundle extension). If this attribute is not set,
then the name of the target will be used instead.

Default: ""
infoplistslist of labels

A list of .plist files that will be merged to form the Info.plist that represents the extension.
At least one file must be specified.
Please see Info.plist Handling for what is supported.

Duplicate keys between infoplist files
will cause an error if and only if the values conflict.
Bazel will perform variable substitution on the Info.plist file for the following values (if they
are strings in the top-level dict of the plist):

${BUNDLE_NAME}: This target's name and bundle suffix (.bundle or .app) in the form name.suffix.
${PRODUCT_NAME}: This target's name.
${TARGET_NAME}: This target's name.
The key in ${} may be suffixed with :rfc1034identifier (for example
${PRODUCT_NAME::rfc1034identifier}) in which case Bazel will replicate Xcode's behavior and replace
non-RFC1034-compliant characters with -.

Default: []
resourceslist of labels

Files to include in the resource bundle. Files that are processable resources, like .xib,
.storyboard, .strings, .png, and others, will be processed by the Apple bundling rules that have
those files as dependencies. Other file types that are not processed will be copied verbatim. These
files are placed in the root of the resource bundle (e.g. Payload/foo.app/bar.bundle/...) in most
cases. However, if they appear to be localized (i.e. are contained in a directory called *.lproj),
they will be placed in a directory of the same name in the app bundle.

You can also add other apple_resource_bundle and apple_bundle_import targets into resources,
and the resource bundle structures will be propagated into the final bundle.

Default: []
strip_structured_resources_prefixeslist of strings

A list of prefixes to strip from the paths of structured resources. For each
structured resource, if the path starts with one of these prefixes, the first
matching prefix will be removed from the path when the resource is placed in
the bundle root. This is useful for removing intermediate directories from the
resource paths.

For example, if structured_resources contains ["intermediate/res/foo.png"],
and strip_structured_resources_prefixes contains ["intermediate"],
res/foo.png will end up inside the bundle.

Default: []
structured_resourceslist of labels

Files to include in the final resource bundle. They are not processed or compiled in any way
besides the processing done by the rules that actually generate them. These files are placed in the
bundle root in the same structure passed to this argument, so ["res/foo.png"] will end up in
res/foo.png inside the bundle.

Default: []
apple_resource_group

This rule encapsulates a target which provides resources to dependents. An
apple_resource_group's resources and structured_resources are put in the
top-level Apple bundle target. apple_resource_group targets need to be added
to library targets through the data attribute, or to other
apple_resource_bundle or apple_resource_group targets through the
resources attribute.

AttributeTypeDescription
*namename

A unique name for this target.

resourceslist of labels

Files to include in the final bundle that depends on this target. Files that are processable
resources, like .xib, .storyboard, .strings, .png, and others, will be processed by the Apple
bundling rules that have those files as dependencies. Other file types that are not processed will
be copied verbatim. These files are placed in the root of the final bundle (e.g.
Payload/foo.app/...) in most cases. However, if they appear to be localized (i.e. are contained in a
directory called *.lproj), they will be placed in a directory of the same name in the app bundle.

You can also add apple_resource_bundle and apple_bundle_import targets into resources, and the
resource bundle structures will be propagated into the final bundle.

Default: []
strip_structured_resources_prefixeslist of strings

A list of prefixes to strip from the paths of structured resources. For each
structured resource, if the path starts with one of these prefixes, the first
matching prefix will be removed from the path when the resource is placed in
the bundle root. This is useful for removing intermediate directories from the
resource paths.

For example, if structured_resources contains ["intermediate/res/foo.png"],
and strip_structured_resources_prefixes contains ["intermediate"],
res/foo.png will end up inside the bundle.

Default: []
structured_resourceslist of labels

Files to include in the final application bundle. They are not processed or compiled in any way
besides the processing done by the rules that actually generate them. These files are placed in the
bundle root in the same structure passed to this argument, so ["res/foo.png"] will end up in
res/foo.png inside the bundle.

Default: []
apple_core_data_model

This rule takes one or more Core Data model definitions from .xcdatamodeld
bundles and generates Swift or Objective-C source files that can be added
as srcs of a swift_library target.

AttributeTypeDescription
*namename

A unique name for this target.

*srcslist of labels
swift_versionstring

Target Swift version for generated classes.

Default: ""
outsdictionary: String → List of strings

A dictionary where the key is the name of a data model and the value is a
list of source files expected to be generated from that data model. For
example, if srcs contains one data model called "Taxonomy.xcdatamodeld" with
a single entity called "Animal," you might provide this value:

outs = {
    "Taxonomy": [
        "taxonomy+CoreDataModel.swift",
        "Animal+CoreDataProperties.swift",
    ],
},

If one or more files are provided for a data model, the rule will return these
files individually as outputs. Otherwise, the rule will return the directory
containing the sources for the data model.

Default: {}

@rules_apple@rules_apple//apple:tvos.bzl

Bazel rules for creating tvOS applications and bundles.

Rules

tvos_application

Builds and bundles a tvOS Application.

AttributeTypeDescription
*namename

A unique name for this target.

app_iconslist of labels

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. In Xcode 26+ for iOS/macOS/watchOS, an *.icon
bundle can be provided along with the *..xcassets bundle to support 26 and
pre-26 Apple OS rendering.

Default: []
primary_app_iconstring

An optional String to identify the name of the primary app icon when alternate app icons have been
provided for the app. This should match both the *.icon bundle in iOS/macOS/watchOS 26+ and the
*..xcassets/.appiconset bundle's AppIcon resource in previous versions of
iOS/macOS/watchOS.

Default: ""
app_intentslist of labels

List of dependencies implementing the AppIntents protocol.

Default: []
codesign_inputslist of labels

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

Default: []
codesignoptslist of strings

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

Default: []
exported_symbols_listslist of labels

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.

Default: []
linkoptslist of strings

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

Default: []
additional_linker_inputslist of labels

A list of input files to be passed to the linker.

Default: []
stampinteger

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.
Default: -1
depslist of labels

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

Default: []
bundle_namestring

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.

Default: ""
executable_namestring

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.

Default: ""
stringslist of labels

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.

Default: []
resourceslist of labels

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

Default: []
versionlabel

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

Default: None
familieslist of strings

A list of device families supported by this rule. At least one must be specified.

Default: ["tv"]
infoplistslist of labels

A list of .plist files that will be merged to form the Info.plist for this target. If not provided,
a default Info.plist will be used. Please see
Info.plist Handling
for what is supported.

Default: ["@rules_apple//apple/internal/templates:default_application_infoplist"]
ipa_post_processorlabel

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.

Default: None
locales_to_includelist of strings

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

Default: []
launch_imageslist of labels

Files that comprise the launch images for the application. Each file must have a containing
directory named *.xcassets/*.launchimage and there may be only one such .launchimage directory
in the list.

Default: []
*minimum_os_versionstring

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

minimum_deployment_os_versionstring

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.

Default: ""
platform_typestring
Default: "tvos"
settings_bundlelabel

A resource bundle (e.g. apple_bundle_import) target that contains the files that make up the
application's settings bundle. These files will be copied into the root of the final application
bundle in a directory named Settings.bundle.

Default: None
bundle_idstring

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.

Default: ""
bundle_id_suffixstring

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.

Default: "_"
provisioning_profilelabel

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.

Default: None
entitlementslabel

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.

Default: None
entitlements_validationstring

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

Default: "loose"
shared_capabilitieslist of labels

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.

Default: []
frameworkslist of labels

A list of framework targets (see
tvos_framework)
that this target depends on.

Default: []
extensionslist of labels

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

Default: []
launch_storyboardlabel

The .storyboard file that should be used as the launch screen for the application. The provided
file will be compiled into the appropriate format (.storyboardc) and placed in the root of the
final bundle. The generated file will also be registered in the bundle's Info.plist under the key
UILaunchStoryboardName.

Default: None
tvos_dynamic_framework

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

AttributeTypeDescription
*namename

A unique name for this target.

codesign_inputslist of labels

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

Default: []
codesignoptslist of strings

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

Default: []
exported_symbols_listslist of labels

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.

Default: []
linkoptslist of strings

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

Default: []
additional_linker_inputslist of labels

A list of input files to be passed to the linker.

Default: []
stampinteger

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.
Default: -1
depslist of labels

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

Default: []
bundle_namestring

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.

Default: ""
executable_namestring

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.

Default: ""
stringslist of labels

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.

Default: []
resourceslist of labels

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

Default: []
versionlabel

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

Default: None
familieslist of strings

A list of device families supported by this rule. At least one must be specified.

Default: ["tv"]
*infoplistslist of labels

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_processorlabel

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.

Default: None
*minimum_os_versionstring

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

minimum_deployment_os_versionstring

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.

Default: ""
platform_typestring
Default: "tvos"
bundle_idstring

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.

Default: ""
bundle_id_suffixstring

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.

Default: "bundle_name"
provisioning_profilelabel

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.

Default: None
base_bundle_idlabel

The base bundle ID rule to dictate the form that a given bundle rule's bundle ID prefix should take.

Default: None
bundle_onlyboolean

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.

Default: False
extension_safeboolean

If true, compiles and links this framework with -application-extension, restricting the binary to
use only extension-safe APIs.

Default: False
frameworkslist of labels

A list of framework targets (see
tvos_framework)
that this target depends on.

Default: []
hdrslist of labels
Default: []
tvos_extension

Builds and bundles a tvOS Extension.

AttributeTypeDescription
*namename

A unique name for this target.

codesign_inputslist of labels

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

Default: []
codesignoptslist of strings

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

Default: []
exported_symbols_listslist of labels

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.

Default: []
linkoptslist of strings

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

Default: []
additional_linker_inputslist of labels

A list of input files to be passed to the linker.

Default: []
stampinteger

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.
Default: -1
depslist of labels

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

Default: []
bundle_namestring

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.

Default: ""
executable_namestring

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.

Default: ""
stringslist of labels

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.

Default: []
resourceslist of labels

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

Default: []
versionlabel

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

Default: None
familieslist of strings

A list of device families supported by this rule. At least one must be specified.

Default: ["tv"]
extensionkit_extensionboolean

Indicates if this target should be treated as an ExtensionKit extension.

Default: False
*infoplistslist of labels

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_processorlabel

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.

Default: None
locales_to_includelist of strings

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

Default: []
*minimum_os_versionstring

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

minimum_deployment_os_versionstring

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.

Default: ""
platform_typestring
Default: "tvos"
bundle_idstring

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.

Default: ""
bundle_id_suffixstring

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.

Default: "bundle_name"
provisioning_profilelabel

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.

Default: None
entitlementslabel

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.

Default: None
entitlements_validationstring

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

Default: "loose"
shared_capabilitieslist of labels

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.

Default: []
frameworkslist of labels

A list of framework targets (see
tvos_framework)
that this target depends on.

Default: []
legacy_entry_pointboolean

If True, the extension uses the legacy tvOS extension entry point (_TVExtensionMain) used
by extensions prior to tvOS 13. If False (the default), the extension uses the modern
NSExtension entry point (_NSExtensionMain).

Default: False
tvos_framework

Builds and bundles a tvOS Dynamic Framework.

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

AttributeTypeDescription
*namename

A unique name for this target.

codesign_inputslist of labels

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

Default: []
codesignoptslist of strings

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

Default: []
exported_symbols_listslist of labels

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.

Default: []
linkoptslist of strings

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

Default: []
additional_linker_inputslist of labels

A list of input files to be passed to the linker.

Default: []
stampinteger

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.
Default: -1
depslist of labels

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

Default: []
bundle_namestring

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.

Default: ""
executable_namestring

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.

Default: ""
stringslist of labels

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.

Default: []
resourceslist of labels

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

Default: []
versionlabel

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

Default: None
familieslist of strings

A list of device families supported by this rule. At least one must be specified.

Default: ["tv"]
*infoplistslist of labels

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_processorlabel

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.

Default: None
*minimum_os_versionstring

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

minimum_deployment_os_versionstring

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.

Default: ""
platform_typestring
Default: "tvos"
bundle_idstring

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.

Default: ""
bundle_id_suffixstring

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.

Default: "bundle_name"
provisioning_profilelabel

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.

Default: None
base_bundle_idlabel

The base bundle ID rule to dictate the form that a given bundle rule's bundle ID prefix should take.

Default: None
bundle_onlyboolean

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.

Default: False
extension_safeboolean

If true, compiles and links this framework with -application-extension, restricting the binary to
use only extension-safe APIs.

Default: False
frameworkslist of labels

A list of framework targets (see
tvos_framework)
that this target depends on.

Default: []
hdrslist of labels
Default: []
tvos_static_framework

Builds and bundles an tvOS 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 tvOS bundles, the fat binary in an tvos_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
--tvos_cpus=x86_64,arm64 when you build).

tvos_static_framework supports Swift, but there are some constraints:

  • tvos_static_framework with Swift only works with Xcode 11 and above, since
    the required Swift functionality for module compatibility is available in
    Swift 5.1.
  • tvos_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.
  • tvos_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 tvos_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).

AttributeTypeDescription
*namename

A unique name for this target.

codesign_inputslist of labels

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

Default: []
codesignoptslist of strings

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

Default: []
exported_symbols_listslist of labels

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.

Default: []
linkoptslist of strings

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

Default: []
additional_linker_inputslist of labels

A list of input files to be passed to the linker.

Default: []
stampinteger

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.
Default: -1
depslist of labels

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

Default: []
bundle_namestring

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.

Default: ""
executable_namestring

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.

Default: ""
stringslist of labels

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.

Default: []
resourceslist of labels

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

Default: []
versionlabel

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

Default: None
familieslist of strings

A list of device families supported by this rule. At least one must be specified.

Default: ["tv"]
ipa_post_processorlabel

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.

Default: None
*minimum_os_versionstring

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

minimum_deployment_os_versionstring

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.

Default: ""
platform_typestring
Default: "tvos"
avoid_depslist of labels

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.

Default: []
exclude_resourcesboolean

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.

Default: False
hdrslist of labels

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.

Default: []
umbrella_headerlabel

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.

Default: None
tvos_build_test

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

Typical usage:

tvos_build_test( name = "my_build_test", minimum_os_version = "12.0", targets = [ "//some/package:my_library", ], )
AttributeTypeDescription
*namename

A unique name for this target.

*minimum_os_versionstring

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

targetslist of labels

The targets to check for successful build.

Default: []
platform_typestring
Default: "tvos"

@rules_apple@rules_apple//apple:versioning.bzl

Rules related to Apple bundle versioning.

Rules

apple_bundle_version

Produces a target that contains versioning information for an Apple bundle.

This rule allows version numbers to be hard-coded into the BUILD file or
extracted from the build label passed into Bazel using the --embed_label
command line flag.

Targets created by this rule do not generate outputs themselves, but instead
should be used in the version attribute of an Apple application or extension
bundle target to set the version keys in that bundle's Info.plist file.

Examples

# A version scheme that uses hard-coded versions checked into your # BUILD files. apple_bundle_version( name = "simple", build_version = "1.0.134", short_version_string = "1.0", ) ios_application( name = "foo_app", ..., version = ":simple", ) # A version scheme that parses version information out of the build # label and uses a fallback for developers' builds. For example, the # following command # # bazel build //myapp:myapp --embed_label=MyApp_1.2_build_345 # # would yield the Info.plist values: # # CFBundleVersion = "1.2.345" # CFBundleShortVersionString = "1.2" # # and the development builds using the command: # # bazel build //myapp:myapp # # would yield the values: # # CFBundleVersion = "99.99.99" # CFBundleShortVersionString = "99.99" # apple_bundle_version( name = "build_label_version", build_label_pattern = "MyApp_{version}_build_{build}", build_version = "{version}.{build}", capture_groups = { "version": "\\d+\\.\\d+", "build": "\\d+", }, short_version_string = "{version}", fallback_build_label = "MyApp_99.99_build_99", ) ios_application( name = "bar_app", ..., version = ":build_label_version", )

Provides:
AppleBundleVersionInfo: Contains a reference to the JSON file that holds the
version information for a bundle.

AttributeTypeDescription
*namename

A unique name for this target.

build_label_patternstring

A pattern that should contain placeholders inside curly braces (e.g.,
"foo_{version}_bar") that is used to parse the build label that is generated
in the build info file with the --embed_label option passed to Bazel. Each of
the placeholders is expected to match one of the keys in the capture_groups
attribute.

Default: ""
*build_versionstring

A string that will be used as the value for the CFBundleVersion key in a
depending bundle's Info.plist. If this string contains placeholders, then they
will be replaced by strings captured out of build_label_pattern.

capture_groupsdictionary: String → String

A dictionary where each key is the name of a placeholder found in
build_label_pattern and the corresponding value is the regular expression that
should match that placeholder. If this attribute is provided, then
build_label_pattern must also be provided.

Default: {}
fallback_build_labelstring

A build label to use when the no --embed_label was provided on the build. Used
to provide a version that will be used during development.

Default: ""
short_version_stringstring

A string that will be used as the value for the CFBundleShortVersionString key
in a depending bundle's Info.plist. If this string contains placeholders, then
they will be replaced by strings captured out of build_label_pattern. This
attribute is optional; if it is omitted, then the value of build_version will
be used for this key as well.

Default: ""

@rules_apple@rules_apple//apple:visionos.bzl

Bazel rules for creating visionOS applications and bundles.

Rules

visionos_application

Builds and bundles a visionOS Application.

AttributeTypeDescription
*namename

A unique name for this target.

app_iconslist of labels

Files that comprise the app icons for the application. Each file must have a containing directory
named *..xcassets/*..solidimagestack and there may be only one such
..solidimagestack directory in the list. In Xcode 26+ for iOS/macOS/watchOS, an *.icon
bundle can be provided along with the *..xcassets bundle to support 26 and
pre-26 Apple OS rendering.

Default: []
primary_app_iconstring

An optional String to identify the name of the primary app icon when alternate app icons have been
provided for the app. This should match both the *.icon bundle in iOS/macOS/watchOS 26+ and the
*..xcassets/.appiconset bundle's AppIcon resource in previous versions of
iOS/macOS/watchOS.

Default: ""
app_intentslist of labels

List of dependencies implementing the AppIntents protocol.

Default: []
codesign_inputslist of labels

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

Default: []
codesignoptslist of strings

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

Default: []
exported_symbols_listslist of labels

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.

Default: []
linkoptslist of strings

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

Default: []
additional_linker_inputslist of labels

A list of input files to be passed to the linker.

Default: []
stampinteger

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.
Default: -1
depslist of labels

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

Default: []
bundle_namestring

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.

Default: ""
executable_namestring

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.

Default: ""
stringslist of labels

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.

Default: []
resourceslist of labels

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

Default: []
versionlabel

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

Default: None
familieslist of strings

A list of device families supported by this rule. At least one must be specified.

Default: ["vision"]
infoplistslist of labels

A list of .plist files that will be merged to form the Info.plist for this target. If not provided,
a default Info.plist will be used. Please see
Info.plist Handling
for what is supported.

Default: ["@rules_apple//apple/internal/templates:default_application_infoplist"]
ipa_post_processorlabel

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.

Default: None
locales_to_includelist of strings

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

Default: []
*minimum_os_versionstring

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

minimum_deployment_os_versionstring

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.

Default: ""
platform_typestring
Default: "visionos"
bundle_idstring

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.

Default: ""
bundle_id_suffixstring

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.

Default: "bundle_name"
provisioning_profilelabel

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.

Default: None
entitlementslabel

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.

Default: None
entitlements_validationstring

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

Default: "loose"
shared_capabilitieslist of labels

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.

Default: []
frameworkslist of labels

A list of framework targets (see
visionos_framework)
that this target depends on.

Default: []
extensionslist of labels

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

Default: []
launch_storyboardlabel

The .storyboard file that should be used as the launch screen for the application. The provided
file will be compiled into the appropriate format (.storyboardc) and placed in the root of the
final bundle. The generated file will also be registered in the bundle's Info.plist under the key
UILaunchStoryboardName.

Default: None
visionos_dynamic_framework

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

AttributeTypeDescription
*namename

A unique name for this target.

codesign_inputslist of labels

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

Default: []
codesignoptslist of strings

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

Default: []
exported_symbols_listslist of labels

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.

Default: []
linkoptslist of strings

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

Default: []
additional_linker_inputslist of labels

A list of input files to be passed to the linker.

Default: []
stampinteger

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.
Default: -1
depslist of labels

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

Default: []
bundle_namestring

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.

Default: ""
executable_namestring

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.

Default: ""
stringslist of labels

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.

Default: []
resourceslist of labels

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

Default: []
versionlabel

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

Default: None
familieslist of strings

A list of device families supported by this rule. At least one must be specified.

Default: ["vision"]
*infoplistslist of labels

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_processorlabel

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.

Default: None
*minimum_os_versionstring

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

minimum_deployment_os_versionstring

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.

Default: ""
platform_typestring
Default: "visionos"
bundle_idstring

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.

Default: ""
bundle_id_suffixstring

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.

Default: "bundle_name"
provisioning_profilelabel

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.

Default: None
base_bundle_idlabel

The base bundle ID rule to dictate the form that a given bundle rule's bundle ID prefix should take.

Default: None
bundle_onlyboolean

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.

Default: False
extension_safeboolean

If true, compiles and links this framework with -application-extension, restricting the binary to
use only extension-safe APIs.

Default: False
frameworkslist of labels

A list of framework targets (see
visionos_framework)
that this target depends on.

Default: []
hdrslist of labels
Default: []
visionos_framework

Builds and bundles a visionos Dynamic Framework.

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

AttributeTypeDescription
*namename

A unique name for this target.

codesign_inputslist of labels

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

Default: []
codesignoptslist of strings

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

Default: []
exported_symbols_listslist of labels

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.

Default: []
linkoptslist of strings

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

Default: []
additional_linker_inputslist of labels

A list of input files to be passed to the linker.

Default: []
stampinteger

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.
Default: -1
depslist of labels

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

Default: []
bundle_namestring

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.

Default: ""
executable_namestring

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.

Default: ""
stringslist of labels

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.

Default: []
resourceslist of labels

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

Default: []
versionlabel

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

Default: None
familieslist of strings

A list of device families supported by this rule. At least one must be specified.

Default: ["vision"]
*infoplistslist of labels

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_processorlabel

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.

Default: None
*minimum_os_versionstring

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

minimum_deployment_os_versionstring

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.

Default: ""
platform_typestring
Default: "visionos"
bundle_idstring

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.

Default: ""
bundle_id_suffixstring

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.

Default: "bundle_name"
provisioning_profilelabel

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.

Default: None
base_bundle_idlabel

The base bundle ID rule to dictate the form that a given bundle rule's bundle ID prefix should take.

Default: None
bundle_onlyboolean

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.

Default: False
extension_safeboolean

If true, compiles and links this framework with -application-extension, restricting the binary to
use only extension-safe APIs.

Default: False
frameworkslist of labels

A list of framework targets (see
visionos_framework)
that this target depends on.

Default: []
hdrslist of labels
Default: []
visionos_static_framework

Builds and bundles an visionos 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 visionos bundles, the fat binary in an visionos_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
--visionos_cpus=sim_arm64,arm64 when you build).

visionos_static_framework supports Swift, but there are some constraints:

  • visionos_static_framework with Swift only works with Xcode 11 and above, since
    the required Swift functionality for module compatibility is available in
    Swift 5.1.
  • visionos_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.
  • visionos_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 visionos_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).

AttributeTypeDescription
*namename

A unique name for this target.

codesign_inputslist of labels

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

Default: []
codesignoptslist of strings

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

Default: []
exported_symbols_listslist of labels

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.

Default: []
linkoptslist of strings

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

Default: []
additional_linker_inputslist of labels

A list of input files to be passed to the linker.

Default: []
stampinteger

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.
Default: -1
depslist of labels

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

Default: []
bundle_namestring

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.

Default: ""
executable_namestring

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.

Default: ""
stringslist of labels

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.

Default: []
resourceslist of labels

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

Default: []
versionlabel

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

Default: None
familieslist of strings

A list of device families supported by this rule. At least one must be specified.

Default: ["vision"]
ipa_post_processorlabel

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.

Default: None
*minimum_os_versionstring

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

minimum_deployment_os_versionstring

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.

Default: ""
platform_typestring
Default: "visionos"
avoid_depslist of labels

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.

Default: []
exclude_resourcesboolean

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.

Default: False
hdrslist of labels

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.

Default: []
umbrella_headerlabel

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.

Default: None
visionos_build_test

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

Typical usage:

visionos_build_test( name = "my_build_test", minimum_os_version = "1.0", targets = [ "//some/package:my_library", ], )
AttributeTypeDescription
*namename

A unique name for this target.

*minimum_os_versionstring

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

targetslist of labels

The targets to check for successful build.

Default: []
platform_typestring
Default: "visionos"

@rules_apple@rules_apple//apple:watchos.bzl

Bazel rules for creating watchOS applications and bundles.

Rules

watchos_application

Builds and bundles a watchOS Application.

AttributeTypeDescription
*namename

A unique name for this target.

app_iconslist of labels

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. In Xcode 26+ for iOS/macOS/watchOS, an *.icon
bundle can be provided along with the *..xcassets bundle to support 26 and
pre-26 Apple OS rendering.

Default: []
app_intentslist of labels

List of dependencies implementing the AppIntents protocol.

Default: []
codesign_inputslist of labels

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

Default: []
codesignoptslist of strings

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

Default: []
exported_symbols_listslist of labels

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.

Default: []
linkoptslist of strings

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

Default: []
additional_linker_inputslist of labels

A list of input files to be passed to the linker.

Default: []
stampinteger

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.
Default: -1
depslist of labels

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

Default: []
bundle_namestring

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.

Default: ""
executable_namestring

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.

Default: ""
stringslist of labels

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.

Default: []
resourceslist of labels

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

Default: []
versionlabel

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

Default: None
familieslist of strings

A list of device families supported by this rule. At least one must be specified.

Default: ["watch"]
infoplistslist of labels

A list of .plist files that will be merged to form the Info.plist for this target. If not provided,
a default Info.plist will be used. Please see
Info.plist Handling
for what is supported.

Default: ["@rules_apple//apple/internal/templates:default_application_infoplist"]
ipa_post_processorlabel

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.

Default: None
locales_to_includelist of strings

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

Default: []
*minimum_os_versionstring

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

minimum_deployment_os_versionstring

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.

Default: ""
platform_typestring
Default: "watchos"
bundle_idstring

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.

Default: ""
bundle_id_suffixstring

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.

Default: "watchkitapp"
provisioning_profilelabel

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.

Default: None
entitlementslabel

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.

Default: None
entitlements_validationstring

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

Default: "loose"
shared_capabilitieslist of labels

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.

Default: []
extensionlabel

The watchOS 2 watchos_extension that is required to be bundled within a watchOS 2 application.

It is considered an error if the watchOS 2 application extension is assigned to a single target
watchOS application, which is constructed if the watchos_application target is assigned deps.

This attribute will not support additional types of watchos_extensions in the future.

This attribute is deprecated, please use extensions instead.

Default: None
extensionslist of labels

In case of single-target watchOS app, a list of watchOS application extensions to include in the final watch app bundle.

In case of an extension-based watchOS app, a list with a single element,
the watchOS 2 watchos_extension that is required to be bundled within a watchOS 2 app.

Default: []
storyboardslist of labels

A list of .storyboard files, often localizable. These files are compiled and placed in the root of
the final application 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.

Default: []
frameworkslist of labels

A list of framework targets (see
watchos_framework)
that this target depends on.

Default: []
watchos_dynamic_framework

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

AttributeTypeDescription
*namename

A unique name for this target.

codesign_inputslist of labels

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

Default: []
codesignoptslist of strings

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

Default: []
exported_symbols_listslist of labels

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.

Default: []
linkoptslist of strings

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

Default: []
additional_linker_inputslist of labels

A list of input files to be passed to the linker.

Default: []
stampinteger

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.
Default: -1
depslist of labels

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

Default: []
bundle_namestring

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.

Default: ""
executable_namestring

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.

Default: ""
stringslist of labels

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.

Default: []
resourceslist of labels

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

Default: []
versionlabel

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

Default: None
familieslist of strings

A list of device families supported by this rule. At least one must be specified.

Default: ["watch"]
*infoplistslist of labels

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_processorlabel

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.

Default: None
*minimum_os_versionstring

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

minimum_deployment_os_versionstring

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.

Default: ""
platform_typestring
Default: "watchos"
bundle_idstring

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.

Default: ""
bundle_id_suffixstring

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.

Default: "bundle_name"
provisioning_profilelabel

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.

Default: None
base_bundle_idlabel

The base bundle ID rule to dictate the form that a given bundle rule's bundle ID prefix should take.

Default: None
bundle_onlyboolean

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.

Default: False
extension_safeboolean

If true, compiles and links this framework with -application-extension, restricting the binary to
use only extension-safe APIs.

Default: False
frameworkslist of labels

A list of framework targets (see
watchos_framework)
that this target depends on.

Default: []
hdrslist of labels
Default: []
watchos_framework

Builds and bundles a watchOS Dynamic Framework.

To use this framework for your extensions, list it in the frameworks attributes of
those watchos_extension rules.

AttributeTypeDescription
*namename

A unique name for this target.

codesign_inputslist of labels

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

Default: []
codesignoptslist of strings

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

Default: []
exported_symbols_listslist of labels

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.

Default: []
linkoptslist of strings

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

Default: []
additional_linker_inputslist of labels

A list of input files to be passed to the linker.

Default: []
stampinteger

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.
Default: -1
depslist of labels

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

Default: []
bundle_namestring

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.

Default: ""
executable_namestring

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.

Default: ""
stringslist of labels

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.

Default: []
resourceslist of labels

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

Default: []
versionlabel

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

Default: None
familieslist of strings

A list of device families supported by this rule. At least one must be specified.

Default: ["watch"]
*infoplistslist of labels

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_processorlabel

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.

Default: None
*minimum_os_versionstring

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

minimum_deployment_os_versionstring

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.

Default: ""
platform_typestring
Default: "watchos"
bundle_idstring

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.

Default: ""
bundle_id_suffixstring

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.

Default: "bundle_name"
provisioning_profilelabel

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.

Default: None
base_bundle_idlabel

The base bundle ID rule to dictate the form that a given bundle rule's bundle ID prefix should take.

Default: None
bundle_onlyboolean

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.

Default: False
extension_safeboolean

If true, compiles and links this framework with -application-extension, restricting the binary to
use only extension-safe APIs.

Default: False
frameworkslist of labels

A list of framework targets (see
watchos_framework)
that this target depends on.

Default: []
hdrslist of labels
Default: []
watchos_extension

Builds and bundles a watchOS Extension.

AttributeTypeDescription
*namename

A unique name for this target.

app_intentslist of labels

List of dependencies implementing the AppIntents protocol.

Default: []
codesign_inputslist of labels

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

Default: []
codesignoptslist of strings

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

Default: []
exported_symbols_listslist of labels

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.

Default: []
linkoptslist of strings

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

Default: []
additional_linker_inputslist of labels

A list of input files to be passed to the linker.

Default: []
stampinteger

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.
Default: -1
depslist of labels

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

Default: []
bundle_namestring

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.

Default: ""
executable_namestring

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.

Default: ""
stringslist of labels

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.

Default: []
resourceslist of labels

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

Default: []
versionlabel

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

Default: None
familieslist of strings

A list of device families supported by this rule. At least one must be specified.

Default: ["watch"]
*infoplistslist of labels

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_processorlabel

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.

Default: None
locales_to_includelist of strings

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

Default: []
*minimum_os_versionstring

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

minimum_deployment_os_versionstring

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.

Default: ""
platform_typestring
Default: "watchos"
bundle_idstring

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.

Default: ""
bundle_id_suffixstring

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.

Default: "watchkitapp.watchkitextension"
provisioning_profilelabel

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.

Default: None
entitlementslabel

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.

Default: None
entitlements_validationstring

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

Default: "loose"
shared_capabilitieslist of labels

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.

Default: []
application_extensionboolean

If True, this extension is an App Extension instead of a WatchKit Extension.
It links the extension with the application extension point (_NSExtensionMain)
instead of the WatchKit extension point (_WKExtensionMain), and has the
app_extension product_type instead of watch2_extension.

Default: False
extensionslist of labels

A list of watchOS application extensions to include in the final watch extension bundle.

Default: []
frameworkslist of labels

A list of framework targets (see
watchos_framework)
that this target depends on.

Default: []
watchos_static_framework

Builds and bundles a watchOS Static Framework.

AttributeTypeDescription
*namename

A unique name for this target.

codesign_inputslist of labels

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

Default: []
codesignoptslist of strings

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

Default: []
exported_symbols_listslist of labels

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.

Default: []
linkoptslist of strings

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

Default: []
additional_linker_inputslist of labels

A list of input files to be passed to the linker.

Default: []
stampinteger

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.
Default: -1
depslist of labels

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

Default: []
bundle_namestring

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.

Default: ""
executable_namestring

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.

Default: ""
stringslist of labels

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.

Default: []
resourceslist of labels

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

Default: []
versionlabel

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

Default: None
familieslist of strings

A list of device families supported by this rule. At least one must be specified.

Default: ["watch"]
ipa_post_processorlabel

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.

Default: None
*minimum_os_versionstring

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

minimum_deployment_os_versionstring

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.

Default: ""
platform_typestring
Default: "watchos"
avoid_depslist of labels

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.

Default: []
exclude_resourcesboolean

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.

Default: False
hdrslist of labels

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.

Default: []
umbrella_headerlabel

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.

Default: None
watchos_build_test

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

Typical usage:

watchos_build_test( name = "my_build_test", minimum_os_version = "6.0", targets = [ "//some/package:my_library", ], )
AttributeTypeDescription
*namename

A unique name for this target.

*minimum_os_versionstring

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

targetslist of labels

The targets to check for successful build.

Default: []
platform_typestring
Default: "watchos"

@rules_apple@rules_apple//apple:xcarchive.bzl

Rules for creating Xcode archives.

Rules

xcarchive

Re-packages an Apple bundle into a .xcarchive.

This rule uses the providers from the bundle target to construct the required
metadata for the .xcarchive.

Example:

load("//apple:xcarchive.bzl", "xcarchive") ios_application( name = "App", bundle_id = "com.example.my.app", ... ) xcarchive( name = "App.xcarchive", bundle = ":App", )
AttributeTypeDescription
*namename

A unique name for this target.

bundlelabel

The label to a target to re-package into a .xcarchive. For example, an
ios_application target.

Default: None

@rules_apple@rules_apple//apple:xctrunner.bzl

Rule for creating a XCTRunner.app with one or more .xctest bundles. Retains same
platform and architectures as the given tests bundles.

Rules

xctrunner

Packages one or more .xctest bundles into a XCTRunner.app. Retains same
platform and architectures as the given tests bundles.

Example:

load("//apple:xctrunner.bzl", "xctrunner") ios_ui_test( name = "HelloWorldSwiftUITests", minimum_os_version = "15.0", runner = "@rules_apple//apple/testing/default_runner:ios_xctestrun_ordered_runner", test_host = ":HelloWorldSwift", deps = [":UITests"], ) xctrunner( name = "HelloWorldSwiftXCTRunner", tests = [":HelloWorldSwiftUITests"], testonly = True, )
AttributeTypeDescription
*namename

A unique name for this target.

*testslist of labels

List of test targets and suites to include.

verboseboolean

Print logs from xctrunnertool to console.

Default: False