BUILD rules to define Swift libraries and executable binaries.

This file is the public interface that users should import to use the Swift rules. Do not import definitions from the internal subdirectory directly.

To use the Swift build rules in your BUILD files, load them from @build_bazel_rules_swift//swift:swift.bzl.

For example:

load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")

Providers

SwiftInfo

Contains information about the compiled artifacts of a Swift module.

This provider contains a large number of fields and many custom rules may not need to set all of them. Instead of constructing a SwiftInfo provider directly, consider using the swift_common.create_swift_info function, which has reasonable defaults for any fields not explicitly set.

SwiftProtoInfo

Propagates Swift-specific information about a proto_library.

SwiftToolchainInfo

Propagates information about a Swift toolchain to compilation and linking rules that use the toolchain.

SwiftUsageInfo

A provider that indicates that Swift was used by a target or any target that it depends on, and specifically which toolchain was used.