Rules related to Apple resources and resource bundles.

Rules

apple_bundle_import

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

name

A unique name for this target.

bundle_imports

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

apple_resource_bundle

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

name

A unique name for this target.

bundle_name

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

infoplists

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

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

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

resources

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

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

structured_resources

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

apple_resource_group

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

name

A unique name for this target.

resources

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

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

structured_resources

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

Macros and Functions

apple_core_ml_library

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

name

mlmodel

kwargs

objc_intent_library

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

name

src

class_prefix

class_visibility

testonly

swift_version

kwargs

swift_intent_library

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

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

It accepts the regular swift_library attributes too.

name

A unique name for the target.

src

Reference to the .intentdefiniton file to process.

class_prefix

Class prefix to use for the generated classes.

class_visibility

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

swift_version

Version of Swift to use for the generated classes.

testonly

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

kwargs