@rules_apple@rules_apple//apple:apple.bzl
Rules that apply to all Apple platforms.
Rules
apple_dynamic_framework_importThis 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", ], )
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
*framework_imports | list of labels | The list of files under a .framework directory which are provided to Apple based targets that depend |
deps | list of labels | A list of targets that are dependencies of the target being built, which will be linked into that Default: [] |
dsym_imports | list of labels | The list of files under a .dSYM directory, that is the imported framework's dSYM bundle. Default: [] |
bundle_only | boolean | Avoid linking the dynamic framework, but still include it in the app. This is useful when you want Default: False |
apple_dynamic_xcframework_importThis 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", ], )
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
*xcframework_imports | list of labels | List of files under a .xcframework directory which are provided to Apple based targets that depend |
deps | list of labels | List of targets that are dependencies of the target being built, which will provide headers and be Default: [] |
bundle_only | boolean | Avoid linking the dynamic framework, but still include it in the app. This is useful when you want Default: False |
library_identifiers | dictionary: String → String | Unnecssary and ignored, will be removed in the future. Default: {} |
apple_static_framework_importThis 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", ], )
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
*framework_imports | list of labels | The list of files under a .framework directory which are provided to Apple based targets that depend |
sdk_dylibs | list of strings | Names of SDK .dylib libraries to link with. For instance, Default: [] |
sdk_frameworks | list of strings | Names of SDK frameworks to link with (e.g. Default: [] |
weak_sdk_frameworks | list of strings | Names of SDK frameworks to weakly link with. For instance, Default: [] |
deps | list of labels | A list of targets that are dependencies of the target being built, which will provide headers and be Default: [] |
data | list of labels | List of files needed by this target at runtime. Files and targets named in the Default: [] |
alwayslink | boolean | If true, any binary that depends (directly or indirectly) on this framework will link in all the Default: False |
has_swift | boolean | A boolean indicating if the target has Swift source code. This helps flag Apple frameworks that do Default: False |
apple_static_libraryThis 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.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
additional_linker_inputs | list of labels | A list of input files to be passed to the linker. Default: [] |
avoid_deps | list of labels | A list of library targets on which this framework depends in order to compile, but the transitive Default: [] |
data | list of labels | Files to be made available to the library archive upon execution. Default: [] |
deps | list of labels | A list of dependencies targets that will be linked into this target's binary. Any resources, such as Default: [] |
linkopts | list of strings | A list of strings representing extra flags that should be passed to the linker. Default: [] |
*minimum_os_version | string | A required string indicating the minimum OS version supported by the target, represented as a |
*platform_type | string | The target Apple platform for which to create a binary. This dictates which SDK
|
sdk_frameworks | list of strings | Names of SDK frameworks to link with (e.g., This attribute is discouraged; in general, targets should list system Default: [] |
sdk_dylibs | list of strings | Names of SDK Default: [] |
weak_sdk_frameworks | list of strings | Names of SDK frameworks to weakly link with (e.g., This attribute is discouraged; in general, targets should list system Default: [] |
apple_static_xcframeworkGenerates an XCFramework with static libraries for third-party distribution.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
bundle_id | string | Optional bundle ID (reverse-DNS path followed by framework name) for each of the embedded frameworks. Default: "" |
executable_name | string | The desired name of the executable, if the bundle has an executable. If this attribute is not set, Default: "" |
avoid_deps | list of labels | A list of library targets on which this framework depends in order to compile, but the transitive Default: [] |
bundle_name | string | The desired name of the XCFramework bundle (without the extension) and the binaries for all embedded Default: "" |
*deps | list of labels | A list of files directly referencing libraries to be represented for each given platform split in |
families_required | dictionary: String → List of strings | A list of device families supported by this extension, with platforms such as Default: {} |
infoplists | list of labels | A list of .plist files that will be merged to form the Info.plist for each of the embedded Default: [] |
ios | dictionary: String → List of strings | A dictionary of strings indicating which platform variants should be built for the Default: {} |
macos | list of strings | A list of strings indicating which architecture should be built for the macOS platform (for example, Default: [] |
tvos | dictionary: String → List of strings | A dictionary of strings indicating which platform variants should be built for the tvOS platform ( Default: {} |
visionos | dictionary: String → List of strings | A dictionary of strings indicating which platform variants should be built for the visionOS platform Default: {} |
minimum_deployment_os_versions | dictionary: String → String | A dictionary of strings indicating the minimum deployment OS version supported by the target, Default: {} |
*minimum_os_versions | dictionary: String → String | A dictionary of strings indicating the minimum OS version supported by the target, represented as a |
public_hdrs | list of labels | A list of files directly referencing header files to be used as the publicly visible interface for Default: [] |
umbrella_header | label | An optional single .h file to use as the umbrella header for this framework. Usually, this header Default: None |
version | label | An Default: None |
apple_static_xcframework_importThis 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", ], )
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
alwayslink | boolean | If true, any binary that depends (directly or indirectly) on this XCFramework will link in all the Default: False |
deps | list of labels | List of targets that are dependencies of the target being built, which will provide headers and be Default: [] |
data | list of labels | List of files needed by this target at runtime. Files and targets named in the Default: [] |
has_swift | boolean | A boolean indicating if the target has Swift source code. This helps flag XCFrameworks that do not Default: False |
includes | list of strings | List of The paths are interpreted relative to the single platform directory inside the These flags are added for this rule and every rule that depends on it. (Note: Default: [] |
linkopts | list of strings | A list of strings representing extra flags that should be passed to the linker. Default: [] |
sdk_dylibs | list of strings | Names of SDK .dylib libraries to link with. For instance, Default: [] |
sdk_frameworks | list of strings | Names of SDK frameworks to link with (e.g. Default: [] |
weak_sdk_frameworks | list of strings | Names of SDK frameworks to weakly link with. For instance, Default: [] |
*xcframework_imports | list of labels | List of files under a .xcframework directory which are provided to Apple based targets that depend |
library_identifiers | dictionary: String → String | Unnecssary and ignored, will be removed in the future. Default: {} |
apple_universal_binaryThis rule produces a multi-architecture ("fat") binary targeting Apple platforms.
The lipo tool is used to combine built binaries of multiple architectures.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
*minimum_os_version | string | A required string indicating the minimum OS version supported by the target, represented as a |
minimum_deployment_os_version | string | A required string indicating the minimum deployment OS version supported by the target, represented Default: "" |
*platform_type | string | The target Apple platform for which to create a binary. This dictates which SDK
|
*binary | label | Target to generate a 'fat' binary from. |
forced_cpus | list 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 ( This is primarily useful to force macOS tools to be built as universal binaries using Default: [] |
apple_xcframeworkBuilds and bundles an XCFramework for third-party distribution.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
codesign_inputs | list of labels | A list of dependencies targets that provide inputs that will be used by Default: [] |
codesignopts | list of strings | A list of strings representing extra flags that should be passed to Default: [] |
exported_symbols_lists | list of labels | A list of targets containing exported symbols lists files for the linker to control symbol Each file is expected to have a list of global symbol names that will remain as global symbols in See the man page documentation for Default: [] |
linkopts | list of strings | A list of strings representing extra flags that should be passed to the linker. Default: [] |
additional_linker_inputs | list of labels | A list of input files to be passed to the linker. Default: [] |
stamp | integer | Enable link stamping. Whether to encode build information into the binary. Possible values:
Default: -1 |
deps | list of labels | A list of dependent targets that will be linked into this target's binary(s). Any resources, such as Default: [] |
*bundle_id | string | The bundle ID (reverse-DNS path followed by app name) for each of the embedded frameworks. If |
bundle_name | string | The desired name of the xcframework bundle (without the extension) and the bundles for all embedded Default: "" |
data | list of labels | A list of resources or files bundled with the bundle. The resources will be stored in the Default: [] |
extension_safe | boolean | If true, compiles and links this framework with Default: False |
families_required | dictionary: String → List of strings | A list of device families supported by this extension, with platforms such as Default: {} |
*infoplists | list of labels | A list of .plist files that will be merged to form the Info.plist for each of the embedded |
ios | dictionary: String → List of strings | A dictionary of strings indicating which platform variants should be built for the iOS platform ( Default: {} |
macos | list of strings | A list of strings indicating which architecture should be built for the macOS platform (for example, Default: [] |
tvos | dictionary: String → List of strings | A dictionary of strings indicating which platform variants should be built for the tvOS platform ( Default: {} |
visionos | dictionary: String → List of strings | A dictionary of strings indicating which platform variants should be built for the visionOS platform Default: {} |
minimum_deployment_os_versions | dictionary: String → String | A dictionary of strings indicating the minimum deployment OS version supported by the target, Default: {} |
*minimum_os_versions | dictionary: String → String | A dictionary of strings indicating the minimum OS version supported by the target, represented as a |
public_hdrs | list of labels | A list of files directly referencing header files to be used as the publicly visible interface for Default: [] |
version | label | An Default: None |
umbrella_header | label | An optional single .h file to use as the umbrella header for this framework. Usually, this header Default: None |
local_provisioning_profileThis 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", )
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
profile_extension | string | The extension for the provisioning profile which may differ by platform. Default: ".mobileprovision" |
profile_name | string | Name of the profile to use, if it's not provided the name of the rule is used Default: "" |
team_id | string | 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_extensionSee provisioning_profile_repository for more information and examples.
Tag Classes
setup| Attribute | Type | Description |
|---|---|---|
fallback_profiles | label | Default: None |
Repository Rules
provisioning_profile_repositoryThis 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@rules_apple@rules_apple//apple:docc.bzl
Defines rules for building Apple DocC targets.
Rules
docc_archiveBuilds 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", )
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
dep | label | Default: None |
default_code_listing_language | string | A fallback default language for code listings if no value is provided in the documentation bundle's Info.plist file. Default: "" |
diagnostic_level | string | Filters diagnostics above this level from output Default: "" |
emit_extension_block_symbols | string | Defines if the symbol graph information for This value must be either Default: "0" |
enable_inherited_docs | boolean | Inherit documentation for inherited symbols. Default: False |
*fallback_bundle_identifier | string | A fallback bundle identifier if no value is provided in the documentation bundle's Info.plist file. |
*fallback_bundle_version | string | A fallback bundle version if no value is provided in the documentation bundle's Info.plist file. |
*fallback_display_name | string | A fallback display name if no value is provided in the documentation bundle's Info.plist file. |
hosting_base_path | string | 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: "" |
kinds | list of strings | The kinds of entities to filter generated documentation for. Default: [] |
minimum_access_level | string | " Default: "public" |
transform_for_static_hosting | boolean | Default: True |
@rules_apple@rules_apple//apple:dtrace.bzl
Bazel rules for working with dtrace.
Rules
dtrace_compileCompiles
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.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
dtrace | label | dtrace binary to use. Default: None |
srcs | list 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_mapCreates 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"]
)
```
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
module_name | string | The prefix to be used for header imports Default: "" |
hdrs | list of labels | The list of headers included in the header_map Default: [] |
deps | list 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_applicationBuilds and bundles an iOS Application.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
app_icons | list of labels | Files that comprise the app icons for the application. Each file must have a containing directory Default: [] |
primary_app_icon | string | An optional String to identify the name of the primary app icon when alternate app icons have been Default: "" |
app_intents | list of labels | List of dependencies implementing the AppIntents protocol. Default: [] |
codesign_inputs | list of labels | A list of dependencies targets that provide inputs that will be used by Default: [] |
codesignopts | list of strings | A list of strings representing extra flags that should be passed to Default: [] |
exported_symbols_lists | list of labels | A list of targets containing exported symbols lists files for the linker to control symbol Each file is expected to have a list of global symbol names that will remain as global symbols in See the man page documentation for Default: [] |
linkopts | list of strings | A list of strings representing extra flags that should be passed to the linker. Default: [] |
additional_linker_inputs | list of labels | A list of input files to be passed to the linker. Default: [] |
stamp | integer | Enable link stamping. Whether to encode build information into the binary. Possible values:
Default: -1 |
deps | list of labels | A list of dependent targets that will be linked into this target's binary(s). Any resources, such as Default: [] |
bundle_name | string | The desired name of the bundle (without the extension). If this attribute is not set, then the name Default: "" |
executable_name | string | The desired name of the executable, if the bundle has an executable. If this attribute is not set, Default: "" |
strings | list of labels | A list of Default: [] |
resources | list of labels | A list of resources or files bundled with the bundle. The resources will be stored in the Default: [] |
version | label | An Default: None |
*families | list of strings | A list of device families supported by this rule. At least one must be specified. |
infoplists | list of labels | A list of .plist files that will be merged to form the Info.plist for this target. If not provided, Default: ["@rules_apple//apple/internal/templates:default_application_infoplist"] |
ipa_post_processor | label | A tool that edits this target's archive after it is assembled but before it is signed. The tool is Any changes made by the tool must be made in this directory, and the tool's execution must be Default: None |
launch_images | list of labels | Files that comprise the launch images for the application. Each file must have a containing Default: [] |
locales_to_include | list 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. Default: [] |
*minimum_os_version | string | A required string indicating the minimum OS version supported by the target, represented as a |
minimum_deployment_os_version | string | A required string indicating the minimum deployment OS version supported by the target, represented Default: "" |
platform_type | string | Default: "ios" |
settings_bundle | label | A resource bundle (e.g. Default: None |
bundle_id | string | The bundle ID (reverse-DNS path followed by app name) for this target. Only use this attribute if Default: "" |
bundle_id_suffix | string | A string to act as the suffix of the composed bundle ID. If this target's bundle ID is composed from Default: "_" |
provisioning_profile | label | The provisioning profile ( Default: None |
entitlements | label | The entitlements file required for device builds of this target. If absent, the default entitlements The following variables are substituted in the entitlements file: Default: None |
entitlements_validation | string | An Default: "loose" |
shared_capabilities | list of labels | A list of shared Default: [] |
alternate_icons | list of labels | Files that comprise the alternate app icons for the application. Each file must have a containing directory Default: [] |
app_clips | list of labels | A list of iOS app clips to include in the final application bundle. Default: [] |
extensions | list of labels | A list of iOS application extensions to include in the final application bundle. Default: [] |
frameworks | list of labels | A list of framework targets (see Default: [] |
include_symbols_in_bundle | boolean | If true and --output_groups=+dsyms is specified, generates Default: False |
launch_storyboard | label | The Default: None |
sdk_frameworks | list of strings | Names of SDK frameworks to link with (e.g., This attribute is discouraged; in general, targets should list system Default: [] |
watch_application | label | A Default: None |
ios_app_clipBuilds and bundles an iOS App Clip.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
app_icons | list of labels | Files that comprise the app icons for the application. Each file must have a containing directory Default: [] |
codesign_inputs | list of labels | A list of dependencies targets that provide inputs that will be used by Default: [] |
codesignopts | list of strings | A list of strings representing extra flags that should be passed to Default: [] |
exported_symbols_lists | list of labels | A list of targets containing exported symbols lists files for the linker to control symbol Each file is expected to have a list of global symbol names that will remain as global symbols in See the man page documentation for Default: [] |
linkopts | list of strings | A list of strings representing extra flags that should be passed to the linker. Default: [] |
additional_linker_inputs | list of labels | A list of input files to be passed to the linker. Default: [] |
stamp | integer | Enable link stamping. Whether to encode build information into the binary. Possible values:
Default: -1 |
deps | list of labels | A list of dependent targets that will be linked into this target's binary(s). Any resources, such as Default: [] |
bundle_name | string | The desired name of the bundle (without the extension). If this attribute is not set, then the name Default: "" |
executable_name | string | The desired name of the executable, if the bundle has an executable. If this attribute is not set, Default: "" |
strings | list of labels | A list of Default: [] |
resources | list of labels | A list of resources or files bundled with the bundle. The resources will be stored in the Default: [] |
version | label | An Default: None |
*families | list of strings | A list of device families supported by this rule. At least one must be specified. |
*infoplists | list of labels | A list of .plist files that will be merged to form the Info.plist for this target. At least one file |
ipa_post_processor | label | A tool that edits this target's archive after it is assembled but before it is signed. The tool is Any changes made by the tool must be made in this directory, and the tool's execution must be Default: None |
locales_to_include | list 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. Default: [] |
*minimum_os_version | string | A required string indicating the minimum OS version supported by the target, represented as a |
minimum_deployment_os_version | string | A required string indicating the minimum deployment OS version supported by the target, represented Default: "" |
platform_type | string | Default: "ios" |
bundle_id | string | The bundle ID (reverse-DNS path followed by app name) for this target. Only use this attribute if Default: "" |
bundle_id_suffix | string | A string to act as the suffix of the composed bundle ID. If this target's bundle ID is composed from Default: "bundle_name" |
provisioning_profile | label | The provisioning profile ( Default: None |
entitlements | label | The entitlements file required for device builds of this target. If absent, the default entitlements The following variables are substituted in the entitlements file: Default: None |
entitlements_validation | string | An Default: "loose" |
shared_capabilities | list of labels | A list of shared Default: [] |
frameworks | list of labels | A list of framework targets (see Default: [] |
launch_storyboard | label | The Default: None |
extensions | list of labels | A list of ios_extension live activity extensions to include in the final app clip bundle. Default: [] |
ios_dynamic_frameworkBuilds and bundles an iOS dynamic framework that is consumable by Xcode.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
codesign_inputs | list of labels | A list of dependencies targets that provide inputs that will be used by Default: [] |
codesignopts | list of strings | A list of strings representing extra flags that should be passed to Default: [] |
exported_symbols_lists | list of labels | A list of targets containing exported symbols lists files for the linker to control symbol Each file is expected to have a list of global symbol names that will remain as global symbols in See the man page documentation for Default: [] |
linkopts | list of strings | A list of strings representing extra flags that should be passed to the linker. Default: [] |
additional_linker_inputs | list of labels | A list of input files to be passed to the linker. Default: [] |
stamp | integer | Enable link stamping. Whether to encode build information into the binary. Possible values:
Default: -1 |
deps | list of labels | A list of dependent targets that will be linked into this target's binary(s). Any resources, such as Default: [] |
bundle_name | string | The desired name of the bundle (without the extension). If this attribute is not set, then the name Default: "" |
executable_name | string | The desired name of the executable, if the bundle has an executable. If this attribute is not set, Default: "" |
strings | list of labels | A list of Default: [] |
resources | list of labels | A list of resources or files bundled with the bundle. The resources will be stored in the Default: [] |
version | label | An Default: None |
families | list of strings | A list of device families supported by this rule. At least one must be specified. Default: ["iphone", "ipad"] |
*infoplists | list of labels | A list of .plist files that will be merged to form the Info.plist for this target. At least one file |
ipa_post_processor | label | A tool that edits this target's archive after it is assembled but before it is signed. The tool is Any changes made by the tool must be made in this directory, and the tool's execution must be Default: None |
*minimum_os_version | string | A required string indicating the minimum OS version supported by the target, represented as a |
minimum_deployment_os_version | string | A required string indicating the minimum deployment OS version supported by the target, represented Default: "" |
platform_type | string | Default: "ios" |
bundle_id | string | The bundle ID (reverse-DNS path followed by app name) for this target. Only use this attribute if Default: "" |
bundle_id_suffix | string | A string to act as the suffix of the composed bundle ID. If this target's bundle ID is composed from Default: "bundle_name" |
provisioning_profile | label | The provisioning profile ( Default: None |
base_bundle_id | label | The base bundle ID rule to dictate the form that a given bundle rule's bundle ID prefix should take. Default: None |
bundle_only | boolean | Avoid linking the dynamic framework, but still include it in the app. This is useful when you want Default: False |
extension_safe | boolean | If true, compiles and links this framework with Default: False |
frameworks | list of labels | A list of framework targets (see Default: [] |
hdrs | list of labels | Default: [] |
ios_extensionBuilds 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).
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
app_icons | list of labels | Files that comprise the app icons for the application. Each file must have a containing directory Default: [] |
app_intents | list of labels | List of dependencies implementing the AppIntents protocol. Default: [] |
codesign_inputs | list of labels | A list of dependencies targets that provide inputs that will be used by Default: [] |
codesignopts | list of strings | A list of strings representing extra flags that should be passed to Default: [] |
exported_symbols_lists | list of labels | A list of targets containing exported symbols lists files for the linker to control symbol Each file is expected to have a list of global symbol names that will remain as global symbols in See the man page documentation for Default: [] |
linkopts | list of strings | A list of strings representing extra flags that should be passed to the linker. Default: [] |
additional_linker_inputs | list of labels | A list of input files to be passed to the linker. Default: [] |
stamp | integer | Enable link stamping. Whether to encode build information into the binary. Possible values:
Default: -1 |
deps | list of labels | A list of dependent targets that will be linked into this target's binary(s). Any resources, such as Default: [] |
bundle_name | string | The desired name of the bundle (without the extension). If this attribute is not set, then the name Default: "" |
executable_name | string | The desired name of the executable, if the bundle has an executable. If this attribute is not set, Default: "" |
strings | list of labels | A list of Default: [] |
resources | list of labels | A list of resources or files bundled with the bundle. The resources will be stored in the Default: [] |
version | label | An Default: None |
*families | list of strings | A list of device families supported by this rule. At least one must be specified. |
extensionkit_extension | boolean | Indicates if this target should be treated as an ExtensionKit extension. Default: False |
*infoplists | list of labels | A list of .plist files that will be merged to form the Info.plist for this target. At least one file |
ipa_post_processor | label | A tool that edits this target's archive after it is assembled but before it is signed. The tool is Any changes made by the tool must be made in this directory, and the tool's execution must be Default: None |
locales_to_include | list 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. Default: [] |
*minimum_os_version | string | A required string indicating the minimum OS version supported by the target, represented as a |
minimum_deployment_os_version | string | A required string indicating the minimum deployment OS version supported by the target, represented Default: "" |
platform_type | string | Default: "ios" |
bundle_id | string | The bundle ID (reverse-DNS path followed by app name) for this target. Only use this attribute if Default: "" |
bundle_id_suffix | string | A string to act as the suffix of the composed bundle ID. If this target's bundle ID is composed from Default: "bundle_name" |
provisioning_profile | label | The provisioning profile ( Default: None |
entitlements | label | The entitlements file required for device builds of this target. If absent, the default entitlements The following variables are substituted in the entitlements file: Default: None |
entitlements_validation | string | An Default: "loose" |
shared_capabilities | list of labels | A list of shared Default: [] |
frameworks | list of labels | A list of framework targets (see Default: [] |
sdk_frameworks | list of strings | Names of SDK frameworks to link with (e.g., This attribute is discouraged; in general, targets should list system Default: [] |
ios_frameworkBuilds 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.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
codesign_inputs | list of labels | A list of dependencies targets that provide inputs that will be used by Default: [] |
codesignopts | list of strings | A list of strings representing extra flags that should be passed to Default: [] |
exported_symbols_lists | list of labels | A list of targets containing exported symbols lists files for the linker to control symbol Each file is expected to have a list of global symbol names that will remain as global symbols in See the man page documentation for Default: [] |
linkopts | list of strings | A list of strings representing extra flags that should be passed to the linker. Default: [] |
additional_linker_inputs | list of labels | A list of input files to be passed to the linker. Default: [] |
stamp | integer | Enable link stamping. Whether to encode build information into the binary. Possible values:
Default: -1 |
deps | list of labels | A list of dependent targets that will be linked into this target's binary(s). Any resources, such as Default: [] |
bundle_name | string | The desired name of the bundle (without the extension). If this attribute is not set, then the name Default: "" |
executable_name | string | The desired name of the executable, if the bundle has an executable. If this attribute is not set, Default: "" |
strings | list of labels | A list of Default: [] |
resources | list of labels | A list of resources or files bundled with the bundle. The resources will be stored in the Default: [] |
version | label | An Default: None |
*families | list of strings | A list of device families supported by this rule. At least one must be specified. |
*infoplists | list of labels | A list of .plist files that will be merged to form the Info.plist for this target. At least one file |
ipa_post_processor | label | A tool that edits this target's archive after it is assembled but before it is signed. The tool is Any changes made by the tool must be made in this directory, and the tool's execution must be Default: None |
*minimum_os_version | string | A required string indicating the minimum OS version supported by the target, represented as a |
minimum_deployment_os_version | string | A required string indicating the minimum deployment OS version supported by the target, represented Default: "" |
platform_type | string | Default: "ios" |
bundle_id | string | The bundle ID (reverse-DNS path followed by app name) for this target. Only use this attribute if Default: "" |
bundle_id_suffix | string | A string to act as the suffix of the composed bundle ID. If this target's bundle ID is composed from Default: "bundle_name" |
provisioning_profile | label | The provisioning profile ( Default: None |
base_bundle_id | label | The base bundle ID rule to dictate the form that a given bundle rule's bundle ID prefix should take. Default: None |
bundle_only | boolean | Avoid linking the dynamic framework, but still include it in the app. This is useful when you want Default: False |
frameworks | list of labels | A list of framework targets (see Default: [] |
extension_safe | boolean | If true, compiles and links this framework with Default: False |
hdrs | list of labels | Default: [] |
ios_imessage_applicationBuilds 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.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
app_icons | list of labels | Files that comprise the app icons for the application. Each file must have a containing directory Default: [] |
bundle_name | string | The desired name of the bundle (without the extension). If this attribute is not set, then the name Default: "" |
executable_name | string | The desired name of the executable, if the bundle has an executable. If this attribute is not set, Default: "" |
strings | list of labels | A list of Default: [] |
resources | list of labels | A list of resources or files bundled with the bundle. The resources will be stored in the Default: [] |
version | label | An Default: None |
*families | list of strings | A list of device families supported by this rule. At least one must be specified. |
*infoplists | list of labels | A list of .plist files that will be merged to form the Info.plist for this target. At least one file |
ipa_post_processor | label | A tool that edits this target's archive after it is assembled but before it is signed. The tool is Any changes made by the tool must be made in this directory, and the tool's execution must be Default: None |
locales_to_include | list 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. Default: [] |
*minimum_os_version | string | A required string indicating the minimum OS version supported by the target, represented as a |
minimum_deployment_os_version | string | A required string indicating the minimum deployment OS version supported by the target, represented Default: "" |
platform_type | string | Default: "ios" |
bundle_id | string | The bundle ID (reverse-DNS path followed by app name) for this target. Only use this attribute if Default: "" |
bundle_id_suffix | string | A string to act as the suffix of the composed bundle ID. If this target's bundle ID is composed from Default: "_" |
provisioning_profile | label | The provisioning profile ( Default: None |
entitlements | label | The entitlements file required for device builds of this target. If absent, the default entitlements The following variables are substituted in the entitlements file: Default: None |
entitlements_validation | string | An Default: "loose" |
shared_capabilities | list of labels | A list of shared Default: [] |
*extension | label | Single label referencing either an ios_imessage_extension or ios_sticker_pack_extension target. |
ios_sticker_pack_extensionBuilds and bundles an iOS Sticker Pack Extension.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
app_icons | list of labels | Files that comprise the app icons for the application. Each file must have a containing directory Default: [] |
bundle_name | string | The desired name of the bundle (without the extension). If this attribute is not set, then the name Default: "" |
executable_name | string | The desired name of the executable, if the bundle has an executable. If this attribute is not set, Default: "" |
strings | list of labels | A list of Default: [] |
resources | list of labels | A list of resources or files bundled with the bundle. The resources will be stored in the Default: [] |
version | label | An Default: None |
*families | list of strings | A list of device families supported by this rule. At least one must be specified. |
*infoplists | list of labels | A list of .plist files that will be merged to form the Info.plist for this target. At least one file |
ipa_post_processor | label | A tool that edits this target's archive after it is assembled but before it is signed. The tool is Any changes made by the tool must be made in this directory, and the tool's execution must be Default: None |
*minimum_os_version | string | A required string indicating the minimum OS version supported by the target, represented as a |
minimum_deployment_os_version | string | A required string indicating the minimum deployment OS version supported by the target, represented Default: "" |
platform_type | string | Default: "ios" |
bundle_id | string | The bundle ID (reverse-DNS path followed by app name) for this target. Only use this attribute if Default: "" |
bundle_id_suffix | string | A string to act as the suffix of the composed bundle ID. If this target's bundle ID is composed from Default: "bundle_name" |
provisioning_profile | label | The provisioning profile ( Default: None |
entitlements | label | The entitlements file required for device builds of this target. If absent, the default entitlements The following variables are substituted in the entitlements file: Default: None |
entitlements_validation | string | An Default: "loose" |
shared_capabilities | list of labels | A list of shared Default: [] |
sticker_assets | list of labels | List of sticker files to bundle. The collection of assets should be under a folder named Default: [] |
ios_imessage_extensionBuilds and bundles an iOS iMessage Extension.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
app_icons | list of labels | Files that comprise the app icons for the application. Each file must have a containing directory Default: [] |
codesign_inputs | list of labels | A list of dependencies targets that provide inputs that will be used by Default: [] |
codesignopts | list of strings | A list of strings representing extra flags that should be passed to Default: [] |
exported_symbols_lists | list of labels | A list of targets containing exported symbols lists files for the linker to control symbol Each file is expected to have a list of global symbol names that will remain as global symbols in See the man page documentation for Default: [] |
linkopts | list of strings | A list of strings representing extra flags that should be passed to the linker. Default: [] |
additional_linker_inputs | list of labels | A list of input files to be passed to the linker. Default: [] |
stamp | integer | Enable link stamping. Whether to encode build information into the binary. Possible values:
Default: -1 |
deps | list of labels | A list of dependent targets that will be linked into this target's binary(s). Any resources, such as Default: [] |
bundle_name | string | The desired name of the bundle (without the extension). If this attribute is not set, then the name Default: "" |
executable_name | string | The desired name of the executable, if the bundle has an executable. If this attribute is not set, Default: "" |
strings | list of labels | A list of Default: [] |
resources | list of labels | A list of resources or files bundled with the bundle. The resources will be stored in the Default: [] |
version | label | An Default: None |
*families | list of strings | A list of device families supported by this rule. At least one must be specified. |
*infoplists | list of labels | A list of .plist files that will be merged to form the Info.plist for this target. At least one file |
ipa_post_processor | label | A tool that edits this target's archive after it is assembled but before it is signed. The tool is Any changes made by the tool must be made in this directory, and the tool's execution must be Default: None |
locales_to_include | list 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. Default: [] |
*minimum_os_version | string | A required string indicating the minimum OS version supported by the target, represented as a |
minimum_deployment_os_version | string | A required string indicating the minimum deployment OS version supported by the target, represented Default: "" |
platform_type | string | Default: "ios" |
bundle_id | string | The bundle ID (reverse-DNS path followed by app name) for this target. Only use this attribute if Default: "" |
bundle_id_suffix | string | A string to act as the suffix of the composed bundle ID. If this target's bundle ID is composed from Default: "bundle_name" |
provisioning_profile | label | The provisioning profile ( Default: None |
entitlements | label | The entitlements file required for device builds of this target. If absent, the default entitlements The following variables are substituted in the entitlements file: Default: None |
entitlements_validation | string | An Default: "loose" |
shared_capabilities | list of labels | A list of shared Default: [] |
frameworks | list of labels | A list of framework targets (see Default: [] |
ios_kernel_extensionBuilds and bundles an iOS Kernel Extension.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
codesign_inputs | list of labels | A list of dependencies targets that provide inputs that will be used by Default: [] |
codesignopts | list of strings | A list of strings representing extra flags that should be passed to Default: [] |
exported_symbols_lists | list of labels | A list of targets containing exported symbols lists files for the linker to control symbol Each file is expected to have a list of global symbol names that will remain as global symbols in See the man page documentation for Default: [] |
linkopts | list of strings | A list of strings representing extra flags that should be passed to the linker. Default: [] |
additional_linker_inputs | list of labels | A list of input files to be passed to the linker. Default: [] |
stamp | integer | Enable link stamping. Whether to encode build information into the binary. Possible values:
Default: -1 |
deps | list of labels | A list of dependent targets that will be linked into this target's binary(s). Any resources, such as Default: [] |
bundle_name | string | The desired name of the bundle (without the extension). If this attribute is not set, then the name Default: "" |
executable_name | string | The desired name of the executable, if the bundle has an executable. If this attribute is not set, Default: "" |
strings | list of labels | A list of Default: [] |
resources | list of labels | A list of resources or files bundled with the bundle. The resources will be stored in the Default: [] |
version | label | An Default: None |
families | list of strings | A list of device families supported by this rule. At least one must be specified. Default: ["iphone", "ipad"] |
*infoplists | list of labels | A list of .plist files that will be merged to form the Info.plist for this target. At least one file |
ipa_post_processor | label | A tool that edits this target's archive after it is assembled but before it is signed. The tool is Any changes made by the tool must be made in this directory, and the tool's execution must be Default: None |
*minimum_os_version | string | A required string indicating the minimum OS version supported by the target, represented as a |
minimum_deployment_os_version | string | A required string indicating the minimum deployment OS version supported by the target, represented Default: "" |
platform_type | string | Default: "ios" |
bundle_id | string | The bundle ID (reverse-DNS path followed by app name) for this target. Only use this attribute if Default: "" |
bundle_id_suffix | string | A string to act as the suffix of the composed bundle ID. If this target's bundle ID is composed from Default: "_" |
provisioning_profile | label | The provisioning profile ( Default: None |
entitlements | label | The entitlements file required for device builds of this target. If absent, the default entitlements The following variables are substituted in the entitlements file: Default: None |
entitlements_validation | string | An Default: "loose" |
shared_capabilities | list of labels | A list of shared Default: [] |
ios_static_frameworkBuilds 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_frameworkwith Swift only works with Xcode 11 and above, since
the required Swift functionality for module compatibility is available in
Swift 5.1.ios_static_frameworkonly supports a single directswift_librarytarget
that does not depend transitively on any otherswift_librarytargets. The
Swift compiler expects a framework to contain a single Swift module, and each
swift_librarytarget is its own module by definition.ios_static_frameworkdoes not support mixed Objective-C and Swift public
interfaces. This means that theumbrella_headerandhdrsattributes are
unavailable when usingswift_librarydependencies. You are allowed to depend
onobjc_libraryfrom the mainswift_librarydependency, but note that only
theswift_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).
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
codesign_inputs | list of labels | A list of dependencies targets that provide inputs that will be used by Default: [] |
codesignopts | list of strings | A list of strings representing extra flags that should be passed to Default: [] |
exported_symbols_lists | list of labels | A list of targets containing exported symbols lists files for the linker to control symbol Each file is expected to have a list of global symbol names that will remain as global symbols in See the man page documentation for Default: [] |
linkopts | list of strings | A list of strings representing extra flags that should be passed to the linker. Default: [] |
additional_linker_inputs | list of labels | A list of input files to be passed to the linker. Default: [] |
stamp | integer | Enable link stamping. Whether to encode build information into the binary. Possible values:
Default: -1 |
deps | list of labels | A list of dependent targets that will be linked into this target's binary(s). Any resources, such as Default: [] |
bundle_name | string | The desired name of the bundle (without the extension). If this attribute is not set, then the name Default: "" |
executable_name | string | The desired name of the executable, if the bundle has an executable. If this attribute is not set, Default: "" |
strings | list of labels | A list of Default: [] |
resources | list of labels | A list of resources or files bundled with the bundle. The resources will be stored in the Default: [] |
version | label | An Default: None |
families | list of strings | A list of device families supported by this rule. At least one must be specified. Default: ["iphone", "ipad"] |
ipa_post_processor | label | A tool that edits this target's archive after it is assembled but before it is signed. The tool is Any changes made by the tool must be made in this directory, and the tool's execution must be Default: None |
*minimum_os_version | string | A required string indicating the minimum OS version supported by the target, represented as a |
minimum_deployment_os_version | string | A required string indicating the minimum deployment OS version supported by the target, represented Default: "" |
platform_type | string | Default: "ios" |
avoid_deps | list of labels | A list of library targets on which this framework depends in order to compile, but the transitive Default: [] |
exclude_resources | boolean | Indicates whether resources should be excluded from the bundle. This can be used to avoid Default: False |
hdrs | list of labels | A list of Default: [] |
umbrella_header | label | An optional single .h file to use as the umbrella header for this framework. Usually, this header Default: None |
ios_test_runnerRule 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.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
create_simulator_action | label | 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 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_type | string | The device type of the iOS simulator to run test. The supported types correspond Default: "" |
execution_requirements | dictionary: String → String | Dictionary of strings to strings which specifies the execution requirements for Default: {"requires-darwin": ""} |
os_version | string | The os version of the iOS simulator to run test. The supported os versions Default: "" |
post_action | label | A binary to run following test execution. Runs after testing but before test result handling and coverage processing. Sets the Default: None |
post_action_determines_exit_code | boolean | When true, the exit code of the test run will be set to the exit code of the Default: False |
pre_action | label | A binary to run prior to test execution. Runs after simulator creation. Sets any environment variables available to the test runner. Default: None |
test_environment | dictionary: String → String | Optional dictionary with the environment variables that are to be propagated Default: {} |
ios_xctestrun_runnerThis 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.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
attachment_lifetime | string | Attachment lifetime to set in the xctestrun file when running the test bundle - Default: "keepNever" |
clean_up_simulator_action | label | A binary that cleans up any simulators created by the 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_args | list of strings | CommandLineArguments to pass to xctestrun file when running the test bundle. This means it Default: [] |
create_simulator_action | label | A binary that produces a UDID for a simulator that matches the given device type and OS version. Runs before the 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_bundle | boolean | Force the test runner to always create an XCResult bundle. This means it will Default: False |
destination_timeout | integer | Use the specified timeout when searching for a destination device. The default is 30 seconds. Default: 0 |
device_type | string | The device type of the iOS simulator to run test. The supported types correspond Default: "" |
os_version | string | The os version of the iOS simulator to run test. The supported os versions Default: "" |
post_action | label | A binary to run following test execution. Runs after testing but before test result handling and coverage processing. Sets the Default: None |
post_action_determines_exit_code | boolean | When true, the exit code of the test run will be set to the exit code of the Default: False |
pre_action | label | A binary to run prior to test execution. Runs after simulator creation. Sets the Default: None |
random | boolean | Whether to run the tests in random order to identify unintended state Default: False |
reuse_simulator | boolean | 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_args | list of strings | Arguments to pass to Default: [] |
ios_build_testTest 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", ], )
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
*minimum_os_version | string | A required string indicating the minimum OS version that will be used as the |
targets | list of labels | The targets to check for successful build. Default: [] |
platform_type | string | Default: "ios" |
@rules_apple@rules_apple//apple:linker.bzl
Rules related to Apple linker.
Rules
apple_order_fileInjects 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.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
*deps | list of labels | The raw text order files to be used in the iOS application. |
stats | boolean | 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_pluginBuilds and bundles a macOS Quick Look Plugin.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
codesign_inputs | list of labels | A list of dependencies targets that provide inputs that will be used by Default: [] |
codesignopts | list of strings | A list of strings representing extra flags that should be passed to Default: [] |
exported_symbols_lists | list of labels | A list of targets containing exported symbols lists files for the linker to control symbol Each file is expected to have a list of global symbol names that will remain as global symbols in See the man page documentation for Default: [] |
linkopts | list of strings | A list of strings representing extra flags that should be passed to the linker. Default: [] |
additional_linker_inputs | list of labels | A list of input files to be passed to the linker. Default: [] |
stamp | integer | Enable link stamping. Whether to encode build information into the binary. Possible values:
Default: -1 |
deps | list of labels | A list of dependent targets that will be linked into this target's binary(s). Any resources, such as Default: [] |
bundle_name | string | The desired name of the bundle (without the extension). If this attribute is not set, then the name Default: "" |
executable_name | string | The desired name of the executable, if the bundle has an executable. If this attribute is not set, Default: "" |
strings | list of labels | A list of Default: [] |
resources | list of labels | A list of resources or files bundled with the bundle. The resources will be stored in the Default: [] |
version | label | An Default: None |
families | list of strings | A list of device families supported by this rule. At least one must be specified. Default: ["mac"] |
*infoplists | list of labels | A list of .plist files that will be merged to form the Info.plist for this target. At least one file |
ipa_post_processor | label | A tool that edits this target's archive after it is assembled but before it is signed. The tool is Any changes made by the tool must be made in this directory, and the tool's execution must be Default: None |
*minimum_os_version | string | A required string indicating the minimum OS version supported by the target, represented as a |
minimum_deployment_os_version | string | A required string indicating the minimum deployment OS version supported by the target, represented Default: "" |
platform_type | string | Default: "macos" |
bundle_id | string | The bundle ID (reverse-DNS path followed by app name) for this target. Only use this attribute if Default: "" |
bundle_id_suffix | string | A string to act as the suffix of the composed bundle ID. If this target's bundle ID is composed from Default: "_" |
provisioning_profile | label | The provisioning profile ( Default: None |
entitlements | label | The entitlements file required for device builds of this target. If absent, the default entitlements The following variables are substituted in the entitlements file: Default: None |
entitlements_validation | string | An Default: "loose" |
shared_capabilities | list of labels | A list of shared Default: [] |
additional_contents | dictionary: Label → String | Files that should be copied into specific subdirectories of the Contents folder in the bundle. The The relative directory structure of filegroup contents is preserved when they are copied into the Default: {} |
macos_spotlight_importerBuilds and bundles a macOS Spotlight Importer.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
codesign_inputs | list of labels | A list of dependencies targets that provide inputs that will be used by Default: [] |
codesignopts | list of strings | A list of strings representing extra flags that should be passed to Default: [] |
exported_symbols_lists | list of labels | A list of targets containing exported symbols lists files for the linker to control symbol Each file is expected to have a list of global symbol names that will remain as global symbols in See the man page documentation for Default: [] |
linkopts | list of strings | A list of strings representing extra flags that should be passed to the linker. Default: [] |
additional_linker_inputs | list of labels | A list of input files to be passed to the linker. Default: [] |
stamp | integer | Enable link stamping. Whether to encode build information into the binary. Possible values:
Default: -1 |
deps | list of labels | A list of dependent targets that will be linked into this target's binary(s). Any resources, such as Default: [] |
bundle_name | string | The desired name of the bundle (without the extension). If this attribute is not set, then the name Default: "" |
executable_name | string | The desired name of the executable, if the bundle has an executable. If this attribute is not set, Default: "" |
strings | list of labels | A list of Default: [] |
resources | list of labels | A list of resources or files bundled with the bundle. The resources will be stored in the Default: [] |
version | label | An Default: None |
families | list of strings | A list of device families supported by this rule. At least one must be specified. Default: ["mac"] |
*infoplists | list of labels | A list of .plist files that will be merged to form the Info.plist for this target. At least one file |
ipa_post_processor | label | A tool that edits this target's archive after it is assembled but before it is signed. The tool is Any changes made by the tool must be made in this directory, and the tool's execution must be Default: None |
*minimum_os_version | string | A required string indicating the minimum OS version supported by the target, represented as a |
minimum_deployment_os_version | string | A required string indicating the minimum deployment OS version supported by the target, represented Default: "" |
platform_type | string | Default: "macos" |
bundle_id | string | The bundle ID (reverse-DNS path followed by app name) for this target. Only use this attribute if Default: "" |
bundle_id_suffix | string | A string to act as the suffix of the composed bundle ID. If this target's bundle ID is composed from Default: "_" |
provisioning_profile | label | The provisioning profile ( Default: None |
entitlements | label | The entitlements file required for device builds of this target. If absent, the default entitlements The following variables are substituted in the entitlements file: Default: None |
entitlements_validation | string | An Default: "loose" |
shared_capabilities | list of labels | A list of shared Default: [] |
additional_contents | dictionary: Label → String | Files that should be copied into specific subdirectories of the Contents folder in the bundle. The The relative directory structure of filegroup contents is preserved when they are copied into the Default: {} |
macos_xpc_serviceBuilds and bundles a macOS XPC Service.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
codesign_inputs | list of labels | A list of dependencies targets that provide inputs that will be used by Default: [] |
codesignopts | list of strings | A list of strings representing extra flags that should be passed to Default: [] |
exported_symbols_lists | list of labels | A list of targets containing exported symbols lists files for the linker to control symbol Each file is expected to have a list of global symbol names that will remain as global symbols in See the man page documentation for Default: [] |
linkopts | list of strings | A list of strings representing extra flags that should be passed to the linker. Default: [] |
additional_linker_inputs | list of labels | A list of input files to be passed to the linker. Default: [] |
stamp | integer | Enable link stamping. Whether to encode build information into the binary. Possible values:
Default: -1 |
deps | list of labels | A list of dependent targets that will be linked into this target's binary(s). Any resources, such as Default: [] |
bundle_name | string | The desired name of the bundle (without the extension). If this attribute is not set, then the name Default: "" |
executable_name | string | The desired name of the executable, if the bundle has an executable. If this attribute is not set, Default: "" |
strings | list of labels | A list of Default: [] |
resources | list of labels | A list of resources or files bundled with the bundle. The resources will be stored in the Default: [] |
version | label | An Default: None |
ipa_post_processor | label | A tool that edits this target's archive after it is assembled but before it is signed. The tool is Any changes made by the tool must be made in this directory, and the tool's execution must be Default: None |
families | list of strings | A list of device families supported by this rule. At least one must be specified. Default: ["mac"] |
*infoplists | list of labels | A list of .plist files that will be merged to form the Info.plist for this target. At least one file |
*minimum_os_version | string | A required string indicating the minimum OS version supported by the target, represented as a |
minimum_deployment_os_version | string | A required string indicating the minimum deployment OS version supported by the target, represented Default: "" |
platform_type | string | Default: "macos" |
bundle_id | string | The bundle ID (reverse-DNS path followed by app name) for this target. Only use this attribute if Default: "" |
bundle_id_suffix | string | A string to act as the suffix of the composed bundle ID. If this target's bundle ID is composed from Default: "_" |
provisioning_profile | label | The provisioning profile ( Default: None |
entitlements | label | The entitlements file required for device builds of this target. If absent, the default entitlements The following variables are substituted in the entitlements file: Default: None |
entitlements_validation | string | An Default: "loose" |
shared_capabilities | list of labels | A list of shared Default: [] |
additional_contents | dictionary: Label → String | Files that should be copied into specific subdirectories of the Contents folder in the bundle. The The relative directory structure of filegroup contents is preserved when they are copied into the Default: {} |
macos_build_testTest 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", ], )
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
*minimum_os_version | string | A required string indicating the minimum OS version that will be used as the |
targets | list of labels | The targets to check for successful build. Default: [] |
platform_type | string | 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_infoCreates a new instance of the AppleBundleVersionInfo provider.
Parameters
*version_file | Required. See the docs on |
apple_provider.make_apple_test_runner_infoCreates a new instance of the AppleTestRunnerInfo provider.
Parameters
kwargs | A set of keyword arguments expected to match the fields of |
apple_provider.merge_apple_framework_import_infoMerges multiple AppleFrameworkImportInfo into one.
Parameters
*apple_framework_import_infos | List of |
Providers
AppleBaseBundleIdInfoProvides the base bundle ID prefix for an Apple rule.
Fields
base_bundle_id |
|
AppleBundleInfoThis 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 |
|
archive_root |
|
binary |
|
bundle_extension |
|
bundle_id |
|
bundle_name |
|
entitlements |
|
executable_name |
|
extension_safe |
|
infoplist |
|
minimum_deployment_os_version |
|
minimum_os_version |
|
platform_type |
|
product_type |
|
uses_swift | Boolean. True if Swift is used by the target propagating this |
AppleBinaryInfoProvides 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 |
|
infoplist |
|
product_type |
|
AppleBundleVersionInfoProvides versioning information for an Apple bundle.
Fields
version_file | Required. A It contains two keys:
|
AppleCodesigningDossierInfoProvides information around the use of a code signing dossier.
Fields
dossier | A |
AppleDebugOutputsInfoHolds 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 |
AppleDsymBundleInfoProvides information for an Apple dSYM bundle.
Fields
direct_dsyms |
|
transitive_dsyms |
|
AppleDynamicFrameworkInfoContains information about an Apple dynamic framework.
Fields
framework_dirs | The framework path names used as link inputs in order to link against the |
framework_files | The full set of artifacts that should be included as inputs to link against the |
binary | The dylib binary artifact of the dynamic framework. |
cc_info | A |
AppleExecutableBinaryInfoContains 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 |
cc_info | A |
AppleExtraOutputsInfoProvides 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 |
|
AppleFrameworkBundleInfoDenotes 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.
AppleFrameworkImportInfoProvider 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 |
|
dsym_imports | Depset of Files that represent dSYM imports that need to be processed to |
build_archs |
|
debug_info_binaries | Depset of Files that represent framework binaries and dSYM binaries that |
ApplePlatformInfoProvides information for the currently selected Apple platforms.
Fields
target_arch |
|
target_build_config | 'configuration' representing the selected target's build configuration. |
target_environment |
|
target_os |
|
AppleResourceBundleInfoDenotes 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.
AppleResourceInfoProvider 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 |
infoplists | Plist files to be merged and processed. Plist files that should not be merged into the root Info.plist should be propagated in |
metals | Metal Shading Language source files to be compiled into a single .metallib file |
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 |
|
processed_origins |
|
unowned_resources |
|
AppleStaticXcframeworkBundleInfoDenotes 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.
AppleTestInfoProvider 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. |
AppleTestRunnerInfoProvider 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 |
test_environment | Optional dictionary with the environment variables that are to be propagated into the XCTest |
test_runner_template | Required template file that contains the specific mechanism with which the tests will be run. The |
AppleXcframeworkBundleInfoDenotes 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.
IosAppClipBundleInfoDenotes 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.
IosApplicationBundleInfoDenotes 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.
IosExtensionBundleInfoDenotes 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.
IosFrameworkBundleInfoDenotes 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.
IosImessageApplicationBundleInfoDenotes 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.
IosImessageExtensionBundleInfoDenotes 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.
IosKernelExtensionBundleInfoDenotes 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.
IosStaticFrameworkBundleInfoDenotes 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.
IosXcTestBundleInfoDenotes 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.
MacosApplicationBundleInfoDenotes 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.
MacosBundleBundleInfoDenotes 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.
MacosExtensionBundleInfoDenotes 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.
MacosKernelExtensionBundleInfoDenotes 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.
MacosQuickLookPluginBundleInfoDenotes 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.
MacosSpotlightImporterBundleInfoDenotes 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.
MacosXPCServiceBundleInfoDenotes 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.
MacosXcTestBundleInfoDenotes 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.
TvosApplicationBundleInfoDenotes 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.
TvosExtensionBundleInfoDenotes 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.
TvosFrameworkBundleInfoDenotes 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.
TvosStaticFrameworkBundleInfoDenotes 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.
TvosXcTestBundleInfoDenotes 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.
VisionosApplicationBundleInfoDenotes 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.
VisionosFrameworkBundleInfoDenotes 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.
VisionosExtensionBundleInfoDenotes 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.
VisionosXcTestBundleInfoDenotes 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.
WatchosApplicationBundleInfoDenotes 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.
WatchosExtensionBundleInfoDenotes 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.
WatchosXcTestBundleInfoDenotes 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.
AppleBinaryInfoplistInfoProvides information about the Info.plist that was linked into an Apple binary
target.
Fields
infoplist |
|
AppleDeviceTestRunnerInfoProvider that device-based runner targets must propagate.
Fields
device_type | The device type of the iOS simulator to run test. The supported types correspond |
os_version | The os version of the iOS simulator to run test. The supported os versions |
AppleProvisioningProfileInfoProvides information about a provisioning profile.
Fields
provisioning_profile |
|
profile_name | string. The profile name (e.g. "iOS Team Provisioning Profile: com.example.app"). |
team_id |
|
IosStickerPackExtensionBundleInfoDenotes 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.
WatchosFrameworkBundleInfoDenotes 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.
WatchosStaticFrameworkBundleInfoDenotes 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.
MacosFrameworkBundleInfoDenotes 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.
MacosStaticFrameworkBundleInfoDenotes 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.
DocCBundleInfoProvides general information about a .docc bundle.
Fields
bundle | the path to the .docc bundle |
bundle_files | the file targets contained within the .docc bundle |
DocCSymbolGraphsInfoProvides 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.bucketizeSeparates 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 Default: None |
owner | An optional string that has a unique identifier to the target that should own the Default: None |
parent_dir_param | Either a string/None or a struct used to calculate the value of Default: None |
*resources | List of resources to bucketize. |
swift_module | The Swift module name to associate to these resources. Default: None |
resources_common.bucketize_dataSeparates 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 Default: None |
owner | An optional string that has a unique identifier to the target that should own the Default: None |
parent_dir_param | Either a string/None or a struct used to calculate the value of Default: None |
*resources | List of resources to bucketize. |
swift_module | The Swift module name to associate to these resources. Default: None |
resources_common.bucketize_typedCollects 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 |
*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 Default: None |
parent_dir_param | Either a string/None or a struct used to calculate the value of Default: None |
resources_common.bucketize_typed_dataCollects 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 Default: None |
parent_dir_param | Either a string/None or a struct used to calculate the value of Default: None |
*resources | List of resources to place in bucket_type or Dictionary of resources keyed by |
resources_common.bundle_relative_parent_dirReturns 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.collectCollects 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 |
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.deduplicateParameters
*resources_provider | |
*avoid_providers | |
*field_handler | |
default_owner | Default: None |
resources_common.merge_providersMerges multiple AppleResourceInfo providers into one.
Parameters
default_owner | The default owner to be used for resources which have a None value in the Default: None |
*providers | The list of providers to merge. This method will fail unless there is at least 1 |
validate_all_resources_owned | Whether to validate that all resources are owned. This is Default: False |
resources_common.minimizeMinimizes 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_bundleNests 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_fieldsReturns a list of field names of the provider's resource buckets that are non empty.
Parameters
*provider |
resources_common.process_bucketized_dataRegisters 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 |
*apple_mac_toolchain_info |
|
bucketized_owners | A list of tuples indicating the owner of each Default: [] |
*buckets | A dictionary with bucketized resources organized by resource |
*bundle_id | The bundle ID to configure for this target. |
output_discriminator | A string to differentiate between different target Default: None |
*platform_prerequisites | Struct containing information on the platform |
processing_owner | An optional string that has a unique identifier to the Default: None |
*product_type | The product type identifier used to describe the current |
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_dirReturns the parent directory of the file.
Parameters
*resource | The resource for which to calculate the package relative path. |
resources_common.structured_resources_parent_dirReturns 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 Default: [] |
apple_core_ml_libraryMacro to orchestrate an objc_library with generated sources for mlmodel files.
Parameters
*name | |
*mlmodel | |
kwargs |
swift_apple_core_ml_libraryMacro to orchestrate a swift_library with generated sources for mlmodel files.
Parameters
*name | |
*mlmodel | |
kwargs |
objc_intent_libraryMacro to orchestrate an objc_library with generated sources for intentdefiniton files.
Parameters
*name | |
*src | |
class_prefix | Default: None |
testonly | Default: False |
kwargs |
swift_intent_libraryThis 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 |
class_prefix | Class prefix to use for the generated classes. Default: None |
class_visibility | Visibility attribute for the generated classes ( 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_importThis 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.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
*bundle_imports | list of labels | The list of files under a |
apple_intent_libraryThis 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".
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
*src | label | Label to a single |
*language | string | Language of generated classes ("Objective-C", "Swift") |
class_prefix | string | Class prefix to use for the generated classes. Default: "" |
swift_version | string | Version of Swift to use for the generated classes. Default: "" |
class_visibility | string | Visibility attribute for the generated classes ("public", "private", "project"). Default: "" |
header_name | string | Name of the public header file (only when using Objective-C). Default: "" |
apple_metal_libraryCompiles Metal shader language sources into a Metal library.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
copts | list of strings | A list of compiler options passed to the Default: [] |
hdrs | list of labels | A list of headers to make importable when compiling the metal library. Default: [] |
out | string | An output Default: "default.metallib" |
*srcs | list of labels | A list of |
apple_precompiled_resource_bundleThis 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.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
bundle_id | string | The bundle ID for this target. It will replace Default: "" |
bundle_name | string | The desired name of the bundle (without the Default: "" |
infoplists | list of labels | A list of Duplicate keys between infoplist files ${BUNDLE_NAME}: This target's name and bundle suffix (.bundle or .app) in the form name.suffix. Default: [] |
resources | list of labels | Files to include in the resource bundle. Files that are processable resources, like .xib, You can also add other Default: [] |
strip_structured_resources_prefixes | list of strings | A list of prefixes to strip from the paths of structured resources. For each For example, if Default: [] |
structured_resources | list of labels | Files to include in the final resource bundle. They are not processed or compiled in any way Default: [] |
apple_resource_bundleThis 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.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
bundle_id | string | The bundle ID for this target. It will replace Default: "" |
bundle_name | string | The desired name of the bundle (without the Default: "" |
infoplists | list of labels | A list of Duplicate keys between infoplist files ${BUNDLE_NAME}: This target's name and bundle suffix (.bundle or .app) in the form name.suffix. Default: [] |
resources | list of labels | Files to include in the resource bundle. Files that are processable resources, like .xib, You can also add other Default: [] |
strip_structured_resources_prefixes | list of strings | A list of prefixes to strip from the paths of structured resources. For each For example, if Default: [] |
structured_resources | list of labels | Files to include in the final resource bundle. They are not processed or compiled in any way Default: [] |
apple_resource_groupThis 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.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
resources | list of labels | Files to include in the final bundle that depends on this target. Files that are processable You can also add apple_resource_bundle and apple_bundle_import targets into Default: [] |
strip_structured_resources_prefixes | list of strings | A list of prefixes to strip from the paths of structured resources. For each For example, if Default: [] |
structured_resources | list of labels | Files to include in the final application bundle. They are not processed or compiled in any way Default: [] |
apple_core_data_modelThis 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.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
*srcs | list of labels | |
swift_version | string | Target Swift version for generated classes. Default: "" |
outs | dictionary: String → List of strings | A dictionary where the key is the name of a data model and the value is a
If one or more files are provided for a data model, the rule will return these Default: {} |
@rules_apple@rules_apple//apple:tvos.bzl
Bazel rules for creating tvOS applications and bundles.
Rules
tvos_applicationBuilds and bundles a tvOS Application.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
app_icons | list of labels | Files that comprise the app icons for the application. Each file must have a containing directory Default: [] |
primary_app_icon | string | An optional String to identify the name of the primary app icon when alternate app icons have been Default: "" |
app_intents | list of labels | List of dependencies implementing the AppIntents protocol. Default: [] |
codesign_inputs | list of labels | A list of dependencies targets that provide inputs that will be used by Default: [] |
codesignopts | list of strings | A list of strings representing extra flags that should be passed to Default: [] |
exported_symbols_lists | list of labels | A list of targets containing exported symbols lists files for the linker to control symbol Each file is expected to have a list of global symbol names that will remain as global symbols in See the man page documentation for Default: [] |
linkopts | list of strings | A list of strings representing extra flags that should be passed to the linker. Default: [] |
additional_linker_inputs | list of labels | A list of input files to be passed to the linker. Default: [] |
stamp | integer | Enable link stamping. Whether to encode build information into the binary. Possible values:
Default: -1 |
deps | list of labels | A list of dependent targets that will be linked into this target's binary(s). Any resources, such as Default: [] |
bundle_name | string | The desired name of the bundle (without the extension). If this attribute is not set, then the name Default: "" |
executable_name | string | The desired name of the executable, if the bundle has an executable. If this attribute is not set, Default: "" |
strings | list of labels | A list of Default: [] |
resources | list of labels | A list of resources or files bundled with the bundle. The resources will be stored in the Default: [] |
version | label | An Default: None |
families | list of strings | A list of device families supported by this rule. At least one must be specified. Default: ["tv"] |
infoplists | list of labels | A list of .plist files that will be merged to form the Info.plist for this target. If not provided, Default: ["@rules_apple//apple/internal/templates:default_application_infoplist"] |
ipa_post_processor | label | A tool that edits this target's archive after it is assembled but before it is signed. The tool is Any changes made by the tool must be made in this directory, and the tool's execution must be Default: None |
locales_to_include | list 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. Default: [] |
launch_images | list of labels | Files that comprise the launch images for the application. Each file must have a containing Default: [] |
*minimum_os_version | string | A required string indicating the minimum OS version supported by the target, represented as a |
minimum_deployment_os_version | string | A required string indicating the minimum deployment OS version supported by the target, represented Default: "" |
platform_type | string | Default: "tvos" |
settings_bundle | label | A resource bundle (e.g. Default: None |
bundle_id | string | The bundle ID (reverse-DNS path followed by app name) for this target. Only use this attribute if Default: "" |
bundle_id_suffix | string | A string to act as the suffix of the composed bundle ID. If this target's bundle ID is composed from Default: "_" |
provisioning_profile | label | The provisioning profile ( Default: None |
entitlements | label | The entitlements file required for device builds of this target. If absent, the default entitlements The following variables are substituted in the entitlements file: Default: None |
entitlements_validation | string | An Default: "loose" |
shared_capabilities | list of labels | A list of shared Default: [] |
frameworks | list of labels | A list of framework targets (see Default: [] |
extensions | list of labels | A list of tvOS extensions to include in the final application bundle. Default: [] |
launch_storyboard | label | The Default: None |
tvos_dynamic_frameworkBuilds and bundles a tvOS dynamic framework that is consumable by Xcode.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
codesign_inputs | list of labels | A list of dependencies targets that provide inputs that will be used by Default: [] |
codesignopts | list of strings | A list of strings representing extra flags that should be passed to Default: [] |
exported_symbols_lists | list of labels | A list of targets containing exported symbols lists files for the linker to control symbol Each file is expected to have a list of global symbol names that will remain as global symbols in See the man page documentation for Default: [] |
linkopts | list of strings | A list of strings representing extra flags that should be passed to the linker. Default: [] |
additional_linker_inputs | list of labels | A list of input files to be passed to the linker. Default: [] |
stamp | integer | Enable link stamping. Whether to encode build information into the binary. Possible values:
Default: -1 |
deps | list of labels | A list of dependent targets that will be linked into this target's binary(s). Any resources, such as Default: [] |
bundle_name | string | The desired name of the bundle (without the extension). If this attribute is not set, then the name Default: "" |
executable_name | string | The desired name of the executable, if the bundle has an executable. If this attribute is not set, Default: "" |
strings | list of labels | A list of Default: [] |
resources | list of labels | A list of resources or files bundled with the bundle. The resources will be stored in the Default: [] |
version | label | An Default: None |
families | list of strings | A list of device families supported by this rule. At least one must be specified. Default: ["tv"] |
*infoplists | list of labels | A list of .plist files that will be merged to form the Info.plist for this target. At least one file |
ipa_post_processor | label | A tool that edits this target's archive after it is assembled but before it is signed. The tool is Any changes made by the tool must be made in this directory, and the tool's execution must be Default: None |
*minimum_os_version | string | A required string indicating the minimum OS version supported by the target, represented as a |
minimum_deployment_os_version | string | A required string indicating the minimum deployment OS version supported by the target, represented Default: "" |
platform_type | string | Default: "tvos" |
bundle_id | string | The bundle ID (reverse-DNS path followed by app name) for this target. Only use this attribute if Default: "" |
bundle_id_suffix | string | A string to act as the suffix of the composed bundle ID. If this target's bundle ID is composed from Default: "bundle_name" |
provisioning_profile | label | The provisioning profile ( Default: None |
base_bundle_id | label | The base bundle ID rule to dictate the form that a given bundle rule's bundle ID prefix should take. Default: None |
bundle_only | boolean | Avoid linking the dynamic framework, but still include it in the app. This is useful when you want Default: False |
extension_safe | boolean | If true, compiles and links this framework with Default: False |
frameworks | list of labels | A list of framework targets (see Default: [] |
hdrs | list of labels | Default: [] |
tvos_extensionBuilds and bundles a tvOS Extension.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
codesign_inputs | list of labels | A list of dependencies targets that provide inputs that will be used by Default: [] |
codesignopts | list of strings | A list of strings representing extra flags that should be passed to Default: [] |
exported_symbols_lists | list of labels | A list of targets containing exported symbols lists files for the linker to control symbol Each file is expected to have a list of global symbol names that will remain as global symbols in See the man page documentation for Default: [] |
linkopts | list of strings | A list of strings representing extra flags that should be passed to the linker. Default: [] |
additional_linker_inputs | list of labels | A list of input files to be passed to the linker. Default: [] |
stamp | integer | Enable link stamping. Whether to encode build information into the binary. Possible values:
Default: -1 |
deps | list of labels | A list of dependent targets that will be linked into this target's binary(s). Any resources, such as Default: [] |
bundle_name | string | The desired name of the bundle (without the extension). If this attribute is not set, then the name Default: "" |
executable_name | string | The desired name of the executable, if the bundle has an executable. If this attribute is not set, Default: "" |
strings | list of labels | A list of Default: [] |
resources | list of labels | A list of resources or files bundled with the bundle. The resources will be stored in the Default: [] |
version | label | An Default: None |
families | list of strings | A list of device families supported by this rule. At least one must be specified. Default: ["tv"] |
extensionkit_extension | boolean | Indicates if this target should be treated as an ExtensionKit extension. Default: False |
*infoplists | list of labels | A list of .plist files that will be merged to form the Info.plist for this target. At least one file |
ipa_post_processor | label | A tool that edits this target's archive after it is assembled but before it is signed. The tool is Any changes made by the tool must be made in this directory, and the tool's execution must be Default: None |
locales_to_include | list 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. Default: [] |
*minimum_os_version | string | A required string indicating the minimum OS version supported by the target, represented as a |
minimum_deployment_os_version | string | A required string indicating the minimum deployment OS version supported by the target, represented Default: "" |
platform_type | string | Default: "tvos" |
bundle_id | string | The bundle ID (reverse-DNS path followed by app name) for this target. Only use this attribute if Default: "" |
bundle_id_suffix | string | A string to act as the suffix of the composed bundle ID. If this target's bundle ID is composed from Default: "bundle_name" |
provisioning_profile | label | The provisioning profile ( Default: None |
entitlements | label | The entitlements file required for device builds of this target. If absent, the default entitlements The following variables are substituted in the entitlements file: Default: None |
entitlements_validation | string | An Default: "loose" |
shared_capabilities | list of labels | A list of shared Default: [] |
frameworks | list of labels | A list of framework targets (see Default: [] |
legacy_entry_point | boolean | If Default: False |
tvos_frameworkBuilds 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.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
codesign_inputs | list of labels | A list of dependencies targets that provide inputs that will be used by Default: [] |
codesignopts | list of strings | A list of strings representing extra flags that should be passed to Default: [] |
exported_symbols_lists | list of labels | A list of targets containing exported symbols lists files for the linker to control symbol Each file is expected to have a list of global symbol names that will remain as global symbols in See the man page documentation for Default: [] |
linkopts | list of strings | A list of strings representing extra flags that should be passed to the linker. Default: [] |
additional_linker_inputs | list of labels | A list of input files to be passed to the linker. Default: [] |
stamp | integer | Enable link stamping. Whether to encode build information into the binary. Possible values:
Default: -1 |
deps | list of labels | A list of dependent targets that will be linked into this target's binary(s). Any resources, such as Default: [] |
bundle_name | string | The desired name of the bundle (without the extension). If this attribute is not set, then the name Default: "" |
executable_name | string | The desired name of the executable, if the bundle has an executable. If this attribute is not set, Default: "" |
strings | list of labels | A list of Default: [] |
resources | list of labels | A list of resources or files bundled with the bundle. The resources will be stored in the Default: [] |
version | label | An Default: None |
families | list of strings | A list of device families supported by this rule. At least one must be specified. Default: ["tv"] |
*infoplists | list of labels | A list of .plist files that will be merged to form the Info.plist for this target. At least one file |
ipa_post_processor | label | A tool that edits this target's archive after it is assembled but before it is signed. The tool is Any changes made by the tool must be made in this directory, and the tool's execution must be Default: None |
*minimum_os_version | string | A required string indicating the minimum OS version supported by the target, represented as a |
minimum_deployment_os_version | string | A required string indicating the minimum deployment OS version supported by the target, represented Default: "" |
platform_type | string | Default: "tvos" |
bundle_id | string | The bundle ID (reverse-DNS path followed by app name) for this target. Only use this attribute if Default: "" |
bundle_id_suffix | string | A string to act as the suffix of the composed bundle ID. If this target's bundle ID is composed from Default: "bundle_name" |
provisioning_profile | label | The provisioning profile ( Default: None |
base_bundle_id | label | The base bundle ID rule to dictate the form that a given bundle rule's bundle ID prefix should take. Default: None |
bundle_only | boolean | Avoid linking the dynamic framework, but still include it in the app. This is useful when you want Default: False |
extension_safe | boolean | If true, compiles and links this framework with Default: False |
frameworks | list of labels | A list of framework targets (see Default: [] |
hdrs | list of labels | Default: [] |
tvos_static_frameworkBuilds 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_frameworkwith Swift only works with Xcode 11 and above, since
the required Swift functionality for module compatibility is available in
Swift 5.1.tvos_static_frameworkonly supports a single directswift_librarytarget
that does not depend transitively on any otherswift_librarytargets. The
Swift compiler expects a framework to contain a single Swift module, and each
swift_librarytarget is its own module by definition.tvos_static_frameworkdoes not support mixed Objective-C and Swift public
interfaces. This means that theumbrella_headerandhdrsattributes are
unavailable when usingswift_librarydependencies. You are allowed to depend
onobjc_libraryfrom the mainswift_librarydependency, but note that only
theswift_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).
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
codesign_inputs | list of labels | A list of dependencies targets that provide inputs that will be used by Default: [] |
codesignopts | list of strings | A list of strings representing extra flags that should be passed to Default: [] |
exported_symbols_lists | list of labels | A list of targets containing exported symbols lists files for the linker to control symbol Each file is expected to have a list of global symbol names that will remain as global symbols in See the man page documentation for Default: [] |
linkopts | list of strings | A list of strings representing extra flags that should be passed to the linker. Default: [] |
additional_linker_inputs | list of labels | A list of input files to be passed to the linker. Default: [] |
stamp | integer | Enable link stamping. Whether to encode build information into the binary. Possible values:
Default: -1 |
deps | list of labels | A list of dependent targets that will be linked into this target's binary(s). Any resources, such as Default: [] |
bundle_name | string | The desired name of the bundle (without the extension). If this attribute is not set, then the name Default: "" |
executable_name | string | The desired name of the executable, if the bundle has an executable. If this attribute is not set, Default: "" |
strings | list of labels | A list of Default: [] |
resources | list of labels | A list of resources or files bundled with the bundle. The resources will be stored in the Default: [] |
version | label | An Default: None |
families | list of strings | A list of device families supported by this rule. At least one must be specified. Default: ["tv"] |
ipa_post_processor | label | A tool that edits this target's archive after it is assembled but before it is signed. The tool is Any changes made by the tool must be made in this directory, and the tool's execution must be Default: None |
*minimum_os_version | string | A required string indicating the minimum OS version supported by the target, represented as a |
minimum_deployment_os_version | string | A required string indicating the minimum deployment OS version supported by the target, represented Default: "" |
platform_type | string | Default: "tvos" |
avoid_deps | list of labels | A list of library targets on which this framework depends in order to compile, but the transitive Default: [] |
exclude_resources | boolean | Indicates whether resources should be excluded from the bundle. This can be used to avoid Default: False |
hdrs | list of labels | A list of Default: [] |
umbrella_header | label | An optional single .h file to use as the umbrella header for this framework. Usually, this header Default: None |
tvos_build_testTest 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", ], )
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
*minimum_os_version | string | A required string indicating the minimum OS version that will be used as the |
targets | list of labels | The targets to check for successful build. Default: [] |
platform_type | string | Default: "tvos" |
@rules_apple@rules_apple//apple:versioning.bzl
Rules related to Apple bundle versioning.
Rules
apple_bundle_versionProduces 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.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
build_label_pattern | string | A pattern that should contain placeholders inside curly braces (e.g., Default: "" |
*build_version | string | A string that will be used as the value for the |
capture_groups | dictionary: String → String | A dictionary where each key is the name of a placeholder found in Default: {} |
fallback_build_label | string | A build label to use when the no Default: "" |
short_version_string | string | A string that will be used as the value for the Default: "" |
@rules_apple@rules_apple//apple:visionos.bzl
Bazel rules for creating visionOS applications and bundles.
Rules
visionos_applicationBuilds and bundles a visionOS Application.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
app_icons | list of labels | Files that comprise the app icons for the application. Each file must have a containing directory Default: [] |
primary_app_icon | string | An optional String to identify the name of the primary app icon when alternate app icons have been Default: "" |
app_intents | list of labels | List of dependencies implementing the AppIntents protocol. Default: [] |
codesign_inputs | list of labels | A list of dependencies targets that provide inputs that will be used by Default: [] |
codesignopts | list of strings | A list of strings representing extra flags that should be passed to Default: [] |
exported_symbols_lists | list of labels | A list of targets containing exported symbols lists files for the linker to control symbol Each file is expected to have a list of global symbol names that will remain as global symbols in See the man page documentation for Default: [] |
linkopts | list of strings | A list of strings representing extra flags that should be passed to the linker. Default: [] |
additional_linker_inputs | list of labels | A list of input files to be passed to the linker. Default: [] |
stamp | integer | Enable link stamping. Whether to encode build information into the binary. Possible values:
Default: -1 |
deps | list of labels | A list of dependent targets that will be linked into this target's binary(s). Any resources, such as Default: [] |
bundle_name | string | The desired name of the bundle (without the extension). If this attribute is not set, then the name Default: "" |
executable_name | string | The desired name of the executable, if the bundle has an executable. If this attribute is not set, Default: "" |
strings | list of labels | A list of Default: [] |
resources | list of labels | A list of resources or files bundled with the bundle. The resources will be stored in the Default: [] |
version | label | An Default: None |
families | list of strings | A list of device families supported by this rule. At least one must be specified. Default: ["vision"] |
infoplists | list of labels | A list of .plist files that will be merged to form the Info.plist for this target. If not provided, Default: ["@rules_apple//apple/internal/templates:default_application_infoplist"] |
ipa_post_processor | label | A tool that edits this target's archive after it is assembled but before it is signed. The tool is Any changes made by the tool must be made in this directory, and the tool's execution must be Default: None |
locales_to_include | list 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. Default: [] |
*minimum_os_version | string | A required string indicating the minimum OS version supported by the target, represented as a |
minimum_deployment_os_version | string | A required string indicating the minimum deployment OS version supported by the target, represented Default: "" |
platform_type | string | Default: "visionos" |
bundle_id | string | The bundle ID (reverse-DNS path followed by app name) for this target. Only use this attribute if Default: "" |
bundle_id_suffix | string | A string to act as the suffix of the composed bundle ID. If this target's bundle ID is composed from Default: "bundle_name" |
provisioning_profile | label | The provisioning profile ( Default: None |
entitlements | label | The entitlements file required for device builds of this target. If absent, the default entitlements The following variables are substituted in the entitlements file: Default: None |
entitlements_validation | string | An Default: "loose" |
shared_capabilities | list of labels | A list of shared Default: [] |
frameworks | list of labels | A list of framework targets (see Default: [] |
extensions | list of labels | A list of visionOS extensions to include in the final application bundle. Default: [] |
launch_storyboard | label | The Default: None |
visionos_dynamic_frameworkBuilds and bundles a visionos dynamic framework that is consumable by Xcode.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
codesign_inputs | list of labels | A list of dependencies targets that provide inputs that will be used by Default: [] |
codesignopts | list of strings | A list of strings representing extra flags that should be passed to Default: [] |
exported_symbols_lists | list of labels | A list of targets containing exported symbols lists files for the linker to control symbol Each file is expected to have a list of global symbol names that will remain as global symbols in See the man page documentation for Default: [] |
linkopts | list of strings | A list of strings representing extra flags that should be passed to the linker. Default: [] |
additional_linker_inputs | list of labels | A list of input files to be passed to the linker. Default: [] |
stamp | integer | Enable link stamping. Whether to encode build information into the binary. Possible values:
Default: -1 |
deps | list of labels | A list of dependent targets that will be linked into this target's binary(s). Any resources, such as Default: [] |
bundle_name | string | The desired name of the bundle (without the extension). If this attribute is not set, then the name Default: "" |
executable_name | string | The desired name of the executable, if the bundle has an executable. If this attribute is not set, Default: "" |
strings | list of labels | A list of Default: [] |
resources | list of labels | A list of resources or files bundled with the bundle. The resources will be stored in the Default: [] |
version | label | An Default: None |
families | list of strings | A list of device families supported by this rule. At least one must be specified. Default: ["vision"] |
*infoplists | list of labels | A list of .plist files that will be merged to form the Info.plist for this target. At least one file |
ipa_post_processor | label | A tool that edits this target's archive after it is assembled but before it is signed. The tool is Any changes made by the tool must be made in this directory, and the tool's execution must be Default: None |
*minimum_os_version | string | A required string indicating the minimum OS version supported by the target, represented as a |
minimum_deployment_os_version | string | A required string indicating the minimum deployment OS version supported by the target, represented Default: "" |
platform_type | string | Default: "visionos" |
bundle_id | string | The bundle ID (reverse-DNS path followed by app name) for this target. Only use this attribute if Default: "" |
bundle_id_suffix | string | A string to act as the suffix of the composed bundle ID. If this target's bundle ID is composed from Default: "bundle_name" |
provisioning_profile | label | The provisioning profile ( Default: None |
base_bundle_id | label | The base bundle ID rule to dictate the form that a given bundle rule's bundle ID prefix should take. Default: None |
bundle_only | boolean | Avoid linking the dynamic framework, but still include it in the app. This is useful when you want Default: False |
extension_safe | boolean | If true, compiles and links this framework with Default: False |
frameworks | list of labels | A list of framework targets (see Default: [] |
hdrs | list of labels | Default: [] |
visionos_frameworkBuilds 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.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
codesign_inputs | list of labels | A list of dependencies targets that provide inputs that will be used by Default: [] |
codesignopts | list of strings | A list of strings representing extra flags that should be passed to Default: [] |
exported_symbols_lists | list of labels | A list of targets containing exported symbols lists files for the linker to control symbol Each file is expected to have a list of global symbol names that will remain as global symbols in See the man page documentation for Default: [] |
linkopts | list of strings | A list of strings representing extra flags that should be passed to the linker. Default: [] |
additional_linker_inputs | list of labels | A list of input files to be passed to the linker. Default: [] |
stamp | integer | Enable link stamping. Whether to encode build information into the binary. Possible values:
Default: -1 |
deps | list of labels | A list of dependent targets that will be linked into this target's binary(s). Any resources, such as Default: [] |
bundle_name | string | The desired name of the bundle (without the extension). If this attribute is not set, then the name Default: "" |
executable_name | string | The desired name of the executable, if the bundle has an executable. If this attribute is not set, Default: "" |
strings | list of labels | A list of Default: [] |
resources | list of labels | A list of resources or files bundled with the bundle. The resources will be stored in the Default: [] |
version | label | An Default: None |
families | list of strings | A list of device families supported by this rule. At least one must be specified. Default: ["vision"] |
*infoplists | list of labels | A list of .plist files that will be merged to form the Info.plist for this target. At least one file |
ipa_post_processor | label | A tool that edits this target's archive after it is assembled but before it is signed. The tool is Any changes made by the tool must be made in this directory, and the tool's execution must be Default: None |
*minimum_os_version | string | A required string indicating the minimum OS version supported by the target, represented as a |
minimum_deployment_os_version | string | A required string indicating the minimum deployment OS version supported by the target, represented Default: "" |
platform_type | string | Default: "visionos" |
bundle_id | string | The bundle ID (reverse-DNS path followed by app name) for this target. Only use this attribute if Default: "" |
bundle_id_suffix | string | A string to act as the suffix of the composed bundle ID. If this target's bundle ID is composed from Default: "bundle_name" |
provisioning_profile | label | The provisioning profile ( Default: None |
base_bundle_id | label | The base bundle ID rule to dictate the form that a given bundle rule's bundle ID prefix should take. Default: None |
bundle_only | boolean | Avoid linking the dynamic framework, but still include it in the app. This is useful when you want Default: False |
extension_safe | boolean | If true, compiles and links this framework with Default: False |
frameworks | list of labels | A list of framework targets (see Default: [] |
hdrs | list of labels | Default: [] |
visionos_static_frameworkBuilds 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_frameworkwith Swift only works with Xcode 11 and above, since
the required Swift functionality for module compatibility is available in
Swift 5.1.visionos_static_frameworkonly supports a single directswift_librarytarget
that does not depend transitively on any otherswift_librarytargets. The
Swift compiler expects a framework to contain a single Swift module, and each
swift_librarytarget is its own module by definition.visionos_static_frameworkdoes not support mixed Objective-C and Swift public
interfaces. This means that theumbrella_headerandhdrsattributes are
unavailable when usingswift_librarydependencies. You are allowed to depend
onobjc_libraryfrom the mainswift_librarydependency, but note that only
theswift_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).
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
codesign_inputs | list of labels | A list of dependencies targets that provide inputs that will be used by Default: [] |
codesignopts | list of strings | A list of strings representing extra flags that should be passed to Default: [] |
exported_symbols_lists | list of labels | A list of targets containing exported symbols lists files for the linker to control symbol Each file is expected to have a list of global symbol names that will remain as global symbols in See the man page documentation for Default: [] |
linkopts | list of strings | A list of strings representing extra flags that should be passed to the linker. Default: [] |
additional_linker_inputs | list of labels | A list of input files to be passed to the linker. Default: [] |
stamp | integer | Enable link stamping. Whether to encode build information into the binary. Possible values:
Default: -1 |
deps | list of labels | A list of dependent targets that will be linked into this target's binary(s). Any resources, such as Default: [] |
bundle_name | string | The desired name of the bundle (without the extension). If this attribute is not set, then the name Default: "" |
executable_name | string | The desired name of the executable, if the bundle has an executable. If this attribute is not set, Default: "" |
strings | list of labels | A list of Default: [] |
resources | list of labels | A list of resources or files bundled with the bundle. The resources will be stored in the Default: [] |
version | label | An Default: None |
families | list of strings | A list of device families supported by this rule. At least one must be specified. Default: ["vision"] |
ipa_post_processor | label | A tool that edits this target's archive after it is assembled but before it is signed. The tool is Any changes made by the tool must be made in this directory, and the tool's execution must be Default: None |
*minimum_os_version | string | A required string indicating the minimum OS version supported by the target, represented as a |
minimum_deployment_os_version | string | A required string indicating the minimum deployment OS version supported by the target, represented Default: "" |
platform_type | string | Default: "visionos" |
avoid_deps | list of labels | A list of library targets on which this framework depends in order to compile, but the transitive Default: [] |
exclude_resources | boolean | Indicates whether resources should be excluded from the bundle. This can be used to avoid Default: False |
hdrs | list of labels | A list of Default: [] |
umbrella_header | label | An optional single .h file to use as the umbrella header for this framework. Usually, this header Default: None |
visionos_build_testTest 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", ], )
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
*minimum_os_version | string | A required string indicating the minimum OS version that will be used as the |
targets | list of labels | The targets to check for successful build. Default: [] |
platform_type | string | Default: "visionos" |
@rules_apple@rules_apple//apple:watchos.bzl
Bazel rules for creating watchOS applications and bundles.
Rules
watchos_applicationBuilds and bundles a watchOS Application.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
app_icons | list of labels | Files that comprise the app icons for the application. Each file must have a containing directory Default: [] |
app_intents | list of labels | List of dependencies implementing the AppIntents protocol. Default: [] |
codesign_inputs | list of labels | A list of dependencies targets that provide inputs that will be used by Default: [] |
codesignopts | list of strings | A list of strings representing extra flags that should be passed to Default: [] |
exported_symbols_lists | list of labels | A list of targets containing exported symbols lists files for the linker to control symbol Each file is expected to have a list of global symbol names that will remain as global symbols in See the man page documentation for Default: [] |
linkopts | list of strings | A list of strings representing extra flags that should be passed to the linker. Default: [] |
additional_linker_inputs | list of labels | A list of input files to be passed to the linker. Default: [] |
stamp | integer | Enable link stamping. Whether to encode build information into the binary. Possible values:
Default: -1 |
deps | list of labels | A list of dependent targets that will be linked into this target's binary(s). Any resources, such as Default: [] |
bundle_name | string | The desired name of the bundle (without the extension). If this attribute is not set, then the name Default: "" |
executable_name | string | The desired name of the executable, if the bundle has an executable. If this attribute is not set, Default: "" |
strings | list of labels | A list of Default: [] |
resources | list of labels | A list of resources or files bundled with the bundle. The resources will be stored in the Default: [] |
version | label | An Default: None |
families | list of strings | A list of device families supported by this rule. At least one must be specified. Default: ["watch"] |
infoplists | list of labels | A list of .plist files that will be merged to form the Info.plist for this target. If not provided, Default: ["@rules_apple//apple/internal/templates:default_application_infoplist"] |
ipa_post_processor | label | A tool that edits this target's archive after it is assembled but before it is signed. The tool is Any changes made by the tool must be made in this directory, and the tool's execution must be Default: None |
locales_to_include | list 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. Default: [] |
*minimum_os_version | string | A required string indicating the minimum OS version supported by the target, represented as a |
minimum_deployment_os_version | string | A required string indicating the minimum deployment OS version supported by the target, represented Default: "" |
platform_type | string | Default: "watchos" |
bundle_id | string | The bundle ID (reverse-DNS path followed by app name) for this target. Only use this attribute if Default: "" |
bundle_id_suffix | string | A string to act as the suffix of the composed bundle ID. If this target's bundle ID is composed from Default: "watchkitapp" |
provisioning_profile | label | The provisioning profile ( Default: None |
entitlements | label | The entitlements file required for device builds of this target. If absent, the default entitlements The following variables are substituted in the entitlements file: Default: None |
entitlements_validation | string | An Default: "loose" |
shared_capabilities | list of labels | A list of shared Default: [] |
extension | label | The watchOS 2 It is considered an error if the watchOS 2 application extension is assigned to a single target This attribute will not support additional types of This attribute is deprecated, please use Default: None |
extensions | list 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, Default: [] |
storyboards | list of labels | A list of Default: [] |
frameworks | list of labels | A list of framework targets (see Default: [] |
watchos_dynamic_frameworkBuilds and bundles a watchOS dynamic framework that is consumable by Xcode.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
codesign_inputs | list of labels | A list of dependencies targets that provide inputs that will be used by Default: [] |
codesignopts | list of strings | A list of strings representing extra flags that should be passed to Default: [] |
exported_symbols_lists | list of labels | A list of targets containing exported symbols lists files for the linker to control symbol Each file is expected to have a list of global symbol names that will remain as global symbols in See the man page documentation for Default: [] |
linkopts | list of strings | A list of strings representing extra flags that should be passed to the linker. Default: [] |
additional_linker_inputs | list of labels | A list of input files to be passed to the linker. Default: [] |
stamp | integer | Enable link stamping. Whether to encode build information into the binary. Possible values:
Default: -1 |
deps | list of labels | A list of dependent targets that will be linked into this target's binary(s). Any resources, such as Default: [] |
bundle_name | string | The desired name of the bundle (without the extension). If this attribute is not set, then the name Default: "" |
executable_name | string | The desired name of the executable, if the bundle has an executable. If this attribute is not set, Default: "" |
strings | list of labels | A list of Default: [] |
resources | list of labels | A list of resources or files bundled with the bundle. The resources will be stored in the Default: [] |
version | label | An Default: None |
families | list of strings | A list of device families supported by this rule. At least one must be specified. Default: ["watch"] |
*infoplists | list of labels | A list of .plist files that will be merged to form the Info.plist for this target. At least one file |
ipa_post_processor | label | A tool that edits this target's archive after it is assembled but before it is signed. The tool is Any changes made by the tool must be made in this directory, and the tool's execution must be Default: None |
*minimum_os_version | string | A required string indicating the minimum OS version supported by the target, represented as a |
minimum_deployment_os_version | string | A required string indicating the minimum deployment OS version supported by the target, represented Default: "" |
platform_type | string | Default: "watchos" |
bundle_id | string | The bundle ID (reverse-DNS path followed by app name) for this target. Only use this attribute if Default: "" |
bundle_id_suffix | string | A string to act as the suffix of the composed bundle ID. If this target's bundle ID is composed from Default: "bundle_name" |
provisioning_profile | label | The provisioning profile ( Default: None |
base_bundle_id | label | The base bundle ID rule to dictate the form that a given bundle rule's bundle ID prefix should take. Default: None |
bundle_only | boolean | Avoid linking the dynamic framework, but still include it in the app. This is useful when you want Default: False |
extension_safe | boolean | If true, compiles and links this framework with Default: False |
frameworks | list of labels | A list of framework targets (see Default: [] |
hdrs | list of labels | Default: [] |
watchos_frameworkBuilds and bundles a watchOS Dynamic Framework.
To use this framework for your extensions, list it in the frameworks attributes of
those watchos_extension rules.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
codesign_inputs | list of labels | A list of dependencies targets that provide inputs that will be used by Default: [] |
codesignopts | list of strings | A list of strings representing extra flags that should be passed to Default: [] |
exported_symbols_lists | list of labels | A list of targets containing exported symbols lists files for the linker to control symbol Each file is expected to have a list of global symbol names that will remain as global symbols in See the man page documentation for Default: [] |
linkopts | list of strings | A list of strings representing extra flags that should be passed to the linker. Default: [] |
additional_linker_inputs | list of labels | A list of input files to be passed to the linker. Default: [] |
stamp | integer | Enable link stamping. Whether to encode build information into the binary. Possible values:
Default: -1 |
deps | list of labels | A list of dependent targets that will be linked into this target's binary(s). Any resources, such as Default: [] |
bundle_name | string | The desired name of the bundle (without the extension). If this attribute is not set, then the name Default: "" |
executable_name | string | The desired name of the executable, if the bundle has an executable. If this attribute is not set, Default: "" |
strings | list of labels | A list of Default: [] |
resources | list of labels | A list of resources or files bundled with the bundle. The resources will be stored in the Default: [] |
version | label | An Default: None |
families | list of strings | A list of device families supported by this rule. At least one must be specified. Default: ["watch"] |
*infoplists | list of labels | A list of .plist files that will be merged to form the Info.plist for this target. At least one file |
ipa_post_processor | label | A tool that edits this target's archive after it is assembled but before it is signed. The tool is Any changes made by the tool must be made in this directory, and the tool's execution must be Default: None |
*minimum_os_version | string | A required string indicating the minimum OS version supported by the target, represented as a |
minimum_deployment_os_version | string | A required string indicating the minimum deployment OS version supported by the target, represented Default: "" |
platform_type | string | Default: "watchos" |
bundle_id | string | The bundle ID (reverse-DNS path followed by app name) for this target. Only use this attribute if Default: "" |
bundle_id_suffix | string | A string to act as the suffix of the composed bundle ID. If this target's bundle ID is composed from Default: "bundle_name" |
provisioning_profile | label | The provisioning profile ( Default: None |
base_bundle_id | label | The base bundle ID rule to dictate the form that a given bundle rule's bundle ID prefix should take. Default: None |
bundle_only | boolean | Avoid linking the dynamic framework, but still include it in the app. This is useful when you want Default: False |
extension_safe | boolean | If true, compiles and links this framework with Default: False |
frameworks | list of labels | A list of framework targets (see Default: [] |
hdrs | list of labels | Default: [] |
watchos_extensionBuilds and bundles a watchOS Extension.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
app_intents | list of labels | List of dependencies implementing the AppIntents protocol. Default: [] |
codesign_inputs | list of labels | A list of dependencies targets that provide inputs that will be used by Default: [] |
codesignopts | list of strings | A list of strings representing extra flags that should be passed to Default: [] |
exported_symbols_lists | list of labels | A list of targets containing exported symbols lists files for the linker to control symbol Each file is expected to have a list of global symbol names that will remain as global symbols in See the man page documentation for Default: [] |
linkopts | list of strings | A list of strings representing extra flags that should be passed to the linker. Default: [] |
additional_linker_inputs | list of labels | A list of input files to be passed to the linker. Default: [] |
stamp | integer | Enable link stamping. Whether to encode build information into the binary. Possible values:
Default: -1 |
deps | list of labels | A list of dependent targets that will be linked into this target's binary(s). Any resources, such as Default: [] |
bundle_name | string | The desired name of the bundle (without the extension). If this attribute is not set, then the name Default: "" |
executable_name | string | The desired name of the executable, if the bundle has an executable. If this attribute is not set, Default: "" |
strings | list of labels | A list of Default: [] |
resources | list of labels | A list of resources or files bundled with the bundle. The resources will be stored in the Default: [] |
version | label | An Default: None |
families | list of strings | A list of device families supported by this rule. At least one must be specified. Default: ["watch"] |
*infoplists | list of labels | A list of .plist files that will be merged to form the Info.plist for this target. At least one file |
ipa_post_processor | label | A tool that edits this target's archive after it is assembled but before it is signed. The tool is Any changes made by the tool must be made in this directory, and the tool's execution must be Default: None |
locales_to_include | list 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. Default: [] |
*minimum_os_version | string | A required string indicating the minimum OS version supported by the target, represented as a |
minimum_deployment_os_version | string | A required string indicating the minimum deployment OS version supported by the target, represented Default: "" |
platform_type | string | Default: "watchos" |
bundle_id | string | The bundle ID (reverse-DNS path followed by app name) for this target. Only use this attribute if Default: "" |
bundle_id_suffix | string | A string to act as the suffix of the composed bundle ID. If this target's bundle ID is composed from Default: "watchkitapp.watchkitextension" |
provisioning_profile | label | The provisioning profile ( Default: None |
entitlements | label | The entitlements file required for device builds of this target. If absent, the default entitlements The following variables are substituted in the entitlements file: Default: None |
entitlements_validation | string | An Default: "loose" |
shared_capabilities | list of labels | A list of shared Default: [] |
application_extension | boolean | If Default: False |
extensions | list of labels | A list of watchOS application extensions to include in the final watch extension bundle. Default: [] |
frameworks | list of labels | A list of framework targets (see Default: [] |
watchos_static_frameworkBuilds and bundles a watchOS Static Framework.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
codesign_inputs | list of labels | A list of dependencies targets that provide inputs that will be used by Default: [] |
codesignopts | list of strings | A list of strings representing extra flags that should be passed to Default: [] |
exported_symbols_lists | list of labels | A list of targets containing exported symbols lists files for the linker to control symbol Each file is expected to have a list of global symbol names that will remain as global symbols in See the man page documentation for Default: [] |
linkopts | list of strings | A list of strings representing extra flags that should be passed to the linker. Default: [] |
additional_linker_inputs | list of labels | A list of input files to be passed to the linker. Default: [] |
stamp | integer | Enable link stamping. Whether to encode build information into the binary. Possible values:
Default: -1 |
deps | list of labels | A list of dependent targets that will be linked into this target's binary(s). Any resources, such as Default: [] |
bundle_name | string | The desired name of the bundle (without the extension). If this attribute is not set, then the name Default: "" |
executable_name | string | The desired name of the executable, if the bundle has an executable. If this attribute is not set, Default: "" |
strings | list of labels | A list of Default: [] |
resources | list of labels | A list of resources or files bundled with the bundle. The resources will be stored in the Default: [] |
version | label | An Default: None |
families | list of strings | A list of device families supported by this rule. At least one must be specified. Default: ["watch"] |
ipa_post_processor | label | A tool that edits this target's archive after it is assembled but before it is signed. The tool is Any changes made by the tool must be made in this directory, and the tool's execution must be Default: None |
*minimum_os_version | string | A required string indicating the minimum OS version supported by the target, represented as a |
minimum_deployment_os_version | string | A required string indicating the minimum deployment OS version supported by the target, represented Default: "" |
platform_type | string | Default: "watchos" |
avoid_deps | list of labels | A list of library targets on which this framework depends in order to compile, but the transitive Default: [] |
exclude_resources | boolean | Indicates whether resources should be excluded from the bundle. This can be used to avoid Default: False |
hdrs | list of labels | A list of Default: [] |
umbrella_header | label | An optional single .h file to use as the umbrella header for this framework. Usually, this header Default: None |
watchos_build_testTest 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", ], )
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
*minimum_os_version | string | A required string indicating the minimum OS version that will be used as the |
targets | list of labels | The targets to check for successful build. Default: [] |
platform_type | string | Default: "watchos" |
@rules_apple@rules_apple//apple:xcarchive.bzl
Rules for creating Xcode archives.
Rules
xcarchiveRe-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", )
@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
xctrunnerPackages 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, )
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
*tests | list of labels | List of test targets and suites to include. |
verbose | boolean | Print logs from xctrunnertool to console. Default: False |