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



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.

Specifically, the aspect propagates which toolchain was used to build those dependencies. This information is typically always the same for any Swift targets built in the same configuration, but this allows upstream targets that may not be strictly Swift-related and thus don't want to depend directly on the Swift toolchain (such as Apple universal binary linking rules) to avoid doing so but still get access to information derived from the toolchain (like which linker flags to pass to link to the runtime).

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


A unique name for this target.