Skip to content
Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
247 lines (224 sloc) 9.15 KB

Build rules for referencing resources

apple_bundle_import

apple_bundle_import(name, bundle_imports)

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.

Attributes
name

Name, required

A unique name for the target.

bundle_imports

List of labels; required

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

apple_core_ml_library

apple_core_ml_library(name, mlmodel)

This rule supports the integration of CoreML mlmodel files into Apple rules. apple_core_ml_library targets are added directly into deps for both objc_library and swift_library targets.

For Swift, import the apple_core_ml_library the same way you'd import an objc_library or swift_library target. For objc_library targets, apple_core_ml_library creates a header file named after the target.

For example, if the apple_core_ml_library target's label is //my/package:MyModel, then to import this module in Swift you need to use import my_package_MyModel. From Objective-C sources, you'd import the header as #import my/package/MyModel.h.

This rule will also compile the mlmodel into an mlmodelc and propagate it upstream so that it is packaged as a resource inside the top level bundle.

Attributes
name

Name, required

A unique name for the target.

bundle_imports

Label; required

Reference to the .mlmodel file to process.

apple_resource_bundle

apple_resource_bundle(name, bundle_name, infoplists, resources,
structured_resources)

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.

Attributes
name

Name, required

A unique name for the target.

bundle_name

String; optional

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

List of labels; optional

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.

resources

List of labels; optional

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

List of labels; optional

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

apple_resource_group(name, resources, structured_resources)

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.

Attributes
name

Name, required

A unique name for the target.

resources

List of labels; optional

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

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 bundle root in the same structure passed to this argument, so ["res/foo.png"] will end up in res/foo.png inside the bundle.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.