Documentation

Edit

Objective-C Rules

apple_binary

apple_binary(name, deps, srcs, data, resources, hdrs, asset_catalogs, binary_type, bundles, compatible_with, copts, datamodels, defines, deprecation, distribs, dylibs, enable_modules, extension_safe, features, includes, licenses, linkopts, non_arc_srcs, non_propagated_deps, pch, platform_type, restricted_to, runtime_deps, sdk_dylibs, sdk_frameworks, sdk_includes, storyboards, strings, structured_resources, tags, testonly, textual_hdrs, visibility, weak_sdk_frameworks, xibs)

This rule produces single- or multi-architecture ("fat") Objective-C libraries and/or binaries, typically used in creating apple bundles, such as frameworks, extensions, or applications.

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.

Implicit output targets

  • name_lipobin: the 'lipo'ed potentially multi-architecture binary. All transitive dependencies and srcs are linked.

Arguments

Attributes
name

Name; required

A unique name for this rule.

deps

List of labels; optional

The list of targets that are linked together to form the final bundle.
srcs

List of labels; optional

The list of C, C++, Objective-C, and Objective-C++ source and header files that are processed to create the library target. These are your checked-in files, plus any generated files. Source files are compiled into .o files with Clang. Header files may be included/imported by any source or header in the srcs attribute of this target, but not by headers in hdrs or any targets that depend on this rule. Additionally, precompiled .o files may be given as srcs. Be careful to ensure consistency in the architecture of provided .o files and that of the build to avoid missing symbol linker errors.
resources

List of labels; optional

Files to include in the final application bundle. They are not processed or compiled in any way besides the processing done by the rules that actually generate them. These files are placed in the root of the bundle (e.g. Payload/foo.app/...) in most cases. However, if they appear to be localized (i.e. are contained in a directory called *.lproj), they will be placed in a directory of the same name in the app bundle.
hdrs

List of labels; optional

The list of C, C++, Objective-C, and Objective-C++ files that are included as headers by source files in this rule or by users of this library. These will be compiled separately from the source if modules are enabled.
asset_catalogs

List of labels; optional

Files that comprise the asset catalogs of the final linked binary. Each file must have a containing directory named *.xcassets. This containing directory becomes the root of one of the asset catalogs linked with any binary that depends directly or indirectly on this target.
binary_type

String; optional; default is "executable"

The type of binary that this target should build. Options are:
  • executable (default): the output binary is an executable and must implement the main() function.
  • loadable_bundle: the output binary is a loadable bundle that may be loaded at runtime. When building a bundle, you may also pass a bundle_loader binary that contains symbols referenced but not implemented in the loadable bundle.
  • dylib: the output binary is meant to be loaded at load time (when the operating system is loading the binary into memory) and cannot be unloaded. Dylibs are usually consumed in frameworks, which are .framework bundles that contain the dylib as well as well as required resources to run.
bundles

List of labels; optional

The list of bundle targets that this target requires to be included in the final bundle.
copts

List of strings; optional

Extra flags to pass to the compiler. Subject to "Make variable" substitution and Bourne shell tokenization. These flags will only apply to this target, and not those upon which it depends, or those which depend on it.

Note that for the generated Xcode project, directory paths specified using "-I" flags in copts are parsed out, prepended with "$(WORKSPACE_ROOT)/" if they are relative paths, and added to the header search paths for the associated Xcode target.

datamodels

List of labels; optional

Files that comprise the data models of the final linked binary. Each file must have a containing directory named *.xcdatamodel, which is usually contained by another *.xcdatamodeld (note the added d) directory.
defines

List of strings; optional

Extra -D flags to pass to the compiler. They should be in the form KEY=VALUE or simply KEY and are passed not only to the compiler for this target (as copts are) but also to all objc_ dependers of this target. Subject to "Make variable" substitution and Bourne shell tokenization.
dylibs

List of labels; optional

A list of dynamic library targets to be linked against in this rule and included in the final bundle. Libraries which are transitive dependencies of any such dylibs will not be statically linked in this target (even if they are otherwise transitively depended on via the deps attribute) to avoid duplicate symbols.

Please note: this attribute should only accept apple dynamic library targets, but currently accepts many other objc or apple targets. This is a bug, so do not rely on this behavior.

enable_modules

Boolean; optional; default is 0

Enables clang module support (via -fmodules). Setting this to 1 will allow you to @import system headers and other targets: @import UIKit; @import path_to_package_target;
extension_safe

Boolean; optional; nonconfigurable; default is 0

Indicates whether this binary is for an extension. This will set certain compiler options and restrictions on dependencies of this target.
includes

List of strings; optional

List of #include/#import search paths to add to this target and all depending targets. This is to support third party and open-sourced libraries that do not specify the entire workspace path in their #import/#include statements.

The paths are interpreted relative to the package directory, and the genfiles and bin roots (e.g. bazel-genfiles/pkg/includedir and bazel-out/pkg/includedir) are included in addition to the actual client root.

Unlike COPTS, these flags are added for this rule and every rule that depends on it. (Note: not the rules it depends upon!) Be very careful, since this may have far-reaching effects. When in doubt, add "-iquote" flags to COPTS instead.

linkopts

List of strings; optional

Extra flags to pass to the linker.
non_arc_srcs

List of labels; optional

The list of Objective-C files that are processed to create the library target that DO NOT use ARC. The files in this attribute are treated very similar to those in the srcs attribute, but are compiled without ARC enabled.
non_propagated_deps

List of labels; optional

The list of targets that are required in order to build this target, but which are not included in the final bundle. This attribute should only rarely be used, and probably only for proto dependencies.
pch

Label; optional

Header file to prepend to every source file being compiled (both arc and non-arc). Use of pch files is actively discouraged in BUILD files, and this should be considered deprecated. Since pch files are not actually precompiled this is not a build-speed enhancement, and instead is just a global dependency. From a build efficiency point of view you are actually better including what you need directly in your sources where you need it.
platform_type

String; optional; nonconfigurable; default is "ios"

The type of platform for which to create artifacts in this rule. This dictates which Apple platform SDK is used for compilation/linking and which flag is used to determine the architectures for which to build. For example, if ios is selected, then the output binaries/libraries will be created combining all architectures specified in --ios_multi_cpus. Options are:
  • ios (default): architectures gathered from --ios_multi_cpus.
  • macos: architectures gathered from --macos_cpus.
  • tvos: architectures gathered from --tvos_cpus.
  • watchos: architectures gathered from --watchos_cpus.
runtime_deps

List of labels; optional

The list of framework targets that are late loaded at runtime. They are included in the app bundle but not linked against at build time.
sdk_dylibs

List of strings; optional

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

List of strings; optional

Names of SDK frameworks to link with. For instance, "XCTest" or "Cocoa". "UIKit" and "Foundation" are always included and do not mean anything if you include them.

When linking a library, only those frameworks named in that library's sdk_frameworks attribute are linked in. When linking a binary, all SDK frameworks named in that binary's transitive dependency graph are used.

sdk_includes

List of strings; optional

List of #include/#import search paths to add to this target and all depending targets, where each path is relative to $(SDKROOT)/usr/include.
storyboards

List of labels; optional

Files which are .storyboard resources, possibly localizable. These files are compiled to .storyboardc directories, which are placed in the bundle root of the final package. If the storyboards's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable UI.
strings

List of labels; optional

Files which are plists of strings, often localizable. These files are converted to binary plists (if they are not already) and placed in the bundle root of the final package. If this file's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable strings.
structured_resources

List of labels; optional

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

Note that in the generated XCode project file, all files in the top directory of the specified files will be included in the Xcode-generated app bundle. So specifying ["res/foo.png"] will lead to the inclusion of all files in directory res.

textual_hdrs

List of labels; optional

The list of C, C++, Objective-C, and Objective-C++ files that are included as headers by source files in this rule or by users of this library. Unlike hdrs, these will not be compiled separately from the sources.
weak_sdk_frameworks

List of strings; optional

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

List of labels; optional

Files which are .xib resources, possibly localizable. These files are compiled to .nib files and placed the bundle root of the final package. If this file's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable UI.

apple_static_library

apple_static_library(name, deps, srcs, data, resources, hdrs, asset_catalogs, avoid_deps, bundles, compatible_with, copts, datamodels, defines, deprecation, distribs, enable_modules, features, includes, licenses, linkopts, non_arc_srcs, non_propagated_deps, pch, platform_type, restricted_to, runtime_deps, sdk_dylibs, sdk_frameworks, sdk_includes, storyboards, strings, structured_resources, tags, testonly, textual_hdrs, visibility, weak_sdk_frameworks, xibs)

This rule produces single- or multi-architecture ("fat") Objective-C statically-linked libraries, typically used in creating static Apple Frameworks for distribution and re-use in multiple extensions or applications.

The lipo tool is used to combine files of multiple architectures; a build flag controls which architectures are targeted. The build flag examined depends on the platform_type attribute for this rule (and is described in its documentation).

Implicit output targets

  • name_lipo.a: a 'lipo'ed archive file. All transitive dependencies and srcs are linked, minus all transitive dependencies specified in avoid_deps.

Arguments

Attributes
name

Name; required

A unique name for this rule.

deps

List of labels; optional

The list of targets that are linked together to form the final bundle.
srcs

List of labels; optional

The list of C, C++, Objective-C, and Objective-C++ source and header files that are processed to create the library target. These are your checked-in files, plus any generated files. Source files are compiled into .o files with Clang. Header files may be included/imported by any source or header in the srcs attribute of this target, but not by headers in hdrs or any targets that depend on this rule. Additionally, precompiled .o files may be given as srcs. Be careful to ensure consistency in the architecture of provided .o files and that of the build to avoid missing symbol linker errors.
resources

List of labels; optional

Files to include in the final application bundle. They are not processed or compiled in any way besides the processing done by the rules that actually generate them. These files are placed in the root of the bundle (e.g. Payload/foo.app/...) in most cases. However, if they appear to be localized (i.e. are contained in a directory called *.lproj), they will be placed in a directory of the same name in the app bundle.
hdrs

List of labels; optional

The list of C, C++, Objective-C, and Objective-C++ files that are included as headers by source files in this rule or by users of this library. These will be compiled separately from the source if modules are enabled.
asset_catalogs

List of labels; optional

Files that comprise the asset catalogs of the final linked binary. Each file must have a containing directory named *.xcassets. This containing directory becomes the root of one of the asset catalogs linked with any binary that depends directly or indirectly on this target.
avoid_deps

List of labels; optional

A list of targets which should not be included (nor their transitive dependencies included) in the outputs of this rule -- even if they are otherwise transitively depended on via the deps attribute.

This attribute effectively serves to remove portions of the dependency tree from a static library, and is useful most commonly in scenarios where static libraries depend on each other.

That is, suppose static libraries X and C are typically distributed to consumers separately. C is a very-common base library, and X contains less-common functionality; X depends on C, such that applications seeking to import library X must also import library C. The target describing X would set C's target in avoid_deps. In this way, X can depend on C without also containing C. Without this avoid_deps usage, an application importing both X and C would have duplicate symbols for C.

bundles

List of labels; optional

The list of bundle targets that this target requires to be included in the final bundle.
copts

List of strings; optional

Extra flags to pass to the compiler. Subject to "Make variable" substitution and Bourne shell tokenization. These flags will only apply to this target, and not those upon which it depends, or those which depend on it.

Note that for the generated Xcode project, directory paths specified using "-I" flags in copts are parsed out, prepended with "$(WORKSPACE_ROOT)/" if they are relative paths, and added to the header search paths for the associated Xcode target.

datamodels

List of labels; optional

Files that comprise the data models of the final linked binary. Each file must have a containing directory named *.xcdatamodel, which is usually contained by another *.xcdatamodeld (note the added d) directory.
defines

List of strings; optional

Extra -D flags to pass to the compiler. They should be in the form KEY=VALUE or simply KEY and are passed not only to the compiler for this target (as copts are) but also to all objc_ dependers of this target. Subject to "Make variable" substitution and Bourne shell tokenization.
enable_modules

Boolean; optional; default is 0

Enables clang module support (via -fmodules). Setting this to 1 will allow you to @import system headers and other targets: @import UIKit; @import path_to_package_target;
includes

List of strings; optional

List of #include/#import search paths to add to this target and all depending targets. This is to support third party and open-sourced libraries that do not specify the entire workspace path in their #import/#include statements.

The paths are interpreted relative to the package directory, and the genfiles and bin roots (e.g. bazel-genfiles/pkg/includedir and bazel-out/pkg/includedir) are included in addition to the actual client root.

Unlike COPTS, these flags are added for this rule and every rule that depends on it. (Note: not the rules it depends upon!) Be very careful, since this may have far-reaching effects. When in doubt, add "-iquote" flags to COPTS instead.

linkopts

List of strings; optional

Extra flags to pass to the linker.
non_arc_srcs

List of labels; optional

The list of Objective-C files that are processed to create the library target that DO NOT use ARC. The files in this attribute are treated very similar to those in the srcs attribute, but are compiled without ARC enabled.
non_propagated_deps

List of labels; optional

The list of targets that are required in order to build this target, but which are not included in the final bundle. This attribute should only rarely be used, and probably only for proto dependencies.
pch

Label; optional

Header file to prepend to every source file being compiled (both arc and non-arc). Use of pch files is actively discouraged in BUILD files, and this should be considered deprecated. Since pch files are not actually precompiled this is not a build-speed enhancement, and instead is just a global dependency. From a build efficiency point of view you are actually better including what you need directly in your sources where you need it.
platform_type

String; optional; nonconfigurable; default is "ios"

The type of platform for which to create artifacts in this rule. This dictates which Apple platform SDK is used for compilation/linking and which flag is used to determine the architectures for which to build. For example, if ios is selected, then the output binaries/libraries will be created combining all architectures specified in --ios_multi_cpus. Options are:
  • ios (default): architectures gathered from --ios_multi_cpus.
  • macos: architectures gathered from --macos_cpus.
  • tvos: architectures gathered from --tvos_cpus.
  • watchos: architectures gathered from --watchos_cpus.
runtime_deps

List of labels; optional

The list of framework targets that are late loaded at runtime. They are included in the app bundle but not linked against at build time.
sdk_dylibs

List of strings; optional

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

List of strings; optional

Names of SDK frameworks to link with. For instance, "XCTest" or "Cocoa". "UIKit" and "Foundation" are always included and do not mean anything if you include them.

