Rules that apply to all Apple platforms.

Rules

apple_dynamic_framework_import

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

Examples

apple_dynamic_framework_import(
    name = "my_dynamic_framework",
    framework_imports = glob(["my_dynamic_framework.framework/**"]),
)

objc_library(
    name = "foo_lib",
    ...,
    deps = [
        ":my_dynamic_framework",
    ],
)

Example usage (generated)

load("@rules_apple//apple:apple.bzl", "apple_dynamic_framework_import")

apple_dynamic_framework_import(
    # A unique name for this target.
    name = "",
    # The list of files under a .framework directory which are provided to Apple based targets that depend
    framework_imports = [],
)

name

A unique name for this target.

bundle_only

Avoid linking the dynamic framework, but still include it in the app. This is useful when you want to manually dlopen the framework at runtime.

deps

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

dsym_imports

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

framework_imports

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


apple_static_framework_import

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

Examples

apple_static_framework_import(
    name = "my_static_framework",
    framework_imports = glob(["my_static_framework.framework/**"]),
)

objc_library(
    name = "foo_lib",
    ...,
    deps = [
        ":my_static_framework",
    ],
)

Example usage (generated)

load("@rules_apple//apple:apple.bzl", "apple_static_framework_import")

apple_static_framework_import(
    # A unique name for this target.
    name = "",
    # The list of files under a .framework directory which are provided to Apple based targets that depend
    framework_imports = [],
)

name

A unique name for this target.

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

deps

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

framework_imports

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

sdk_dylibs

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

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

weak_sdk_frameworks

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.