apple_linker_inputs(name, linker_inputs, linkopts)
Provides additional inputs to Apple rules' linker action.
Unlike C++ rules like cc_binary and cc_test, Apple rules don't have any
mechanism to allow providing additional inputs to the linker action. This
little rule helps mitigate that.
To use this rule in your BUILD files, load it with:
load("@rules_apple_line//apple:apple_linker_inputs.bzl", "apple_linker_inputs")ATTRIBUTES
| Name | Description | Type | Mandatory | Default |
|---|---|---|---|---|
| name | A unique name for this target. | Name | required | |
| linker_inputs | Extra files to be passed to the linker action. | List of labels | optional | [] |
| linkopts | Extra flags to be passed to Clang's linker command. Subject to "Make" variable substitution and label expansion. | List of strings | optional | [] |
metal_library(name, hdrs, includes, out, srcs)
Compiles Metal Shading Language source code into a Metal library. To use this rule in your BUILD files, load it with:
load("@rules_apple_line//apple:metal_library.bzl", "metal_library")ATTRIBUTES
| Name | Description | Type | Mandatory | Default |
|---|---|---|---|---|
| name | A unique name for this target. | Name | required | |
| hdrs | A list of headers that you need import to metal source. | List of labels | optional | [] |
| includes | A list of header search paths. | List of strings | optional | [] |
| out | An output .metallib filename. Defaults to default.metallib if unspecified. |
String | optional | "default.metallib" |
| srcs | A list of .metal source files that will be compiled into the library. |
List of labels | required |
pkg_dsym(name, mode, out, srcs, timestamp)
Creates a .dSYM.zip file given targets that produce dSYMs.
ATTRIBUTES
| Name | Description | Type | Mandatory | Default |
|---|---|---|---|---|
| name | A unique name for this target. | Name | required | |
| mode | Set the mode of files added by the srcs attribute. |
String | optional | "0555" |
| out | The output filename. | Label | optional | |
| srcs | A list of executable targets that produce dSYM, and/or a list of imported dSYMs if they're prebuilt. | List of labels | optional | [] |
| timestamp | The time to use for every file in the zip, expressed as seconds since Unix Epoch, RFC 3339. Due to limitations in the format of zip files, values before Jan 1, 1980 will be rounded up and the precision in the zip file is limited to a granularity of 2 seconds. |
Integer | optional | 315532800 |
swiftgen(name, out, srcs, template_file, template_params)
Generates Swift code from the given resource files.
ATTRIBUTES
| Name | Description | Type | Mandatory | Default |
|---|---|---|---|---|
| name | A unique name for this target. | Name | required | |
| out | The output Swift filename. | Label | required | |
| srcs | The list of input resource files. | List of labels | required | |
| template_file | The template file which will be used to generate Swift code. | Label | required | |
| template_params | An optional dictionary of parameters that you want to pass to the template. | Dictionary: String -> String | optional | {} |
apple_library(kwargs)
Compiles and links Objective-C and Swift code into a static library.
To use this rule in your BUILD files, load it with:
load("@rules_apple_line//apple:apple_library.bzl", "apple_library")See mixed_static_framework for the documentation of each attribute.
PARAMETERS
| Name | Description | Default Value |
|---|---|---|
| kwargs | - |
none |
apple_preprocessed_plist(name, src, out, substitutions, kwargs)
PARAMETERS
| Name | Description | Default Value |
|---|---|---|
| name | - |
none |
| src | - |
none |
| out | - |
none |
| substitutions | - |
none |
| kwargs | - |
none |
mixed_static_framework(name, srcs, non_arc_srcs, hdrs, textual_hdrs, enable_modules, includes, copts, objc_copts, swift_copts, use_defines, swiftc_inputs, objc_deps, swift_deps, avoid_deps, deps, data, umbrella_header, visibility, minimum_os_version, features, kwargs)
Builds and bundles a static framework for Xcode consumption or third-party distribution.
This supports Swift only targets and mixed language targets. If your target
only contains Objective-C source code, use objc_static_framework rule
instead.
This rule in general is very similar to build_bazel_rules_apple's
ios_static_framework rule, with some differences:
- It supports Swift as well as mixed Objective-C and Swift targets.
- It supports bundling a swift_library target that depend transitively on any other swift_library targets. By default, it will not link any of its dependencies into the final framework binary - the same way Xcode does when it builds frameworks - which means you can prebuild your dependencies as static frameworks for Xcode consumption.
- It supports header maps out of the box--you don't need to change your imports to make your code build with Bazel.
- It always collects the Swift generated header and bundles a
module.modulemapfile. For a mixed language target, the module map file is an extended module map. - It bundles
swiftmoduleandswiftdocfiles (ios_static_frameworkrule bundlesswiftinterfaceinstead ofswiftmodulefile).
This rule uses the native objc_library rule and rules_swift's
swift_library in its implementation. Even if you're not building a static
framework for Xcode consumption or third-party distribution, this can still
be used as a convenient way to declare a library target that compiles mixed
Objective-C and Swift source code.
The macro contains 3 underlying rules--given name is Greet:
Greet_swift: aswift_librarytarget. This target has private visibility by default, hence it can't be a dependency of any other target. It should not be used directly.GreetModule: amodule_maptarget. This has the same visibility asGreet. The common use-case is using it in anobjc_library'scoptsattribute to import the generated module map file (e.g.-fmodule-map-file=$(execpath //path/to/package:GreetModule)). This will be done automatically if the dependent target is also amixed_static_frameworktarget.Greet: anobjc_librarytarget. This is the wrapper library target. This can be depended on anyobjc_libraryorswift_librarytarget.
load("@rules_apple_line//apple:mixed_static_framework.bzl", "mixed_static_framework")
mixed_static_framework(
name = "Mixed",
srcs = glob([
"*.m",
"*.swift",
]),
hdrs = glob(["*.h"]),
)PARAMETERS
objc_library(kwargs)
Produces a static library from the given Objective-C source files.
A drop-in replacement of the native objc_library rule, with added supports for header maps and modules.
To use this rule in your BUILD files, load it with:
load("@rules_apple_line//apple:objc_library.bzl", "objc_library")See objc_static_framework for the documentation of each attribute.
PARAMETERS
| Name | Description | Default Value |
|---|---|---|
| kwargs | - |
none |
objc_static_framework(name, srcs, non_arc_srcs, hdrs, archives, deps, avoid_deps, data, use_defines, module_name, textual_hdrs, includes, testonly, enable_modules, minimum_os_version, pch, visibility, umbrella_header, kwargs)
Builds and bundles a Objective-C static framework for Xcode consumption or third-party distribution.
This rule in general is very similar to build_bazel_rules_apple's
ios_static_framework rule, with support for modules and header maps out
of the box--which means you don't need to change your imports to make your
code build with Bazel. Note that, unlike build_bazel_rules_apple's
ios_static_framework, by default, it will not link any of its
dependencies into the final framework binary - the same way Xcode does when
it builds frameworks.
PARAMETERS
swift_library(kwargs)
Compiles and links Swift code into a static library and Swift module.
A drop-in replacement of the official swift_library rule, with added supports for header maps, and better integration with other rules in this repository.
To use this rule in your BUILD files, load it with:
load("@rules_apple_line//apple:objc_library.bzl", "objc_library")See swift_static_framework for the documentation of each attribute.
PARAMETERS
| Name | Description | Default Value |
|---|---|---|
| kwargs | - |
none |
swift_static_framework(name, srcs, copts, use_defines, swiftc_inputs, deps, avoid_deps, data, visibility, minimum_os_version, features, kwargs)
Builds and bundles a Swift static framework for Xcode consumption or third-party distribution.
This rule in general is very similar to build_bazel_rules_apple's
ios_static_framework rule, with some differences:
- It supports bundling a swift_library target that depend transitively on any other swift_library targets. By default, it will not link any of its dependencies into the final framework binary - the same way Xcode does when it builds frameworks - which means you can prebuild your dependencies as static frameworks for Xcode consumption.
- It supports header maps out of the box--you don't need to change your imports to make your code build with Bazel.
- It always collects the Swift generated header and bundles a
module.modulemapfile. - It bundles
swiftmoduleandswiftdocfiles (ios_static_frameworkrule bundlesswiftinterfaceinstead ofswiftmodulefile).
Under the hood, this uses an objc_library target to wrap a
swift_library target -- so by a sense, it's still a mixed Obj-C and Swift
target - to make use of objc_library's configuration transition.
load("@rules_apple_line//apple:swift_static_framework.bzl", "swift_static_framework")
swift_static_framework(
name = "MyLibrary",
srcs = glob(["**/*.swift"]),
)PARAMETERS