When linking a library, only those frameworks named in that library's sdk_frameworks attribute are linked in. When linking a binary, all SDK frameworks named in that binary's transitive dependency graph are used.

sdk_includes

List of strings; optional

List of #include/#import search paths to add to this target and all depending targets, where each path is relative to $(SDKROOT)/usr/include.
storyboards

List of labels; optional

Files which are .storyboard resources, possibly localizable. These files are compiled to .storyboardc directories, which are placed in the bundle root of the final package. If the storyboards's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable UI.
strings

List of labels; optional

Files which are plists of strings, often localizable. These files are converted to binary plists (if they are not already) and placed in the bundle root of the final package. If this file's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable strings.
structured_resources

List of labels; optional

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

Note that in the generated XCode project file, all files in the top directory of the specified files will be included in the Xcode-generated app bundle. So specifying ["res/foo.png"] will lead to the inclusion of all files in directory res.

textual_hdrs

List of labels; optional

The list of C, C++, Objective-C, and Objective-C++ files that are included as headers by source files in this rule or by users of this library. Unlike hdrs, these will not be compiled separately from the sources.
weak_sdk_frameworks

List of strings; optional

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

List of labels; optional

Files which are .xib resources, possibly localizable. These files are compiled to .nib files and placed the bundle root of the final package. If this file's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable UI.

apple_watch1_extension

apple_watch1_extension(name, app_asset_catalogs, app_bundle_id, app_deps, app_entitlements, app_icon, app_infoplists, app_name, app_provisioning_profile, app_resources, app_strings, app_structured_resources, binary, compatible_with, deprecation, distribs, ext_bundle_id, ext_entitlements, ext_families, ext_infoplists, ext_provisioning_profile, ext_resources, ext_strings, ext_structured_resources, features, licenses, restricted_to, tags, testonly, visibility)

