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")

Aspects

swift_usage_aspect

Collects information about how Swift is used in a dependency tree.

When attached to an attribute, this aspect will propagate a SwiftUsageInfo provider for any target found in that attribute that uses Swift, either directly or deeper in its dependency tree. Conversely, if neither a target nor its transitive dependencies use Swift, the SwiftUsageInfo provider will not be propagated.

We use an aspect (as opposed to propagating this information through normal providers returned by swift_library) because the information is needed if Swift is used anywhere in a dependency graph, even as dependencies of other language rules that wouldn't know how to propagate the Swift-specific providers.

Propagates along attributes named: deps

name

A unique name for this target.