This rule is deprecated. Please use the new Apple build rules (https://github.com/bazelbuild/rules_apple) to build Apple targets.

This rule produces an extension bundle for apple watch OS 1 which also contains the watch application bundle

Implicit output targets

  • name.ipa: the extension bundle as an .ipa file
  • ${ATTRIBUTE_DEFINITION}

    Arguments

    Attributes
    name

    Name; required

    A unique name for this rule.

    app_asset_catalogs

    List of labels; optional

    Files that comprise the asset catalogs of the final linked binary. Each file must have a containing directory named *.xcassets. This containing directory becomes the root of one of the asset catalogs linked with any binary that depends directly or indirectly on this target.
    app_bundle_id

    String; optional

    The bundle ID (reverse-DNS path followed by app name) of the watch application binary. If specified, it will override the bundle ID specified in the associated plist file. If no bundle ID is specified on either this attribute or in the plist file, a junk value will be used.
    app_deps

    List of labels; optional

    The list of targets whose resources files are bundled together to form final watch application bundle.
    app_entitlements

    Label; optional

    The entitlements file required for device builds of watch application. See the apple documentation for more information. If absent, the default entitlements from the provisioning profile will be used.

    The following variables are substituted as per their definitions in Apple's documentation: $(AppIdentifierPrefix) and $(CFBundleIdentifier).

    app_icon

    String; optional

    The name of the watch application icon. The icon should be in one of the asset catalogs of this target or a (transitive) dependency. In a new project, this is initialized to "AppIcon" by Xcode.

    If the application icon is not in an asset catalog, do not use this attribute. Instead, add a CFBundleIcons entry to the Info.plist file.

    app_infoplists

    List of labels; optional

    Infoplist files to be merged. The merged output corresponds to appname-Info.plist in Xcode projects. Duplicate keys between infoplist files will cause an error if and only if the values conflict. If both infoplist and infoplists are specified, the files defined in both attributes will be used. Bazel will perform variable substitution on the plist files for the following values:
    • ${EXECUTABLE_NAME}: The name of the executable generated and included in the bundle by bazel, which can be used as the value for CFBundleExecutable within the plist.
    • ${BUNDLE_NAME}: This target's name and bundle suffix (.bundle or .app) in the formname.suffix.
    • ${PRODUCT_NAME}: This target's name.
    app_name

    String; required

    Name of the final watch application binary.
    app_provisioning_profile

    Label; optional

    The provisioning profile (.mobileprovision file) to use when bundling the watch application. This is only used for non-simulator builds.
    app_resources

    List of labels; optional

    Files to include in the final watch application bundle. They are not processed or compiled in any way besides the processing done by the rules that actually generate them. These files are placed in the root of the bundle (e.g. Foo.app/...) in most cases. However, if they appear to be localized (i.e. are contained in a directory called *.lproj), they will be placed in a directory of the same name in the app bundle.
    app_strings

    List of labels; optional

    Files which are plists of strings, often localizable to be added to watch application. These files are converted to binary plists (if they are not already) and placed in the bundle root of the final package. If this file's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable strings.
    app_structured_resources

    List of labels; optional

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

    Note that in the generated XCode project file, all files in the top directory of the specified files will be included in the Xcode-generated app bundle. So specifying ["res/foo.png"] will lead to the inclusion of all files in directory res.

    binary

    Label; required

    The binary target containing the logic for the watch extension. This must be an apple_watch1_extension_binary target.
    ext_bundle_id

    String; optional

    The bundle ID (reverse-DNS path followed by app name) of the watch extension binary. If specified, it will override the bundle ID specified in the associated plist file. If no bundle ID is specified on either this attribute or in the plist file, a junk value will be used.
    ext_entitlements

    Label; optional

    The entitlements file required for device builds of watch extension. See the apple documentation for more information. If absent, the default entitlements from the provisioning profile will be used.

    The following variables are substituted as per their definitions in Apple's documentation: $(AppIdentifierPrefix) and $(CFBundleIdentifier).

    ext_families

    List of strings; optional

    The device families to which the watch extension is targeted. This is known as the TARGETED_DEVICE_FAMILY build setting in Xcode project files. It is a list of one or more of the strings "iphone" and "ipad".

    By default this is set to "iphone". If it is explicitly specified it may not be empty.

    The watch application is always built for "watch" for device builds and "iphone, watch" for simulator builds.

    ext_infoplists

    List of labels; optional

    Infoplist files to be merged. The merged output corresponds to appname-Info.plist in Xcode projects. Duplicate keys between infoplist files will cause an error if and only if the values conflict. If both infoplist and infoplists are specified, the files defined in both attributes will be used. Bazel will perform variable substitution on the plist files for the following values:
    • ${EXECUTABLE_NAME}: The name of the executable generated and included in the bundle by bazel, which can be used as the value for CFBundleExecutable within the plist.
    • ${BUNDLE_NAME}: This target's name and bundle suffix (.bundle or .app) in the formname.suffix.
    • ${PRODUCT_NAME}: This target's name.
    ext_provisioning_profile

    Label; optional

    The provisioning profile (.mobileprovision file) to use when bundling the watch extension. This is only used for non-simulator builds.
    ext_resources

    List of labels; optional

    Files to include in the final watch extension bundle. They are not processed or compiled in any way besides the processing done by the rules that actually generate them. These files are placed in the root of the bundle (e.g. Foo.app/...) in most cases. However, if they appear to be localized (i.e. are contained in a directory called *.lproj), they will be placed in a directory of the same name in the app bundle.
    ext_strings

    List of labels; optional

    Files which are plists of strings, often localizable to be added to watch extension. These files are converted to binary plists (if they are not already) and placed in the bundle root of the final package. If this file's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable strings.
    ext_structured_resources

    List of labels; optional

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

    Note that in the generated XCode project file, all files in the top directory of the specified files will be included in the Xcode-generated app bundle. So specifying ["res/foo.png"] will lead to the inclusion of all files in directory res.

    apple_watch2_extension

    apple_watch2_extension(name, app_asset_catalogs, app_bundle_id, app_entitlements, app_icon, app_infoplists, app_name, app_provisioning_profile, app_resources, app_strings, app_structured_resources, binary, compatible_with, deprecation, distribs, ext_bundle_id, ext_entitlements, ext_infoplists, ext_provisioning_profile, ext_resources, ext_strings, ext_structured_resources, features, licenses, restricted_to, tags, testonly, visibility)

    This rule is deprecated. Please use the new Apple build rules (https://github.com/bazelbuild/rules_apple) to build Apple targets.

    This rule produces an extension bundle for apple watch OS 2.

    It requires attributes set for both the watchOS2 application and watchOS2 extension that will be present in any final ios application bundle. Application attributes are prefixed with app_, and extension attributes prefixed with ext_.

    The required 'binary' attribute should contain the apple_binary extension binary (built for the watch platform type.

    ${IMPLICIT_OUTPUTS} ${ATTRIBUTE_DEFINITION}

    Arguments

    Attributes
    name

    Name; required

    A unique name for this rule.

    app_asset_catalogs

    List of labels; optional

    Files that comprise the asset catalogs of the final linked binary. Each file must have a containing directory named *.xcassets. This containing directory becomes the root of one of the asset catalogs linked with any binary that depends directly or indirectly on this target.
    app_bundle_id

    String; optional

    The bundle ID (reverse-DNS path followed by app name) of the watch application binary. If specified, it will override the bundle ID specified in the associated plist file. If no bundle ID is specified on either this attribute or in the plist file, a junk value will be used.
    app_entitlements

    Label; optional

    The entitlements file required for device builds of watch application. See the apple documentation for more information. If absent, the default entitlements from the provisioning profile will be used.

    The following variables are substituted as per their definitions in Apple's documentation: $(AppIdentifierPrefix) and $(CFBundleIdentifier).

    app_icon

    String; optional

    The name of the watch application icon. The icon should be in one of the asset catalogs of this target or a (transitive) dependency. In a new project, this is initialized to "AppIcon" by Xcode.

    If the application icon is not in an asset catalog, do not use this attribute. Instead, add a CFBundleIcons entry to the Info.plist file.

    app_infoplists

    List of labels; optional

    Infoplist files to be merged. The merged output corresponds to appname-Info.plist in Xcode projects. Duplicate keys between infoplist files will cause an error if and only if the values conflict. If both infoplist and infoplists are specified, the files defined in both attributes will be used. Bazel will perform variable substitution on the plist files for the following values:
    • ${EXECUTABLE_NAME}: The name of the executable generated and included in the bundle by bazel, which can be used as the value for CFBundleExecutable within the plist.
    • ${BUNDLE_NAME}: This target's name and bundle suffix (.bundle or .app) in the formname.suffix.
    • ${PRODUCT_NAME}: This target's name.
    app_name

    String; required

    Name of the final watch application binary.
    app_provisioning_profile

    Label; optional

    The provisioning profile (.mobileprovision file) to use when bundling the watch application. This is only used for non-simulator builds.
    app_resources

    List of labels; optional

    Files to include in the final watch application bundle. They are not processed or compiled in any way besides the processing done by the rules that actually generate them. These files are placed in the root of the bundle (e.g. Foo.app/...) in most cases. However, if they appear to be localized (i.e. are contained in a directory called *.lproj), they will be placed in a directory of the same name in the app bundle.
    app_strings

    List of labels; optional

    Files which are plists of strings, often localizable to be added to watch application. These files are converted to binary plists (if they are not already) and placed in the bundle root of the final package. If this file's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable strings.
    app_structured_resources

    List of labels; optional

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

    Note that in the generated XCode project file, all files in the top directory of the specified files will be included in the Xcode-generated app bundle. So specifying ["res/foo.png"] will lead to the inclusion of all files in directory res.

    binary

    Label; optional

    The binary target containing the logic for the watch extension. This must be an apple_binary target with platformtype attribute set to watchos.
    ext_bundle_id

    String; optional

    The bundle ID (reverse-DNS path followed by app name) of the watch extension binary. If specified, it will override the bundle ID specified in the associated plist file. If no bundle ID is specified on either this attribute or in the plist file, a junk value will be used.
    ext_entitlements

    Label; optional

    The entitlements file required for device builds of watch extension. See the apple documentation for more information. If absent, the default entitlements from the provisioning profile will be used.

    The following variables are substituted as per their definitions in Apple's documentation: $(AppIdentifierPrefix) and $(CFBundleIdentifier).

    ext_infoplists

    List of labels; optional

    Infoplist files to be merged. The merged output corresponds to appname-Info.plist in Xcode projects. Duplicate keys between infoplist files will cause an error if and only if the values conflict. If both infoplist and infoplists are specified, the files defined in both attributes will be used. Bazel will perform variable substitution on the plist files for the following values:
    • ${EXECUTABLE_NAME}: The name of the executable generated and included in the bundle by bazel, which can be used as the value for CFBundleExecutable within the plist.
    • ${BUNDLE_NAME}: This target's name and bundle suffix (.bundle or .app) in the formname.suffix.
    • ${PRODUCT_NAME}: This target's name.
    ext_provisioning_profile

    Label; optional

    The provisioning profile (.mobileprovision file) to use when bundling the watch extension. This is only used for non-simulator builds.
    ext_resources

    List of labels; optional

    Files to include in the final watch extension bundle. They are not processed or compiled in any way besides the processing done by the rules that actually generate them. These files are placed in the root of the bundle (e.g. Foo.app/...) in most cases. However, if they appear to be localized (i.e. are contained in a directory called *.lproj), they will be placed in a directory of the same name in the app bundle.
    ext_strings

    List of labels; optional

    Files which are plists of strings, often localizable to be added to watch extension. These files are converted to binary plists (if they are not already) and placed in the bundle root of the final package. If this file's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable strings.
    ext_structured_resources

    List of labels; optional

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

    Note that in the generated XCode project file, all files in the top directory of the specified files will be included in the Xcode-generated app bundle. So specifying ["res/foo.png"] will lead to the inclusion of all files in directory res.

    apple_watch_extension_binary

    apple_watch_extension_binary(name, deps, srcs, data, resources, hdrs, asset_catalogs, bundles, compatible_with, copts, datamodels, defines, deprecation, distribs, enable_modules, features, includes, licenses, linkopts, non_arc_srcs, non_propagated_deps, pch, restricted_to, runtime_deps, sdk_dylibs, sdk_frameworks, sdk_includes, storyboards, strings, structured_resources, tags, testonly, textual_hdrs, visibility, weak_sdk_frameworks, xibs)

    This rule is deprecated. Please use the new Apple build rules (https://github.com/bazelbuild/rules_apple) to build Apple targets.

    This rule produces a binary for watch extension by linking one or more Objective-C libraries.

    ${IMPLICIT_OUTPUTS}

    Arguments

    Attributes
    name

    Name; required

    A unique name for this rule.

    deps

    List of labels; optional

    The list of targets that are linked together to form the final bundle.
    srcs

    List of labels; optional

    The list of C, C++, Objective-C, and Objective-C++ source and header files that are processed to create the library target. These are your checked-in files, plus any generated files. Source files are compiled into .o files with Clang. Header files may be included/imported by any source or header in the srcs attribute of this target, but not by headers in hdrs or any targets that depend on this rule. Additionally, precompiled .o files may be given as srcs. Be careful to ensure consistency in the architecture of provided .o files and that of the build to avoid missing symbol linker errors.
    resources

    List of labels; optional

    Files to include in the final application bundle. They are not processed or compiled in any way besides the processing done by the rules that actually generate them. These files are placed in the root of the bundle (e.g. Payload/foo.app/...) in most cases. However, if they appear to be localized (i.e. are contained in a directory called *.lproj), they will be placed in a directory of the same name in the app bundle.
    hdrs

    List of labels; optional

    The list of C, C++, Objective-C, and Objective-C++ files that are included as headers by source files in this rule or by users of this library. These will be compiled separately from the source if modules are enabled.
    asset_catalogs

    List of labels; optional

    Files that comprise the asset catalogs of the final linked binary. Each file must have a containing directory named *.xcassets. This containing directory becomes the root of one of the asset catalogs linked with any binary that depends directly or indirectly on this target.
    bundles

    List of labels; optional

    The list of bundle targets that this target requires to be included in the final bundle.
    copts

    List of strings; optional

    Extra flags to pass to the compiler. Subject to "Make variable" substitution and Bourne shell tokenization. These flags will only apply to this target, and not those upon which it depends, or those which depend on it.

    Note that for the generated Xcode project, directory paths specified using "-I" flags in copts are parsed out, prepended with "$(WORKSPACE_ROOT)/" if they are relative paths, and added to the header search paths for the associated Xcode target.

    datamodels

    List of labels; optional

    Files that comprise the data models of the final linked binary. Each file must have a containing directory named *.xcdatamodel, which is usually contained by another *.xcdatamodeld (note the added d) directory.
    defines

    List of strings; optional

    Extra -D flags to pass to the compiler. They should be in the form KEY=VALUE or simply KEY and are passed not only to the compiler for this target (as copts are) but also to all objc_ dependers of this target. Subject to "Make variable" substitution and Bourne shell tokenization.
    enable_modules

    Boolean; optional; default is 0

    Enables clang module support (via -fmodules). Setting this to 1 will allow you to @import system headers and other targets: @import UIKit; @import path_to_package_target;
    includes

    List of strings; optional

    List of #include/#import search paths to add to this target and all depending targets. This is to support third party and open-sourced libraries that do not specify the entire workspace path in their #import/#include statements.

    The paths are interpreted relative to the package directory, and the genfiles and bin roots (e.g. bazel-genfiles/pkg/includedir and bazel-out/pkg/includedir) are included in addition to the actual client root.

    Unlike COPTS, these flags are added for this rule and every rule that depends on it. (Note: not the rules it depends upon!) Be very careful, since this may have far-reaching effects. When in doubt, add "-iquote" flags to COPTS instead.

    linkopts

    List of strings; optional

    Extra flags to pass to the linker.
    non_arc_srcs

    List of labels; optional

    The list of Objective-C files that are processed to create the library target that DO NOT use ARC. The files in this attribute are treated very similar to those in the srcs attribute, but are compiled without ARC enabled.
    non_propagated_deps

    List of labels; optional

    The list of targets that are required in order to build this target, but which are not included in the final bundle. This attribute should only rarely be used, and probably only for proto dependencies.
    pch

    Label; optional

    Header file to prepend to every source file being compiled (both arc and non-arc). Use of pch files is actively discouraged in BUILD files, and this should be considered deprecated. Since pch files are not actually precompiled this is not a build-speed enhancement, and instead is just a global dependency. From a build efficiency point of view you are actually better including what you need directly in your sources where you need it.
    runtime_deps

    List of labels; optional

    The list of framework targets that are late loaded at runtime. They are included in the app bundle but not linked against at build time.
    sdk_dylibs

    List of strings; optional

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

    List of strings; optional

    Names of SDK frameworks to link with. For instance, "XCTest" or "Cocoa". "UIKit" and "Foundation" are always included and do not mean anything if you include them.

    When linking a library, only those frameworks named in that library's sdk_frameworks attribute are linked in. When linking a binary, all SDK frameworks named in that binary's transitive dependency graph are used.

    sdk_includes

    List of strings; optional

    List of #include/#import search paths to add to this target and all depending targets, where each path is relative to $(SDKROOT)/usr/include.
    storyboards

    List of labels; optional

    Files which are .storyboard resources, possibly localizable. These files are compiled to .storyboardc directories, which are placed in the bundle root of the final package. If the storyboards's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable UI.
    strings

    List of labels; optional

    Files which are plists of strings, often localizable. These files are converted to binary plists (if they are not already) and placed in the bundle root of the final package. If this file's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable strings.
    structured_resources

    List of labels; optional

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

    Note that in the generated XCode project file, all files in the top directory of the specified files will be included in the Xcode-generated app bundle. So specifying ["res/foo.png"] will lead to the inclusion of all files in directory res.

    textual_hdrs

    List of labels; optional

    The list of C, C++, Objective-C, and Objective-C++ files that are included as headers by source files in this rule or by users of this library. Unlike hdrs, these will not be compiled separately from the sources.
    weak_sdk_frameworks

    List of strings; optional

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

    List of labels; optional

    Files which are .xib resources, possibly localizable. These files are compiled to .nib files and placed the bundle root of the final package. If this file's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable UI.

    ios_application

    ios_application(name, resources, app_icon, asset_catalogs, binary, bundle_id, bundles, compatible_with, datamodels, deprecation, distribs, entitlements, extensions, families, features, infoplist, infoplists, ipa_post_processor, launch_image, launch_storyboard, licenses, provisioning_profile, restricted_to, storyboards, strings, structured_resources, tags, testonly, visibility, xibs)

    This rule is deprecated. Please use the new Apple build rules (https://github.com/bazelbuild/rules_apple) to build Apple targets.

    This rule produces an application bundle for iOS.

    When running an iOS application using the run command, environment variables that are prefixed with IOS_ will be passed to the launched application, with the prefix stripped. For example, if you export IOS_ENV=foo, ENV=foo will be passed to the application.

    Implicit output targets

    • name.ipa: the application bundle as an .ipa file

    Arguments

    Attributes
    name

    Name; required

    A unique name for this rule.

    resources

    List of labels; optional

    Files to include in the final application bundle. They are not processed or compiled in any way besides the processing done by the rules that actually generate them. These files are placed in the root of the bundle (e.g. Payload/foo.app/...) in most cases. However, if they appear to be localized (i.e. are contained in a directory called *.lproj), they will be placed in a directory of the same name in the app bundle.
    app_icon

    String; optional

    The name of the application icon. The icon should be in one of the asset catalogs of this target or a (transitive) dependency. In a new project, this is initialized to "AppIcon" by Xcode.

    If the application icon is not in an asset catalog, do not use this attribute. Instead, add a CFBundleIcons entry to the Info.plist file.

    asset_catalogs

    List of labels; optional

    Files that comprise the asset catalogs of the final linked binary. Each file must have a containing directory named *.xcassets. This containing directory becomes the root of one of the asset catalogs linked with any binary that depends directly or indirectly on this target.
    binary

    Label; required

    The binary target included in the final bundle.
    bundle_id

    String; optional

    The bundle ID (reverse-DNS path followed by app name) of the binary. If specified, it will override the bundle ID specified in the associated plist file. If no bundle ID is specified on either this attribute or in the plist file, a junk value will be used.
    bundles

    List of labels; optional

    The list of bundle targets that this target requires to be included in the final bundle.
    datamodels

    List of labels; optional

    Files that comprise the data models of the final linked binary. Each file must have a containing directory named *.xcdatamodel, which is usually contained by another *.xcdatamodeld (note the added d) directory.
    entitlements

    Label; optional

    The entitlements file required for device builds of this application. See the apple documentation for more information. If absent, the default entitlements from the provisioning profile will be used.

    The following variables are substituted: $(CFBundleIdentifier) with the bundle id and $(AppIdentifierPrefix) with the value of the ApplicationIdentifierPrefix key from this target's provisioning profile (or the default provisioning profile, if none is specified).

    Bazel does not currently support adding entitlements to simulator builds. This means that if you rely on behavior which must be specified in entitlements (like App Groups) it will only work on a device. You can work around this by inlining the entitlements into your binary. e.g.

    
              #if TARGET_OS_SIMULATOR
              __asm(".section __TEXT,__entitlements");
              __asm(".ascii \""
              "<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\n"
              "<!DOCTYPE plist PUBLIC \\\"-//Apple//DTD PLIST 1.0//EN\\\" "
                  "\\\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\\\">"
               "<plist version=\\\"1.0\\\">"
              "<dict>"
              "<key>com.apple.security.application-groups</key>"
              "<array>"
              "<string>group.com.your.company</string>"
              "</array>"
              "</dict>"
              "</plist>"
              "\"
              #endif
            
    extensions

    List of labels; optional

    Any extensions to include in the final application.
    families

    List of strings; optional

    The device families to which this bundle or binary is targeted. This is known as the TARGETED_DEVICE_FAMILY build setting in Xcode project files. It is a list of one or more of the strings "iphone" and "ipad".

    By default this is set to "iphone", if explicitly specified may not be empty.

    infoplist

    Label; optional

    The infoplist file. This corresponds to appname-Info.plist in Xcode projects.

    Bazel will perform variable substitution on the plist file for the following values (if they are strings in the top-level dict of the plist):

    • ${EXECUTABLE_NAME}: The name of the executable generated and included in the bundle by bazel, which can be used as the value for CFBundleExecutable within the plist.
    • ${BUNDLE_NAME}: This target's name and bundle suffix (.bundle or .app) in the formname.suffix.
    • ${PRODUCT_NAME}: This target's name.

    The key in ${} may be suffixed with :rfc1034identifier (for example ${PRODUCT_NAME::rfc1034identifier}) in which case Bazel will replicate Xcode's behavior and replace non-RFC1034-compliant characters with -.

    infoplists

    List of labels; optional

    Infoplist files to be merged. The merged output corresponds to appname-Info.plist in Xcode projects. Duplicate keys between infoplist files will cause an error if and only if the values conflict. If both infoplist and infoplists are specified, the files defined in both attributes will be used.

    Bazel will perform variable substitution on the plist file for the following values (if they are strings in the top-level dict of the plist):

    • ${EXECUTABLE_NAME}: The name of the executable generated and included in the bundle by bazel, which can be used as the value for CFBundleExecutable within the plist.
    • ${BUNDLE_NAME}: This target's name and bundle suffix (.bundle or .app) in the formname.suffix.
    • ${PRODUCT_NAME}: This target's name.

    The key in ${} may be suffixed with :rfc1034identifier (for example ${PRODUCT_NAME::rfc1034identifier}) in which case Bazel will replicate Xcode's behavior and replace non-RFC1034-compliant characters with -.

    ipa_post_processor

    Label; optional

    A tool that edits this target's IPA output after it is assembled but before it is (optionally) signed.

    The tool is invoked with a single positional argument which represents the path to a directory containing the unzipped contents of the IPA. The only entry in this directory will be the Payload root directory of the IPA (for an ios_application) or the PlugIns root directory (for an ios_extension). Any changes made by the tool must be made in this directory, whose contents will be (optionally) signed and then zipped up as the final IPA after the tool terminates.

    The tool's execution must be hermetic given these inputs to ensure that its result can be safely cached.

    launch_image

    String; optional

    The name of the launch image. The icon should be in one of the asset catalogs of this target or a (transitive) dependency. In a new project, this is initialized to "LaunchImage" by Xcode.

    If the launch image is not in an asset catalog, do not use this attribute. Instead, add an appropriately-named image resource to the bundle.

    launch_storyboard

    Label; optional

    The location of the launch storyboard (.xib or .storyboard). The provided storyboard will be compiled to the appropriate format (.nib or .storyboardc respectively) and placed in the root of the final package. If the storyboard's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable UI.

    The generated storyboard is registered in the final bundle's Info.plist under the key UILaunchStoryboardName.

    provisioning_profile

    Label; optional

    The provisioning profile (.mobileprovision file) to use when bundling the application. This is only used for non-simulator builds.
    storyboards

    List of labels; optional

    Files which are .storyboard resources, possibly localizable. These files are compiled to .storyboardc directories, which are placed in the bundle root of the final package. If the storyboards's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable UI.
    strings

    List of labels; optional

    Files which are plists of strings, often localizable. These files are converted to binary plists (if they are not already) and placed in the bundle root of the final package. If this file's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable strings.
    structured_resources

    List of labels; optional

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

    Note that in the generated XCode project file, all files in the top directory of the specified files will be included in the Xcode-generated app bundle. So specifying ["res/foo.png"] will lead to the inclusion of all files in directory res.

    xibs

    List of labels; optional

    Files which are .xib resources, possibly localizable. These files are compiled to .nib files and placed the bundle root of the final package. If this file's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable UI.

    ios_device

    ios_device(name, compatible_with, deprecation, distribs, features, ios_version, licenses, restricted_to, tags, testonly, type, visibility, xcode)

    This rule defines an iOS device profile that defines a simulator against which to run tests.

    Arguments

    Attributes
    name

    Name; required

    A unique name for this rule.

    ios_version

    String; optional

    The operating system version of the device. This corresponds to the simctl runtime. Defaults to the default ios sdk version for the xcode version defined in the xcode attribute, or uses the ios sdk version configuration value, if xcode is unspecified.
    type

    String; required

    The hardware type. This corresponds to the simctl device type.
    xcode

    Label; optional

    The version of xcode to use to run the simulator. Defaults to the xcode version build configuration value.

    ios_extension

    ios_extension(name, resources, app_icon, asset_catalogs, binary, bundle_id, bundles, compatible_with, datamodels, deprecation, distribs, entitlements, families, features, infoplist, infoplists, ipa_post_processor, launch_image, launch_storyboard, licenses, provisioning_profile, restricted_to, storyboards, strings, structured_resources, tags, testonly, visibility, xibs)

    This rule is deprecated. Please use the new Apple build rules (https://github.com/bazelbuild/rules_apple) to build Apple targets.

    This rule produces a bundled binary for an iOS app extension from a compiled binary and bundle metadata.

    An iOS app extension is a nested bundle that is located inside the application bundle and is released with it. An iOS app extension cannot be released alone, although this rule allows you to build an .ipa with only the extension.

    Bundles generated by this rule use a bundle directory called PlugIns/target-name.appex, while an application bundle uses Payload/target-name.app. For instance, if an application call Foo has an app extension called Bar, the Bar extension bundle files will be stored in Payload/Foo.app/PlugIns/Bar.appex in the final application .ipa.

    There are many similarities between app extensions and applications with little to no difference between how each thing is processed:

    • both have entitlements and Info.plist files
    • both are code-signed. Signing and merging happens in this order: the extension is code-signed, bundles are merged, application is code-signed
    • both can have an app icon and launch image, and of course asset catalogs and all kinds of resources
    • both have linked binaries. The app extension binary is different in that it is linked with these additional flags:
      • -e _NSExtensionMain - sets the entry point to a standard function in the iOS runtime rather than main()
      • -fapplicationextension

    Implicit output targets

    • name.ipa: the extension bundle as an .ipa file

    Arguments

    Attributes
    name

    Name; required

    A unique name for this rule.

    resources

    List of labels; optional

    Files to include in the final application bundle. They are not processed or compiled in any way besides the processing done by the rules that actually generate them. These files are placed in the root of the bundle (e.g. Payload/foo.app/...) in most cases. However, if they appear to be localized (i.e. are contained in a directory called *.lproj), they will be placed in a directory of the same name in the app bundle.
    app_icon

    String; optional

    The name of the application icon. The icon should be in one of the asset catalogs of this target or a (transitive) dependency. In a new project, this is initialized to "AppIcon" by Xcode.

    If the application icon is not in an asset catalog, do not use this attribute. Instead, add a CFBundleIcons entry to the Info.plist file.

    asset_catalogs

    List of labels; optional

    Files that comprise the asset catalogs of the final linked binary. Each file must have a containing directory named *.xcassets. This containing directory becomes the root of one of the asset catalogs linked with any binary that depends directly or indirectly on this target.
    binary

    Label; required

    The binary target containing the logic for the extension.
    bundle_id

    String; optional

    The bundle ID (reverse-DNS path followed by app name) of the binary. If specified, it will override the bundle ID specified in the associated plist file. If no bundle ID is specified on either this attribute or in the plist file, a junk value will be used.
    bundles

    List of labels; optional

    The list of bundle targets that this target requires to be included in the final bundle.
    datamodels

    List of labels; optional

    Files that comprise the data models of the final linked binary. Each file must have a containing directory named *.xcdatamodel, which is usually contained by another *.xcdatamodeld (note the added d) directory.
    entitlements

    Label; optional

    The entitlements file required for device builds of this application. See the apple documentation for more information. If absent, the default entitlements from the provisioning profile will be used.

    The following variables are substituted: $(CFBundleIdentifier) with the bundle id and $(AppIdentifierPrefix) with the value of the ApplicationIdentifierPrefix key from this target's provisioning profile (or the default provisioning profile, if none is specified).

    Bazel does not currently support adding entitlements to simulator builds. This means that if you rely on behavior which must be specified in entitlements (like App Groups) it will only work on a device. You can work around this by inlining the entitlements into your binary. e.g.

    
              #if TARGET_OS_SIMULATOR
              __asm(".section __TEXT,__entitlements");
              __asm(".ascii \""
              "<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\n"
              "<!DOCTYPE plist PUBLIC \\\"-//Apple//DTD PLIST 1.0//EN\\\" "
                  "\\\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\\\">"
               "<plist version=\\\"1.0\\\">"
              "<dict>"
              "<key>com.apple.security.application-groups</key>"
              "<array>"
              "<string>group.com.your.company</string>"
              "</array>"
              "</dict>"
              "</plist>"
              "\"
              #endif
            
    families

    List of strings; optional

    The device families to which this bundle or binary is targeted. This is known as the TARGETED_DEVICE_FAMILY build setting in Xcode project files. It is a list of one or more of the strings "iphone" and "ipad".

    By default this is set to "iphone", if explicitly specified may not be empty.

    infoplist

    Label; optional

    The infoplist file. This corresponds to appname-Info.plist in Xcode projects.

    Bazel will perform variable substitution on the plist file for the following values (if they are strings in the top-level dict of the plist):

    • ${EXECUTABLE_NAME}: The name of the executable generated and included in the bundle by bazel, which can be used as the value for CFBundleExecutable within the plist.
    • ${BUNDLE_NAME}: This target's name and bundle suffix (.bundle or .app) in the formname.suffix.
    • ${PRODUCT_NAME}: This target's name.

    The key in ${} may be suffixed with :rfc1034identifier (for example ${PRODUCT_NAME::rfc1034identifier}) in which case Bazel will replicate Xcode's behavior and replace non-RFC1034-compliant characters with -.

    infoplists

    List of labels; optional

    Infoplist files to be merged. The merged output corresponds to appname-Info.plist in Xcode projects. Duplicate keys between infoplist files will cause an error if and only if the values conflict. If both infoplist and infoplists are specified, the files defined in both attributes will be used.

    Bazel will perform variable substitution on the plist file for the following values (if they are strings in the top-level dict of the plist):

    • ${EXECUTABLE_NAME}: The name of the executable generated and included in the bundle by bazel, which can be used as the value for CFBundleExecutable within the plist.
    • ${BUNDLE_NAME}: This target's name and bundle suffix (.bundle or .app) in the formname.suffix.
    • ${PRODUCT_NAME}: This target's name.

    The key in ${} may be suffixed with :rfc1034identifier (for example ${PRODUCT_NAME::rfc1034identifier}) in which case Bazel will replicate Xcode's behavior and replace non-RFC1034-compliant characters with -.

    ipa_post_processor

    Label; optional

    A tool that edits this target's IPA output after it is assembled but before it is (optionally) signed.

    The tool is invoked with a single positional argument which represents the path to a directory containing the unzipped contents of the IPA. The only entry in this directory will be the Payload root directory of the IPA (for an ios_application) or the PlugIns root directory (for an ios_extension). Any changes made by the tool must be made in this directory, whose contents will be (optionally) signed and then zipped up as the final IPA after the tool terminates.

    The tool's execution must be hermetic given these inputs to ensure that its result can be safely cached.

    launch_image

    String; optional

    The name of the launch image. The icon should be in one of the asset catalogs of this target or a (transitive) dependency. In a new project, this is initialized to "LaunchImage" by Xcode.

    If the launch image is not in an asset catalog, do not use this attribute. Instead, add an appropriately-named image resource to the bundle.

    launch_storyboard

    Label; optional

    The location of the launch storyboard (.xib or .storyboard). The provided storyboard will be compiled to the appropriate format (.nib or .storyboardc respectively) and placed in the root of the final package. If the storyboard's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable UI.

    The generated storyboard is registered in the final bundle's Info.plist under the key UILaunchStoryboardName.

    provisioning_profile

    Label; optional

    The provisioning profile (.mobileprovision file) to use when bundling the application. This is only used for non-simulator builds.
    storyboards

    List of labels; optional

    Files which are .storyboard resources, possibly localizable. These files are compiled to .storyboardc directories, which are placed in the bundle root of the final package. If the storyboards's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable UI.
    strings

    List of labels; optional

    Files which are plists of strings, often localizable. These files are converted to binary plists (if they are not already) and placed in the bundle root of the final package. If this file's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable strings.
    structured_resources

    List of labels; optional

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

    Note that in the generated XCode project file, all files in the top directory of the specified files will be included in the Xcode-generated app bundle. So specifying ["res/foo.png"] will lead to the inclusion of all files in directory res.

    xibs

    List of labels; optional

    Files which are .xib resources, possibly localizable. These files are compiled to .nib files and placed the bundle root of the final package. If this file's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable UI.

    ios_extension_binary

    ios_extension_binary(name, deps, srcs, data, resources, hdrs, asset_catalogs, bundles, compatible_with, copts, datamodels, defines, deprecation, distribs, enable_modules, features, includes, licenses, linkopts, non_arc_srcs, non_propagated_deps, pch, restricted_to, runtime_deps, sdk_dylibs, sdk_frameworks, sdk_includes, storyboards, strings, structured_resources, tags, testonly, textual_hdrs, visibility, weak_sdk_frameworks, xibs)

    This rule is deprecated. Please use the new Apple build rules (https://github.com/bazelbuild/rules_apple) to build Apple targets.

    This rule produces a binary for an iOS app extension by linking one or more Objective-C libraries.

    ${IMPLICIT_OUTPUTS}

    Arguments

    Attributes
    name

    Name; required

    A unique name for this rule.

    deps

    List of labels; optional

    The list of targets that are linked together to form the final bundle.
    srcs

    List of labels; optional

    The list of C, C++, Objective-C, and Objective-C++ source and header files that are processed to create the library target. These are your checked-in files, plus any generated files. Source files are compiled into .o files with Clang. Header files may be included/imported by any source or header in the srcs attribute of this target, but not by headers in hdrs or any targets that depend on this rule. Additionally, precompiled .o files may be given as srcs. Be careful to ensure consistency in the architecture of provided .o files and that of the build to avoid missing symbol linker errors.
    resources

    List of labels; optional

    Files to include in the final application bundle. They are not processed or compiled in any way besides the processing done by the rules that actually generate them. These files are placed in the root of the bundle (e.g. Payload/foo.app/...) in most cases. However, if they appear to be localized (i.e. are contained in a directory called *.lproj), they will be placed in a directory of the same name in the app bundle.
    hdrs

    List of labels; optional

    The list of C, C++, Objective-C, and Objective-C++ files that are included as headers by source files in this rule or by users of this library. These will be compiled separately from the source if modules are enabled.
    asset_catalogs

    List of labels; optional

    Files that comprise the asset catalogs of the final linked binary. Each file must have a containing directory named *.xcassets. This containing directory becomes the root of one of the asset catalogs linked with any binary that depends directly or indirectly on this target.
    bundles

    List of labels; optional

    The list of bundle targets that this target requires to be included in the final bundle.
    copts

    List of strings; optional

    Extra flags to pass to the compiler. Subject to "Make variable" substitution and Bourne shell tokenization. These flags will only apply to this target, and not those upon which it depends, or those which depend on it.

    Note that for the generated Xcode project, directory paths specified using "-I" flags in copts are parsed out, prepended with "$(WORKSPACE_ROOT)/" if they are relative paths, and added to the header search paths for the associated Xcode target.

    datamodels

    List of labels; optional

    Files that comprise the data models of the final linked binary. Each file must have a containing directory named *.xcdatamodel, which is usually contained by another *.xcdatamodeld (note the added d) directory.
    defines

    List of strings; optional

    Extra -D flags to pass to the compiler. They should be in the form KEY=VALUE or simply KEY and are passed not only to the compiler for this target (as copts are) but also to all objc_ dependers of this target. Subject to "Make variable" substitution and Bourne shell tokenization.
    enable_modules

    Boolean; optional; default is 0

    Enables clang module support (via -fmodules). Setting this to 1 will allow you to @import system headers and other targets: @import UIKit; @import path_to_package_target;
    includes

    List of strings; optional

    List of #include/#import search paths to add to this target and all depending targets. This is to support third party and open-sourced libraries that do not specify the entire workspace path in their #import/#include statements.

    The paths are interpreted relative to the package directory, and the genfiles and bin roots (e.g. bazel-genfiles/pkg/includedir and bazel-out/pkg/includedir) are included in addition to the actual client root.

    Unlike COPTS, these flags are added for this rule and every rule that depends on it. (Note: not the rules it depends upon!) Be very careful, since this may have far-reaching effects. When in doubt, add "-iquote" flags to COPTS instead.

    linkopts

    List of strings; optional

    Extra flags to pass to the linker.
    non_arc_srcs

    List of labels; optional

    The list of Objective-C files that are processed to create the library target that DO NOT use ARC. The files in this attribute are treated very similar to those in the srcs attribute, but are compiled without ARC enabled.
    non_propagated_deps

    List of labels; optional

    The list of targets that are required in order to build this target, but which are not included in the final bundle. This attribute should only rarely be used, and probably only for proto dependencies.
    pch

    Label; optional

    Header file to prepend to every source file being compiled (both arc and non-arc). Use of pch files is actively discouraged in BUILD files, and this should be considered deprecated. Since pch files are not actually precompiled this is not a build-speed enhancement, and instead is just a global dependency. From a build efficiency point of view you are actually better including what you need directly in your sources where you need it.
    runtime_deps

    List of labels; optional

    The list of framework targets that are late loaded at runtime. They are included in the app bundle but not linked against at build time.
    sdk_dylibs

    List of strings; optional

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

    List of strings; optional

    Names of SDK frameworks to link with. For instance, "XCTest" or "Cocoa". "UIKit" and "Foundation" are always included and do not mean anything if you include them.

    When linking a library, only those frameworks named in that library's sdk_frameworks attribute are linked in. When linking a binary, all SDK frameworks named in that binary's transitive dependency graph are used.

    sdk_includes

    List of strings; optional

    List of #include/#import search paths to add to this target and all depending targets, where each path is relative to $(SDKROOT)/usr/include.
    storyboards

    List of labels; optional

    Files which are .storyboard resources, possibly localizable. These files are compiled to .storyboardc directories, which are placed in the bundle root of the final package. If the storyboards's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable UI.
    strings

    List of labels; optional

    Files which are plists of strings, often localizable. These files are converted to binary plists (if they are not already) and placed in the bundle root of the final package. If this file's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable strings.
    structured_resources

    List of labels; optional

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

    Note that in the generated XCode project file, all files in the top directory of the specified files will be included in the Xcode-generated app bundle. So specifying ["res/foo.png"] will lead to the inclusion of all files in directory res.

    textual_hdrs

    List of labels; optional

    The list of C, C++, Objective-C, and Objective-C++ files that are included as headers by source files in this rule or by users of this library. Unlike hdrs, these will not be compiled separately from the sources.
    weak_sdk_frameworks

    List of strings; optional

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

    List of labels; optional

    Files which are .xib resources, possibly localizable. These files are compiled to .nib files and placed the bundle root of the final package. If this file's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable UI.

    ios_framework

    ios_framework(name, resources, hdrs, app_icon, asset_catalogs, binary, bundle_id, bundles, compatible_with, datamodels, deprecation, distribs, entitlements, families, features, infoplist, infoplists, launch_image, launch_storyboard, licenses, provisioning_profile, restricted_to, storyboards, strings, structured_resources, tags, testonly, visibility, xibs)

    This rule is deprecated. Please use the new Apple build rules (https://github.com/bazelbuild/rules_apple) to build Apple targets.

    This rule produces a bundled binary for a framework from a compiled binary and bundle metadata. It is still highly experimental and has significant outstanding issues.

    A framework is a bundle that contains a dynamic library (the "binary"), public headers (that clients of the framework can use) and any resources.

    Bundles generated by this rule use a bundle directory called Frameworks/framework_name.framework.

    Please be aware that in the current implementation, frameworks created by this rule can only be used during compilation and linking phase of the app with the intention of including the framework in the app bundle, not for standalone distribution.

    Due to this, when built as a direct target, the resulting bundle will not have headers, only the dynamic library.

    Please also be aware that this rule currently does not work for use in multi-architecture application builds (for instance, using the --ios_multi_cpus flag).

    Arguments

    Attributes
    name

    Name; required

    A unique name for this rule.

    resources

    List of labels; optional

    Files to include in the final application bundle. They are not processed or compiled in any way besides the processing done by the rules that actually generate them. These files are placed in the root of the bundle (e.g. Payload/foo.app/...) in most cases. However, if they appear to be localized (i.e. are contained in a directory called *.lproj), they will be placed in a directory of the same name in the app bundle.
    hdrs

    List of labels; optional

    Public headers to include in the framework bundle.
    app_icon

    String; optional

    The name of the application icon. The icon should be in one of the asset catalogs of this target or a (transitive) dependency. In a new project, this is initialized to "AppIcon" by Xcode.

    If the application icon is not in an asset catalog, do not use this attribute. Instead, add a CFBundleIcons entry to the Info.plist file.

    asset_catalogs

    List of labels; optional

    Files that comprise the asset catalogs of the final linked binary. Each file must have a containing directory named *.xcassets. This containing directory becomes the root of one of the asset catalogs linked with any binary that depends directly or indirectly on this target.
    binary

    Label; required

    The binary target included in the framework bundle.
    bundle_id

    String; optional

    The bundle ID (reverse-DNS path followed by app name) of the binary. If specified, it will override the bundle ID specified in the associated plist file. If no bundle ID is specified on either this attribute or in the plist file, a junk value will be used.
    bundles

    List of labels; optional

    The list of bundle targets that this target requires to be included in the final bundle.
    datamodels

    List of labels; optional

    Files that comprise the data models of the final linked binary. Each file must have a containing directory named *.xcdatamodel, which is usually contained by another *.xcdatamodeld (note the added d) directory.
    entitlements

    Label; optional

    The entitlements file required for device builds of this application. See the apple documentation for more information. If absent, the default entitlements from the provisioning profile will be used.

    The following variables are substituted: $(CFBundleIdentifier) with the bundle id and $(AppIdentifierPrefix) with the value of the ApplicationIdentifierPrefix key from this target's provisioning profile (or the default provisioning profile, if none is specified).

    Bazel does not currently support adding entitlements to simulator builds. This means that if you rely on behavior which must be specified in entitlements (like App Groups) it will only work on a device. You can work around this by inlining the entitlements into your binary. e.g.

    
              #if TARGET_OS_SIMULATOR
              __asm(".section __TEXT,__entitlements");
              __asm(".ascii \""
              "<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\n"
              "<!DOCTYPE plist PUBLIC \\\"-//Apple//DTD PLIST 1.0//EN\\\" "
                  "\\\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\\\">"
               "<plist version=\\\"1.0\\\">"
              "<dict>"
              "<key>com.apple.security.application-groups</key>"
              "<array>"
              "<string>group.com.your.company</string>"
              "</array>"
              "</dict>"
              "</plist>"
              "\"
              #endif
            
    families

    List of strings; optional

    The device families to which this bundle or binary is targeted. This is known as the TARGETED_DEVICE_FAMILY build setting in Xcode project files. It is a list of one or more of the strings "iphone" and "ipad".

    By default this is set to "iphone", if explicitly specified may not be empty.

    infoplist

    Label; optional

    The infoplist file. This corresponds to appname-Info.plist in Xcode projects.

    Bazel will perform variable substitution on the plist file for the following values (if they are strings in the top-level dict of the plist):

    • ${EXECUTABLE_NAME}: The name of the executable generated and included in the bundle by bazel, which can be used as the value for CFBundleExecutable within the plist.
    • ${BUNDLE_NAME}: This target's name and bundle suffix (.bundle or .app) in the formname.suffix.
    • ${PRODUCT_NAME}: This target's name.

    The key in ${} may be suffixed with :rfc1034identifier (for example ${PRODUCT_NAME::rfc1034identifier}) in which case Bazel will replicate Xcode's behavior and replace non-RFC1034-compliant characters with -.

    infoplists

    List of labels; optional

    Infoplist files to be merged. The merged output corresponds to appname-Info.plist in Xcode projects. Duplicate keys between infoplist files will cause an error if and only if the values conflict. If both infoplist and infoplists are specified, the files defined in both attributes will be used.

    Bazel will perform variable substitution on the plist file for the following values (if they are strings in the top-level dict of the plist):

    • ${EXECUTABLE_NAME}: The name of the executable generated and included in the bundle by bazel, which can be used as the value for CFBundleExecutable within the plist.
    • ${BUNDLE_NAME}: This target's name and bundle suffix (.bundle or .app) in the formname.suffix.
    • ${PRODUCT_NAME}: This target's name.

    The key in ${} may be suffixed with :rfc1034identifier (for example ${PRODUCT_NAME::rfc1034identifier}) in which case Bazel will replicate Xcode's behavior and replace non-RFC1034-compliant characters with -.

    launch_image

    String; optional

    The name of the launch image. The icon should be in one of the asset catalogs of this target or a (transitive) dependency. In a new project, this is initialized to "LaunchImage" by Xcode.

    If the launch image is not in an asset catalog, do not use this attribute. Instead, add an appropriately-named image resource to the bundle.

    launch_storyboard

    Label; optional

    The location of the launch storyboard (.xib or .storyboard). The provided storyboard will be compiled to the appropriate format (.nib or .storyboardc respectively) and placed in the root of the final package. If the storyboard's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable UI.

    The generated storyboard is registered in the final bundle's Info.plist under the key UILaunchStoryboardName.

    provisioning_profile

    Label; optional

    The provisioning profile (.mobileprovision file) to use when bundling the application. This is only used for non-simulator builds.
    storyboards

    List of labels; optional

    Files which are .storyboard resources, possibly localizable. These files are compiled to .storyboardc directories, which are placed in the bundle root of the final package. If the storyboards's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable UI.
    strings

    List of labels; optional

    Files which are plists of strings, often localizable. These files are converted to binary plists (if they are not already) and placed in the bundle root of the final package. If this file's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable strings.
    structured_resources

    List of labels; optional

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

    Note that in the generated XCode project file, all files in the top directory of the specified files will be included in the Xcode-generated app bundle. So specifying ["res/foo.png"] will lead to the inclusion of all files in directory res.

    xibs

    List of labels; optional

    Files which are .xib resources, possibly localizable. These files are compiled to .nib files and placed the bundle root of the final package. If this file's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable UI.

    ios_framework_binary

    ios_framework_binary(name, deps, srcs, data, resources, hdrs, asset_catalogs, bundles, compatible_with, copts, datamodels, defines, deprecation, distribs, enable_modules, features, includes, licenses, linkopts, non_arc_srcs, non_propagated_deps, pch, restricted_to, runtime_deps, sdk_dylibs, sdk_frameworks, sdk_includes, storyboards, strings, structured_resources, tags, testonly, textual_hdrs, visibility, weak_sdk_frameworks, xibs)

    This rule is deprecated. Please use the new Apple build rules (https://github.com/bazelbuild/rules_apple) to build Apple targets.

    This rule produces a dynamic library for a framework by linking one or more Objective-C libraries.

    ${IMPLICIT_OUTPUTS}

    Arguments

    Attributes
    name

    Name; required

    A unique name for this rule.

    deps

    List of labels; optional

    The list of targets that are linked together to form the final bundle.
    srcs

    List of labels; optional

    The list of C, C++, Objective-C, and Objective-C++ source and header files that are processed to create the library target. These are your checked-in files, plus any generated files. Source files are compiled into .o files with Clang. Header files may be included/imported by any source or header in the srcs attribute of this target, but not by headers in hdrs or any targets that depend on this rule. Additionally, precompiled .o files may be given as srcs. Be careful to ensure consistency in the architecture of provided .o files and that of the build to avoid missing symbol linker errors.
    resources

    List of labels; optional

    Files to include in the final application bundle. They are not processed or compiled in any way besides the processing done by the rules that actually generate them. These files are placed in the root of the bundle (e.g. Payload/foo.app/...) in most cases. However, if they appear to be localized (i.e. are contained in a directory called *.lproj), they will be placed in a directory of the same name in the app bundle.
    hdrs

    List of labels; optional

    The list of C, C++, Objective-C, and Objective-C++ files that are included as headers by source files in this rule or by users of this library. These will be compiled separately from the source if modules are enabled.
    asset_catalogs

    List of labels; optional

    Files that comprise the asset catalogs of the final linked binary. Each file must have a containing directory named *.xcassets. This containing directory becomes the root of one of the asset catalogs linked with any binary that depends directly or indirectly on this target.
    bundles

    List of labels; optional

    The list of bundle targets that this target requires to be included in the final bundle.
    copts

    List of strings; optional

    Extra flags to pass to the compiler. Subject to "Make variable" substitution and Bourne shell tokenization. These flags will only apply to this target, and not those upon which it depends, or those which depend on it.

    Note that for the generated Xcode project, directory paths specified using "-I" flags in copts are parsed out, prepended with "$(WORKSPACE_ROOT)/" if they are relative paths, and added to the header search paths for the associated Xcode target.

    datamodels

    List of labels; optional

    Files that comprise the data models of the final linked binary. Each file must have a containing directory named *.xcdatamodel, which is usually contained by another *.xcdatamodeld (note the added d) directory.
    defines

    List of strings; optional

    Extra -D flags to pass to the compiler. They should be in the form KEY=VALUE or simply KEY and are passed not only to the compiler for this target (as copts are) but also to all objc_ dependers of this target. Subject to "Make variable" substitution and Bourne shell tokenization.
    enable_modules

    Boolean; optional; default is 0

    Enables clang module support (via -fmodules). Setting this to 1 will allow you to @import system headers and other targets: @import UIKit; @import path_to_package_target;
    includes

    List of strings; optional

    List of #include/#import search paths to add to this target and all depending targets. This is to support third party and open-sourced libraries that do not specify the entire workspace path in their #import/#include statements.

    The paths are interpreted relative to the package directory, and the genfiles and bin roots (e.g. bazel-genfiles/pkg/includedir and bazel-out/pkg/includedir) are included in addition to the actual client root.

    Unlike COPTS, these flags are added for this rule and every rule that depends on it. (Note: not the rules it depends upon!) Be very careful, since this may have far-reaching effects. When in doubt, add "-iquote" flags to COPTS instead.

    linkopts

    List of strings; optional

    Extra flags to pass to the linker.
    non_arc_srcs

    List of labels; optional

    The list of Objective-C files that are processed to create the library target that DO NOT use ARC. The files in this attribute are treated very similar to those in the srcs attribute, but are compiled without ARC enabled.
    non_propagated_deps

    List of labels; optional

    The list of targets that are required in order to build this target, but which are not included in the final bundle. This attribute should only rarely be used, and probably only for proto dependencies.
    pch

    Label; optional

    Header file to prepend to every source file being compiled (both arc and non-arc). Use of pch files is actively discouraged in BUILD files, and this should be considered deprecated. Since pch files are not actually precompiled this is not a build-speed enhancement, and instead is just a global dependency. From a build efficiency point of view you are actually better including what you need directly in your sources where you need it.
    runtime_deps

    List of labels; optional

    The list of framework targets that are late loaded at runtime. They are included in the app bundle but not linked against at build time.
    sdk_dylibs

    List of strings; optional

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

    List of strings; optional

    Names of SDK frameworks to link with. For instance, "XCTest" or "Cocoa". "UIKit" and "Foundation" are always included and do not mean anything if you include them.

    When linking a library, only those frameworks named in that library's sdk_frameworks attribute are linked in. When linking a binary, all SDK frameworks named in that binary's transitive dependency graph are used.

    sdk_includes

    List of strings; optional

    List of #include/#import search paths to add to this target and all depending targets, where each path is relative to $(SDKROOT)/usr/include.
    storyboards

    List of labels; optional

    Files which are .storyboard resources, possibly localizable. These files are compiled to .storyboardc directories, which are placed in the bundle root of the final package. If the storyboards's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable UI.
    strings

    List of labels; optional

    Files which are plists of strings, often localizable. These files are converted to binary plists (if they are not already) and placed in the bundle root of the final package. If this file's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable strings.
    structured_resources

    List of labels; optional

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

    Note that in the generated XCode project file, all files in the top directory of the specified files will be included in the Xcode-generated app bundle. So specifying ["res/foo.png"] will lead to the inclusion of all files in directory res.

    textual_hdrs

    List of labels; optional

    The list of C, C++, Objective-C, and Objective-C++ files that are included as headers by source files in this rule or by users of this library. Unlike hdrs, these will not be compiled separately from the sources.
    weak_sdk_frameworks

    List of strings; optional

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

    List of labels; optional

    Files which are .xib resources, possibly localizable. These files are compiled to .nib files and placed the bundle root of the final package. If this file's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable UI.

    objc_binary

    objc_binary(name, deps, srcs, data, resources, hdrs, app_icon, asset_catalogs, bundle_id, bundles, compatible_with, copts, datamodels, defines, deprecation, distribs, enable_modules, entitlements, families, features, includes, infoplist, infoplists, launch_image, launch_storyboard, licenses, linkopts, non_arc_srcs, non_propagated_deps, pch, provisioning_profile, restricted_to, runtime_deps, sdk_dylibs, sdk_frameworks, sdk_includes, storyboards, strings, structured_resources, tags, testonly, textual_hdrs, visibility, weak_sdk_frameworks, xibs)

    This rule is deprecated. Please use the new Apple build rules (https://github.com/bazelbuild/rules_apple) to build Apple targets.

    This rule produces one or more Objective-C libraries for bundling in an ios_application.

    Any application-related attributes (infoplist, app_icon, resources, xibs, datamodels...) on this rule are deprecated and you should define them on ios_application instead. They will be removed from objc_binary soon.

    Until the migration to ios_application is complete, this rule requires at least one source file to be defined in either srcs or non_arc_srcs

    .

    Implicit output targets

    • name.ipa: the application bundle as an .ipa file

    Arguments

    Attributes
    name

    Name; required

    A unique name for this rule.

    deps

    List of labels; optional

    The list of targets that are linked together to form the final bundle.
    srcs

    List of labels; optional

    The list of C, C++, Objective-C, and Objective-C++ source and header files that are processed to create the library target. These are your checked-in files, plus any generated files. Source files are compiled into .o files with Clang. Header files may be included/imported by any source or header in the srcs attribute of this target, but not by headers in hdrs or any targets that depend on this rule. Additionally, precompiled .o files may be given as srcs. Be careful to ensure consistency in the architecture of provided .o files and that of the build to avoid missing symbol linker errors.
    resources

    List of labels; optional

    Files to include in the final application bundle. They are not processed or compiled in any way besides the processing done by the rules that actually generate them. These files are placed in the root of the bundle (e.g. Payload/foo.app/...) in most cases. However, if they appear to be localized (i.e. are contained in a directory called *.lproj), they will be placed in a directory of the same name in the app bundle.
    hdrs

    List of labels; optional

    The list of C, C++, Objective-C, and Objective-C++ files that are included as headers by source files in this rule or by users of this library. These will be compiled separately from the source if modules are enabled.
    app_icon

    String; optional

    The name of the application icon. The icon should be in one of the asset catalogs of this target or a (transitive) dependency. In a new project, this is initialized to "AppIcon" by Xcode.

    If the application icon is not in an asset catalog, do not use this attribute. Instead, add a CFBundleIcons entry to the Info.plist file.

    asset_catalogs

    List of labels; optional

    Files that comprise the asset catalogs of the final linked binary. Each file must have a containing directory named *.xcassets. This containing directory becomes the root of one of the asset catalogs linked with any binary that depends directly or indirectly on this target.
    bundle_id

    String; optional

    The bundle ID (reverse-DNS path followed by app name) of the binary. If specified, it will override the bundle ID specified in the associated plist file. If no bundle ID is specified on either this attribute or in the plist file, a junk value will be used.
    bundles

    List of labels; optional

    The list of bundle targets that this target requires to be included in the final bundle.
    copts

    List of strings; optional

    Extra flags to pass to the compiler. Subject to "Make variable" substitution and Bourne shell tokenization. These flags will only apply to this target, and not those upon which it depends, or those which depend on it.

    Note that for the generated Xcode project, directory paths specified using "-I" flags in copts are parsed out, prepended with "$(WORKSPACE_ROOT)/" if they are relative paths, and added to the header search paths for the associated Xcode target.

    datamodels

    List of labels; optional

    Files that comprise the data models of the final linked binary. Each file must have a containing directory named *.xcdatamodel, which is usually contained by another *.xcdatamodeld (note the added d) directory.
    defines

    List of strings; optional

    Extra -D flags to pass to the compiler. They should be in the form KEY=VALUE or simply KEY and are passed not only to the compiler for this target (as copts are) but also to all objc_ dependers of this target. Subject to "Make variable" substitution and Bourne shell tokenization.
    enable_modules

    Boolean; optional; default is 0

    Enables clang module support (via -fmodules). Setting this to 1 will allow you to @import system headers and other targets: @import UIKit; @import path_to_package_target;
    entitlements

    Label; optional

    The entitlements file required for device builds of this application. See the apple documentation for more information. If absent, the default entitlements from the provisioning profile will be used.

    The following variables are substituted: $(CFBundleIdentifier) with the bundle id and $(AppIdentifierPrefix) with the value of the ApplicationIdentifierPrefix key from this target's provisioning profile (or the default provisioning profile, if none is specified).

    Bazel does not currently support adding entitlements to simulator builds. This means that if you rely on behavior which must be specified in entitlements (like App Groups) it will only work on a device. You can work around this by inlining the entitlements into your binary. e.g.

    
              #if TARGET_OS_SIMULATOR
              __asm(".section __TEXT,__entitlements");
              __asm(".ascii \""
              "<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\n"
              "<!DOCTYPE plist PUBLIC \\\"-//Apple//DTD PLIST 1.0//EN\\\" "
                  "\\\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\\\">"
               "<plist version=\\\"1.0\\\">"
              "<dict>"
              "<key>com.apple.security.application-groups</key>"
              "<array>"
              "<string>group.com.your.company</string>"
              "</array>"
              "</dict>"
              "</plist>"
              "\"
              #endif
            
    families

    List of strings; optional

    The device families to which this bundle or binary is targeted. This is known as the TARGETED_DEVICE_FAMILY build setting in Xcode project files. It is a list of one or more of the strings "iphone" and "ipad".

    By default this is set to "iphone", if explicitly specified may not be empty.

    includes

    List of strings; optional

    List of #include/#import search paths to add to this target and all depending targets. This is to support third party and open-sourced libraries that do not specify the entire workspace path in their #import/#include statements.

    The paths are interpreted relative to the package directory, and the genfiles and bin roots (e.g. bazel-genfiles/pkg/includedir and bazel-out/pkg/includedir) are included in addition to the actual client root.

    Unlike COPTS, these flags are added for this rule and every rule that depends on it. (Note: not the rules it depends upon!) Be very careful, since this may have far-reaching effects. When in doubt, add "-iquote" flags to COPTS instead.

    infoplist

    Label; optional

    The infoplist file. This corresponds to appname-Info.plist in Xcode projects.

    Bazel will perform variable substitution on the plist file for the following values (if they are strings in the top-level dict of the plist):

    • ${EXECUTABLE_NAME}: The name of the executable generated and included in the bundle by bazel, which can be used as the value for CFBundleExecutable within the plist.
    • ${BUNDLE_NAME}: This target's name and bundle suffix (.bundle or .app) in the formname.suffix.
    • ${PRODUCT_NAME}: This target's name.

    The key in ${} may be suffixed with :rfc1034identifier (for example ${PRODUCT_NAME::rfc1034identifier}) in which case Bazel will replicate Xcode's behavior and replace non-RFC1034-compliant characters with -.

    infoplists

    List of labels; optional

    Infoplist files to be merged. The merged output corresponds to appname-Info.plist in Xcode projects. Duplicate keys between infoplist files will cause an error if and only if the values conflict. If both infoplist and infoplists are specified, the files defined in both attributes will be used.

    Bazel will perform variable substitution on the plist file for the following values (if they are strings in the top-level dict of the plist):

    • ${EXECUTABLE_NAME}: The name of the executable generated and included in the bundle by bazel, which can be used as the value for CFBundleExecutable within the plist.
    • ${BUNDLE_NAME}: This target's name and bundle suffix (.bundle or .app) in the formname.suffix.
    • ${PRODUCT_NAME}: This target's name.

    The key in ${} may be suffixed with :rfc1034identifier (for example ${PRODUCT_NAME::rfc1034identifier}) in which case Bazel will replicate Xcode's behavior and replace non-RFC1034-compliant characters with -.

    launch_image

    String; optional

    The name of the launch image. The icon should be in one of the asset catalogs of this target or a (transitive) dependency. In a new project, this is initialized to "LaunchImage" by Xcode.

    If the launch image is not in an asset catalog, do not use this attribute. Instead, add an appropriately-named image resource to the bundle.

    launch_storyboard

    Label; optional

    The location of the launch storyboard (.xib or .storyboard). The provided storyboard will be compiled to the appropriate format (.nib or .storyboardc respectively) and placed in the root of the final package. If the storyboard's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable UI.

    The generated storyboard is registered in the final bundle's Info.plist under the key UILaunchStoryboardName.

    linkopts

    List of strings; optional

    Extra flags to pass to the linker.
    non_arc_srcs

    List of labels; optional

    The list of Objective-C files that are processed to create the library target that DO NOT use ARC. The files in this attribute are treated very similar to those in the srcs attribute, but are compiled without ARC enabled.
    non_propagated_deps

    List of labels; optional

    The list of targets that are required in order to build this target, but which are not included in the final bundle. This attribute should only rarely be used, and probably only for proto dependencies.
    pch

    Label; optional

    Header file to prepend to every source file being compiled (both arc and non-arc). Use of pch files is actively discouraged in BUILD files, and this should be considered deprecated. Since pch files are not actually precompiled this is not a build-speed enhancement, and instead is just a global dependency. From a build efficiency point of view you are actually better including what you need directly in your sources where you need it.
    provisioning_profile

    Label; optional

    The provisioning profile (.mobileprovision file) to use when bundling the application. This is only used for non-simulator builds.
    runtime_deps

    List of labels; optional

    The list of framework targets that are late loaded at runtime. They are included in the app bundle but not linked against at build time.
    sdk_dylibs

    List of strings; optional

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

    List of strings; optional

    Names of SDK frameworks to link with. For instance, "XCTest" or "Cocoa". "UIKit" and "Foundation" are always included and do not mean anything if you include them.

    When linking a library, only those frameworks named in that library's sdk_frameworks attribute are linked in. When linking a binary, all SDK frameworks named in that binary's transitive dependency graph are used.

    sdk_includes

    List of strings; optional

    List of #include/#import search paths to add to this target and all depending targets, where each path is relative to $(SDKROOT)/usr/include.
    storyboards

    List of labels; optional

    Files which are .storyboard resources, possibly localizable. These files are compiled to .storyboardc directories, which are placed in the bundle root of the final package. If the storyboards's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable UI.
    strings

    List of labels; optional

    Files which are plists of strings, often localizable. These files are converted to binary plists (if they are not already) and placed in the bundle root of the final package. If this file's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable strings.
    structured_resources

    List of labels; optional

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

    Note that in the generated XCode project file, all files in the top directory of the specified files will be included in the Xcode-generated app bundle. So specifying ["res/foo.png"] will lead to the inclusion of all files in directory res.

    textual_hdrs

    List of labels; optional

    The list of C, C++, Objective-C, and Objective-C++ files that are included as headers by source files in this rule or by users of this library. Unlike hdrs, these will not be compiled separately from the sources.
    weak_sdk_frameworks

    List of strings; optional

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

    List of labels; optional

    Files which are .xib resources, possibly localizable. These files are compiled to .nib files and placed the bundle root of the final package. If this file's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable UI.

    j2objc_library

    j2objc_library(name, deps, compatible_with, deprecation, distribs, entry_classes, features, jre_deps, licenses, restricted_to, tags, testonly, visibility)

    This rule uses J2ObjC to translate Java source files to Objective-C, which then can be used used as dependencies of objc_library and objc_binary rules. Detailed information about J2ObjC itself can be found at the J2ObjC site

    Custom J2ObjC transpilation flags can be specified using the build flag --j2objc_translation_flags in the command line.

    Please note that the translated files included in a j2objc_library target will be compiled using the default compilation configuration, the same configuration as for the sources of an objc_library rule with no compilation options specified in attributes.

    Plus, generated code is de-duplicated at target level, not source level. If you have two different Java targets that include the same Java source files, you may see a duplicate symbol error at link time. The correct way to resolve this issue is to move the shared Java source files into a separate common target that can be depended upon.

    Arguments

    Attributes
    name

    Name; required

    A unique name for this rule.

    deps

    List of labels; optional

    A list of j2objc_library, java_library and java_import targets that contain Java files to be transpiled to Objective-C.

    All java_library and java_import targets that can be reached transitively through exports, deps and runtime_deps will be translated and compiled. Currently there is no support for files generated by Java annotation processing or java_import targets with no srcjar specified.

    The J2ObjC translation works differently depending on the type of source Java source files included in the transitive closure. For each .java source files included in srcs of java_library, a corresponding .h and .m source file will be generated. For each source jar included in srcs of java_library or srcjar of java_import, a corresponding .h and .m source file will be generated with all the code for that jar.

    Users can import the J2ObjC-generated header files in their code. The import paths for these files are the root-relative path of the original Java artifacts. For example, //some/package/foo.java has an import path of some/package/foo.h and //some/package/bar.srcjar has some/package/bar.h

    If proto_library rules are in the transitive closure of this rule, J2ObjC protos will also be generated, compiled and linked-in at the binary level. For proto //some/proto/foo.proto, users can reference the generated code using import path some/proto/foo.j2objc.pb.h.

    entry_classes

    List of strings; optional

    The list of Java classes whose translated ObjC counterparts will be referenced directly by user ObjC code. This attibute is required if flag --j2objc_dead_code_removal is on. The Java classes should be specified in their canonical names as defined by the Java Language Specification. When flag --j2objc_dead_code_removal is specified, the list of entry classes will be collected transitively and used as entry points to perform dead code analysis. Unused classes will then be removed from the final ObjC app bundle.
    jre_deps

    List of labels; optional

    The list of additional JRE emulation libraries required by all Java code translated by this j2objc_library rule. Only core JRE functionality is linked by default.

    objc_bundle

    objc_bundle(name, bundle_imports, compatible_with, deprecation, distribs, features, licenses, restricted_to, tags, testonly, visibility)

    This rule encapsulates an already-built bundle. It is defined by a list of files in one or more .bundle directories.

    Arguments

    Attributes
    name

    Name; required

    A unique name for this rule.

    bundle_imports

    List of labels; optional

    The list of files under a .bundle directory which are provided to Objective-C targets that depend on this target.

    objc_bundle_library

    objc_bundle_library(name, resources, asset_catalogs, bundles, compatible_with, datamodels, deprecation, distribs, families, features, infoplist, infoplists, licenses, restricted_to, storyboards, strings, structured_resources, tags, testonly, visibility, xibs)

    This rule encapsulates a library which is provided to dependers as a bundle. A objc_bundle_library's resources are put in a nested bundle in the final iOS application.

    Arguments

    Attributes
    name

    Name; required

    A unique name for this rule.

    resources

    List of labels; optional

    Files to include in the final application bundle. They are not processed or compiled in any way besides the processing done by the rules that actually generate them. These files are placed in the root of the bundle (e.g. Payload/foo.app/...) in most cases. However, if they appear to be localized (i.e. are contained in a directory called *.lproj), they will be placed in a directory of the same name in the app bundle.
    asset_catalogs

    List of labels; optional

    Files that comprise the asset catalogs of the final linked binary. Each file must have a containing directory named *.xcassets. This containing directory becomes the root of one of the asset catalogs linked with any binary that depends directly or indirectly on this target.
    bundles

    List of labels; optional

    The list of bundle targets that this target requires to be included in the final bundle.
    datamodels

    List of labels; optional

    Files that comprise the data models of the final linked binary. Each file must have a containing directory named *.xcdatamodel, which is usually contained by another *.xcdatamodeld (note the added d) directory.
    families

    List of strings; optional

    The device families to which this bundle or binary is targeted. This is known as the TARGETED_DEVICE_FAMILY build setting in Xcode project files. It is a list of one or more of the strings "iphone" and "ipad".

    By default this is set to "iphone", if explicitly specified may not be empty.

    infoplist

    Label; optional

    The infoplist file. This corresponds to appname-Info.plist in Xcode projects.

    Bazel will perform variable substitution on the plist file for the following values (if they are strings in the top-level dict of the plist):

    • ${EXECUTABLE_NAME}: The name of the executable generated and included in the bundle by bazel, which can be used as the value for CFBundleExecutable within the plist.
    • ${BUNDLE_NAME}: This target's name and bundle suffix (.bundle or .app) in the formname.suffix.
    • ${PRODUCT_NAME}: This target's name.

    The key in ${} may be suffixed with :rfc1034identifier (for example ${PRODUCT_NAME::rfc1034identifier}) in which case Bazel will replicate Xcode's behavior and replace non-RFC1034-compliant characters with -.

    infoplists

    List of labels; optional

    Infoplist files to be merged. The merged output corresponds to appname-Info.plist in Xcode projects. Duplicate keys between infoplist files will cause an error if and only if the values conflict. If both infoplist and infoplists are specified, the files defined in both attributes will be used.

    Bazel will perform variable substitution on the plist file for the following values (if they are strings in the top-level dict of the plist):

    • ${EXECUTABLE_NAME}: The name of the executable generated and included in the bundle by bazel, which can be used as the value for CFBundleExecutable within the plist.
    • ${BUNDLE_NAME}: This target's name and bundle suffix (.bundle or .app) in the formname.suffix.
    • ${PRODUCT_NAME}: This target's name.

    The key in ${} may be suffixed with :rfc1034identifier (for example ${PRODUCT_NAME::rfc1034identifier}) in which case Bazel will replicate Xcode's behavior and replace non-RFC1034-compliant characters with -.

    storyboards

    List of labels; optional

    Files which are .storyboard resources, possibly localizable. These files are compiled to .storyboardc directories, which are placed in the bundle root of the final package. If the storyboards's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable UI.
    strings

    List of labels; optional

    Files which are plists of strings, often localizable. These files are converted to binary plists (if they are not already) and placed in the bundle root of the final package. If this file's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable strings.
    structured_resources

    List of labels; optional

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

    Note that in the generated XCode project file, all files in the top directory of the specified files will be included in the Xcode-generated app bundle. So specifying ["res/foo.png"] will lead to the inclusion of all files in directory res.

    xibs

    List of labels; optional

    Files which are .xib resources, possibly localizable. These files are compiled to .nib files and placed the bundle root of the final package. If this file's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable UI.

    objc_framework

    objc_framework(name, compatible_with, deprecation, distribs, features, framework_imports, is_dynamic, licenses, restricted_to, sdk_dylibs, sdk_frameworks, tags, testonly, visibility, weak_sdk_frameworks)

    This rule encapsulates an already-built framework. It is defined by a list of files in one or more .framework directories.

    Arguments

    Attributes
    name

    Name; required

    A unique name for this rule.

    framework_imports

    List of labels; required

    The list of files under a .framework directory which are provided to Objective-C targets that depend on this target.
    is_dynamic

    Boolean; optional; default is 0

    Indicates whether this framework is linked dynamically. If this attribute is set, the framework will be copied into the final application bundle.
    sdk_dylibs

    List of strings; optional

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

    List of strings; optional

    Names of SDK frameworks to link with. For instance, "XCTest" or "Cocoa". "UIKit" and "Foundation" are always included and do not mean anything if you include them.

    When linking a library, only those frameworks named in that library's sdk_frameworks attribute are linked in. When linking a binary, all SDK frameworks named in that binary's transitive dependency graph are used.

    weak_sdk_frameworks

    List of strings; optional

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

    objc_import

    objc_import(name, resources, hdrs, alwayslink, archives, asset_catalogs, bundles, compatible_with, datamodels, deprecation, distribs, features, includes, licenses, restricted_to, sdk_dylibs, sdk_frameworks, sdk_includes, storyboards, strings, structured_resources, tags, testonly, textual_hdrs, visibility, weak_sdk_frameworks, xibs)

    This rule encapsulates an already-compiled static library in the form of an .a file. It also allows exporting headers and resources using the same attributes supported by objc_library.

    Arguments

    Attributes
    name

    Name; required

    A unique name for this rule.

    resources

    List of labels; optional

    Files to include in the final application bundle. They are not processed or compiled in any way besides the processing done by the rules that actually generate them. These files are placed in the root of the bundle (e.g. Payload/foo.app/...) in most cases. However, if they appear to be localized (i.e. are contained in a directory called *.lproj), they will be placed in a directory of the same name in the app bundle.
    hdrs

    List of labels; optional

    The list of C, C++, Objective-C, and Objective-C++ files that are included as headers by source files in this rule or by users of this library. These will be compiled separately from the source if modules are enabled.

    Boolean; optional; default is 0

    If 1, any bundle or binary that depends (directly or indirectly) on this library will link in all the object files for the files listed in srcs and non_arc_srcs, even if some contain no symbols referenced by the binary. This is useful if your code isn't explicitly called by code in the binary, e.g., if your code registers to receive some callback provided by some service.
    archives

    List of labels; required

    The list of .a files provided to Objective-C targets that depend on this target.
    asset_catalogs

    List of labels; optional

    Files that comprise the asset catalogs of the final linked binary. Each file must have a containing directory named *.xcassets. This containing directory becomes the root of one of the asset catalogs linked with any binary that depends directly or indirectly on this target.
    bundles

    List of labels; optional

    The list of bundle targets that this target requires to be included in the final bundle.
    datamodels

    List of labels; optional

    Files that comprise the data models of the final linked binary. Each file must have a containing directory named *.xcdatamodel, which is usually contained by another *.xcdatamodeld (note the added d) directory.
    includes

    List of strings; optional

    List of #include/#import search paths to add to this target and all depending targets. This is to support third party and open-sourced libraries that do not specify the entire workspace path in their #import/#include statements.

    The paths are interpreted relative to the package directory, and the genfiles and bin roots (e.g. bazel-genfiles/pkg/includedir and bazel-out/pkg/includedir) are included in addition to the actual client root.

    Unlike COPTS, these flags are added for this rule and every rule that depends on it. (Note: not the rules it depends upon!) Be very careful, since this may have far-reaching effects. When in doubt, add "-iquote" flags to COPTS instead.

    sdk_dylibs

    List of strings; optional

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

    List of strings; optional

    Names of SDK frameworks to link with. For instance, "XCTest" or "Cocoa". "UIKit" and "Foundation" are always included and do not mean anything if you include them.

    When linking a library, only those frameworks named in that library's sdk_frameworks attribute are linked in. When linking a binary, all SDK frameworks named in that binary's transitive dependency graph are used.

    sdk_includes

    List of strings; optional

    List of #include/#import search paths to add to this target and all depending targets, where each path is relative to $(SDKROOT)/usr/include.
    storyboards

    List of labels; optional

    Files which are .storyboard resources, possibly localizable. These files are compiled to .storyboardc directories, which are placed in the bundle root of the final package. If the storyboards's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable UI.
    strings

    List of labels; optional

    Files which are plists of strings, often localizable. These files are converted to binary plists (if they are not already) and placed in the bundle root of the final package. If this file's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable strings.
    structured_resources

    List of labels; optional

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

    Note that in the generated XCode project file, all files in the top directory of the specified files will be included in the Xcode-generated app bundle. So specifying ["res/foo.png"] will lead to the inclusion of all files in directory res.

    textual_hdrs

    List of labels; optional

    The list of C, C++, Objective-C, and Objective-C++ files that are included as headers by source files in this rule or by users of this library. Unlike hdrs, these will not be compiled separately from the sources.
    weak_sdk_frameworks

    List of strings; optional

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

    List of labels; optional

    Files which are .xib resources, possibly localizable. These files are compiled to .nib files and placed the bundle root of the final package. If this file's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable UI.

    objc_library

    objc_library(name, deps, srcs, data, resources, hdrs, alwayslink, asset_catalogs, bundles, compatible_with, copts, datamodels, defines, deprecation, distribs, enable_modules, features, includes, licenses, non_arc_srcs, non_propagated_deps, pch, restricted_to, runtime_deps, sdk_dylibs, sdk_frameworks, sdk_includes, storyboards, strings, structured_resources, tags, testonly, textual_hdrs, visibility, weak_sdk_frameworks, xibs)

    This rule produces a static library from the given Objective-C source files.

    Implicit output targets

    • name.xcodeproj/project.pbxproj: An Xcode project file which can be used to develop or build on a Mac.
    • name_fully_linked.a: A fully linked static library that contains the full transitive closure of library dependencies.

    Arguments

    Attributes
    name

    Name; required

    A unique name for this rule.

    deps

    List of labels; optional

    The list of targets that are linked together to form the final bundle.
    srcs

    List of labels; optional

    The list of C, C++, Objective-C, and Objective-C++ source and header files that are processed to create the library target. These are your checked-in files, plus any generated files. Source files are compiled into .o files with Clang. Header files may be included/imported by any source or header in the srcs attribute of this target, but not by headers in hdrs or any targets that depend on this rule. Additionally, precompiled .o files may be given as srcs. Be careful to ensure consistency in the architecture of provided .o files and that of the build to avoid missing symbol linker errors.
    resources

    List of labels; optional

    Files to include in the final application bundle. They are not processed or compiled in any way besides the processing done by the rules that actually generate them. These files are placed in the root of the bundle (e.g. Payload/foo.app/...) in most cases. However, if they appear to be localized (i.e. are contained in a directory called *.lproj), they will be placed in a directory of the same name in the app bundle.
    hdrs

    List of labels; optional

    The list of C, C++, Objective-C, and Objective-C++ files that are included as headers by source files in this rule or by users of this library. These will be compiled separately from the source if modules are enabled.

    Boolean; optional; default is 0

    If 1, any bundle or binary that depends (directly or indirectly) on this library will link in all the object files for the files listed in srcs and non_arc_srcs, even if some contain no symbols referenced by the binary. This is useful if your code isn't explicitly called by code in the binary, e.g., if your code registers to receive some callback provided by some service.
    asset_catalogs

    List of labels; optional

    Files that comprise the asset catalogs of the final linked binary. Each file must have a containing directory named *.xcassets. This containing directory becomes the root of one of the asset catalogs linked with any binary that depends directly or indirectly on this target.
    bundles

    List of labels; optional

    The list of bundle targets that this target requires to be included in the final bundle.
    copts

    List of strings; optional

    Extra flags to pass to the compiler. Subject to "Make variable" substitution and Bourne shell tokenization. These flags will only apply to this target, and not those upon which it depends, or those which depend on it.

    Note that for the generated Xcode project, directory paths specified using "-I" flags in copts are parsed out, prepended with "$(WORKSPACE_ROOT)/" if they are relative paths, and added to the header search paths for the associated Xcode target.

    datamodels

    List of labels; optional

    Files that comprise the data models of the final linked binary. Each file must have a containing directory named *.xcdatamodel, which is usually contained by another *.xcdatamodeld (note the added d) directory.
    defines

    List of strings; optional

    Extra -D flags to pass to the compiler. They should be in the form KEY=VALUE or simply KEY and are passed not only to the compiler for this target (as copts are) but also to all objc_ dependers of this target. Subject to "Make variable" substitution and Bourne shell tokenization.
    enable_modules

    Boolean; optional; default is 0

    Enables clang module support (via -fmodules). Setting this to 1 will allow you to @import system headers and other targets: @import UIKit; @import path_to_package_target;
    includes

    List of strings; optional

    List of #include/#import search paths to add to this target and all depending targets. This is to support third party and open-sourced libraries that do not specify the entire workspace path in their #import/#include statements.

    The paths are interpreted relative to the package directory, and the genfiles and bin roots (e.g. bazel-genfiles/pkg/includedir and bazel-out/pkg/includedir) are included in addition to the actual client root.

    Unlike COPTS, these flags are added for this rule and every rule that depends on it. (Note: not the rules it depends upon!) Be very careful, since this may have far-reaching effects. When in doubt, add "-iquote" flags to COPTS instead.

    non_arc_srcs

    List of labels; optional

    The list of Objective-C files that are processed to create the library target that DO NOT use ARC. The files in this attribute are treated very similar to those in the srcs attribute, but are compiled without ARC enabled.
    non_propagated_deps

    List of labels; optional

    The list of targets that are required in order to build this target, but which are not included in the final bundle. This attribute should only rarely be used, and probably only for proto dependencies.
    pch

    Label; optional

    Header file to prepend to every source file being compiled (both arc and non-arc). Use of pch files is actively discouraged in BUILD files, and this should be considered deprecated. Since pch files are not actually precompiled this is not a build-speed enhancement, and instead is just a global dependency. From a build efficiency point of view you are actually better including what you need directly in your sources where you need it.
    runtime_deps

    List of labels; optional

    The list of framework targets that are late loaded at runtime. They are included in the app bundle but not linked against at build time.
    sdk_dylibs

    List of strings; optional

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

    List of strings; optional

    Names of SDK frameworks to link with. For instance, "XCTest" or "Cocoa". "UIKit" and "Foundation" are always included and do not mean anything if you include them.

    When linking a library, only those frameworks named in that library's sdk_frameworks attribute are linked in. When linking a binary, all SDK frameworks named in that binary's transitive dependency graph are used.

    sdk_includes

    List of strings; optional

    List of #include/#import search paths to add to this target and all depending targets, where each path is relative to $(SDKROOT)/usr/include.
    storyboards

    List of labels; optional

    Files which are .storyboard resources, possibly localizable. These files are compiled to .storyboardc directories, which are placed in the bundle root of the final package. If the storyboards's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable UI.
    strings

    List of labels; optional

    Files which are plists of strings, often localizable. These files are converted to binary plists (if they are not already) and placed in the bundle root of the final package. If this file's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable strings.
    structured_resources

    List of labels; optional

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

    Note that in the generated XCode project file, all files in the top directory of the specified files will be included in the Xcode-generated app bundle. So specifying ["res/foo.png"] will lead to the inclusion of all files in directory res.

    textual_hdrs

    List of labels; optional

    The list of C, C++, Objective-C, and Objective-C++ files that are included as headers by source files in this rule or by users of this library. Unlike hdrs, these will not be compiled separately from the sources.
    weak_sdk_frameworks

    List of strings; optional

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

    List of labels; optional

    Files which are .xib resources, possibly localizable. These files are compiled to .nib files and placed the bundle root of the final package. If this file's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable UI.

    objc_proto_library

    objc_proto_library(name, deps, data, compatible_with, deprecation, distribs, features, licenses, options_file, per_proto_includes, portable_proto_filters, restricted_to, tags, testonly, use_objc_header_names, uses_protobuf, visibility)

    This rule produces a static library from the given proto_library dependencies, after applying an options file.

    Arguments

    Attributes
    name

    Name; required

    A unique name for this rule.

    deps

    List of labels; optional

    The directly depended upon proto_library rules.
    options_file

    Label; optional

    Optional options file to apply to protos which affects compilation (e.g. class whitelist/blacklist settings).
    per_proto_includes

    Boolean; optional; default is 0

    If true, always add all directories to objc_library includes.
    portable_proto_filters

    List of labels; optional

    List of portable proto filters to be passed on to the protobuf compiler. This attribute cannot be used together with the options_file, output_cpp, per_proto_includes and use_objc_header_names attributes.
    use_objc_header_names

    Boolean; optional; default is 0

    If true, output headers with .pbobjc.h, rather than .pb.h.
    uses_protobuf

    Boolean; optional; default is 0

    Whether to use the new protobuf compiler and runtime for this target. If you enable this option without passing portable_proto_filters, it will generate a filter file for all the protos that passed through proto_library targets as deps.

    ios_test

    ios_test(name, deps, srcs, data, resources, hdrs, app_icon, args, asset_catalogs, bundle_id, bundles, compatible_with, copts, datamodels, defines, deprecation, distribs, enable_modules, entitlements, families, features, flaky, includes, infoplist, infoplists, ios_device_arg, ios_test_target_device, launch_image, launch_storyboard, licenses, linkopts, local, non_arc_srcs, non_propagated_deps, pch, plugins, provisioning_profile, restricted_to, runtime_deps, sdk_dylibs, sdk_frameworks, sdk_includes, shard_count, size, storyboards, strings, structured_resources, tags, target_device, testonly, textual_hdrs, timeout, visibility, weak_sdk_frameworks, xctest, xctest_app, xibs)

    This rule provides a way to build iOS unit tests written in KIF, GTM and XCTest test frameworks on both iOS simulator and real devices.

    Arguments

    Attributes
    name

    Name; required

    A unique name for this rule.

    deps

    List of labels; optional

    The list of targets that are linked together to form the final bundle.
    srcs

    List of labels; optional

    The list of C, C++, Objective-C, and Objective-C++ source and header files that are processed to create the library target. These are your checked-in files, plus any generated files. Source files are compiled into .o files with Clang. Header files may be included/imported by any source or header in the srcs attribute of this target, but not by headers in hdrs or any targets that depend on this rule. Additionally, precompiled .o files may be given as srcs. Be careful to ensure consistency in the architecture of provided .o files and that of the build to avoid missing symbol linker errors.
    resources

    List of labels; optional

    Files to include in the final application bundle. They are not processed or compiled in any way besides the processing done by the rules that actually generate them. These files are placed in the root of the bundle (e.g. Payload/foo.app/...) in most cases. However, if they appear to be localized (i.e. are contained in a directory called *.lproj), they will be placed in a directory of the same name in the app bundle.
    hdrs

    List of labels; optional

    The list of C, C++, Objective-C, and Objective-C++ files that are included as headers by source files in this rule or by users of this library. These will be compiled separately from the source if modules are enabled.
    app_icon

    String; optional

    The name of the application icon. The icon should be in one of the asset catalogs of this target or a (transitive) dependency. In a new project, this is initialized to "AppIcon" by Xcode.

    If the application icon is not in an asset catalog, do not use this attribute. Instead, add a CFBundleIcons entry to the Info.plist file.

    asset_catalogs

    List of labels; optional

    Files that comprise the asset catalogs of the final linked binary. Each file must have a containing directory named *.xcassets. This containing directory becomes the root of one of the asset catalogs linked with any binary that depends directly or indirectly on this target.
    bundle_id

    String; optional

    The bundle ID (reverse-DNS path followed by app name) of the binary. If specified, it will override the bundle ID specified in the associated plist file. If no bundle ID is specified on either this attribute or in the plist file, a junk value will be used.
    bundles

    List of labels; optional

    The list of bundle targets that this target requires to be included in the final bundle.
    copts

    List of strings; optional

    Extra flags to pass to the compiler. Subject to "Make variable" substitution and Bourne shell tokenization. These flags will only apply to this target, and not those upon which it depends, or those which depend on it.

    Note that for the generated Xcode project, directory paths specified using "-I" flags in copts are parsed out, prepended with "$(WORKSPACE_ROOT)/" if they are relative paths, and added to the header search paths for the associated Xcode target.

    datamodels

    List of labels; optional

    Files that comprise the data models of the final linked binary. Each file must have a containing directory named *.xcdatamodel, which is usually contained by another *.xcdatamodeld (note the added d) directory.
    defines

    List of strings; optional

    Extra -D flags to pass to the compiler. They should be in the form KEY=VALUE or simply KEY and are passed not only to the compiler for this target (as copts are) but also to all objc_ dependers of this target. Subject to "Make variable" substitution and Bourne shell tokenization.
    enable_modules

    Boolean; optional; default is 0

    Enables clang module support (via -fmodules). Setting this to 1 will allow you to @import system headers and other targets: @import UIKit; @import path_to_package_target;
    entitlements

    Label; optional

    The entitlements file required for device builds of this application. See the apple documentation for more information. If absent, the default entitlements from the provisioning profile will be used.

    The following variables are substituted: $(CFBundleIdentifier) with the bundle id and $(AppIdentifierPrefix) with the value of the ApplicationIdentifierPrefix key from this target's provisioning profile (or the default provisioning profile, if none is specified).

    Bazel does not currently support adding entitlements to simulator builds. This means that if you rely on behavior which must be specified in entitlements (like App Groups) it will only work on a device. You can work around this by inlining the entitlements into your binary. e.g.

    
              #if TARGET_OS_SIMULATOR
              __asm(".section __TEXT,__entitlements");
              __asm(".ascii \""
              "<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\n"
              "<!DOCTYPE plist PUBLIC \\\"-//Apple//DTD PLIST 1.0//EN\\\" "
                  "\\\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\\\">"
               "<plist version=\\\"1.0\\\">"
              "<dict>"
              "<key>com.apple.security.application-groups</key>"
              "<array>"
              "<string>group.com.your.company</string>"
              "</array>"
              "</dict>"
              "</plist>"
              "\"
              #endif
            
    families

    List of strings; optional

    The device families to which this bundle or binary is targeted. This is known as the TARGETED_DEVICE_FAMILY build setting in Xcode project files. It is a list of one or more of the strings "iphone" and "ipad".

    By default this is set to "iphone", if explicitly specified may not be empty.

    includes

    List of strings; optional

    List of #include/#import search paths to add to this target and all depending targets. This is to support third party and open-sourced libraries that do not specify the entire workspace path in their #import/#include statements.

    The paths are interpreted relative to the package directory, and the genfiles and bin roots (e.g. bazel-genfiles/pkg/includedir and bazel-out/pkg/includedir) are included in addition to the actual client root.

    Unlike COPTS, these flags are added for this rule and every rule that depends on it. (Note: not the rules it depends upon!) Be very careful, since this may have far-reaching effects. When in doubt, add "-iquote" flags to COPTS instead.

    infoplist

    Label; optional

    The infoplist file. This corresponds to appname-Info.plist in Xcode projects.

    Bazel will perform variable substitution on the plist file for the following values (if they are strings in the top-level dict of the plist):

    • ${EXECUTABLE_NAME}: The name of the executable generated and included in the bundle by bazel, which can be used as the value for CFBundleExecutable within the plist.
    • ${BUNDLE_NAME}: This target's name and bundle suffix (.bundle or .app) in the formname.suffix.
    • ${PRODUCT_NAME}: This target's name.

    The key in ${} may be suffixed with :rfc1034identifier (for example ${PRODUCT_NAME::rfc1034identifier}) in which case Bazel will replicate Xcode's behavior and replace non-RFC1034-compliant characters with -.

    infoplists

    List of labels; optional

    Infoplist files to be merged. The merged output corresponds to appname-Info.plist in Xcode projects. Duplicate keys between infoplist files will cause an error if and only if the values conflict. If both infoplist and infoplists are specified, the files defined in both attributes will be used.

    Bazel will perform variable substitution on the plist file for the following values (if they are strings in the top-level dict of the plist):

    • ${EXECUTABLE_NAME}: The name of the executable generated and included in the bundle by bazel, which can be used as the value for CFBundleExecutable within the plist.
    • ${BUNDLE_NAME}: This target's name and bundle suffix (.bundle or .app) in the formname.suffix.
    • ${PRODUCT_NAME}: This target's name.

    The key in ${} may be suffixed with :rfc1034identifier (for example ${PRODUCT_NAME::rfc1034identifier}) in which case Bazel will replicate Xcode's behavior and replace non-RFC1034-compliant characters with -.

    ios_device_arg

    List of strings; optional

    Extra arguments to pass to the ios_test_target_device's binary. They should be in the form KEY=VALUE or simply KEY (check your device's documentation for allowed parameters).
    ios_test_target_device

    Label; optional

    The device against how to run the test. If this attribute is defined, the test will run on the lab device. Otherwise, the test will run on simulator.
    launch_image

    String; optional

    The name of the launch image. The icon should be in one of the asset catalogs of this target or a (transitive) dependency. In a new project, this is initialized to "LaunchImage" by Xcode.

    If the launch image is not in an asset catalog, do not use this attribute. Instead, add an appropriately-named image resource to the bundle.

    launch_storyboard

    Label; optional

    The location of the launch storyboard (.xib or .storyboard). The provided storyboard will be compiled to the appropriate format (.nib or .storyboardc respectively) and placed in the root of the final package. If the storyboard's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable UI.

    The generated storyboard is registered in the final bundle's Info.plist under the key UILaunchStoryboardName.

    linkopts

    List of strings; optional

    Extra flags to pass to the linker.
    non_arc_srcs

    List of labels; optional

    The list of Objective-C files that are processed to create the library target that DO NOT use ARC. The files in this attribute are treated very similar to those in the srcs attribute, but are compiled without ARC enabled.
    non_propagated_deps

    List of labels; optional

    The list of targets that are required in order to build this target, but which are not included in the final bundle. This attribute should only rarely be used, and probably only for proto dependencies.
    pch

    Label; optional

    Header file to prepend to every source file being compiled (both arc and non-arc). Use of pch files is actively discouraged in BUILD files, and this should be considered deprecated. Since pch files are not actually precompiled this is not a build-speed enhancement, and instead is just a global dependency. From a build efficiency point of view you are actually better including what you need directly in your sources where you need it.
    plugins

    List of labels; optional

    Plugins to pass to the test runner.
    provisioning_profile

    Label; optional

    The provisioning profile (.mobileprovision file) to use when bundling the application. This is only used for non-simulator builds.
    runtime_deps

    List of labels; optional

    The list of framework targets that are late loaded at runtime. They are included in the app bundle but not linked against at build time.
    sdk_dylibs

    List of strings; optional

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

    List of strings; optional

    Names of SDK frameworks to link with. For instance, "XCTest" or "Cocoa". "UIKit" and "Foundation" are always included and do not mean anything if you include them.

    When linking a library, only those frameworks named in that library's sdk_frameworks attribute are linked in. When linking a binary, all SDK frameworks named in that binary's transitive dependency graph are used.

    sdk_includes

    List of strings; optional

    List of #include/#import search paths to add to this target and all depending targets, where each path is relative to $(SDKROOT)/usr/include.
    storyboards

    List of labels; optional

    Files which are .storyboard resources, possibly localizable. These files are compiled to .storyboardc directories, which are placed in the bundle root of the final package. If the storyboards's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable UI.
    strings

    List of labels; optional

    Files which are plists of strings, often localizable. These files are converted to binary plists (if they are not already) and placed in the bundle root of the final package. If this file's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable strings.
    structured_resources

    List of labels; optional

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

    Note that in the generated XCode project file, all files in the top directory of the specified files will be included in the Xcode-generated app bundle. So specifying ["res/foo.png"] will lead to the inclusion of all files in directory res.

    target_device

    Label; optional; default is @bazel_tools//tools/objc/sim_devices:default

    The device against which to run the test.
    textual_hdrs

    List of labels; optional

    The list of C, C++, Objective-C, and Objective-C++ files that are included as headers by source files in this rule or by users of this library. Unlike hdrs, these will not be compiled separately from the sources.
    weak_sdk_frameworks

    List of strings; optional

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

    Boolean; optional; default is 1

    Whether this target contains tests using the XCTest testing framework.
    xctest_app

    Label; optional

    An ios_application target that contains the app bundle to test against with XCTest. This attribute is only valid if xctest is true.
    xibs

    List of labels; optional

    Files which are .xib resources, possibly localizable. These files are compiled to .nib files and placed the bundle root of the final package. If this file's immediate containing directory is named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a directory of that name in the final bundle. This allows for localizable UI.