You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Compiles and links Swift code into an executable binary.
@@ -68,6 +68,7 @@ please use one of the platform-specific application rules in
68
68
| <aid="swift_binary-deps"></a>deps | A list of targets that are dependencies of the target being built, which will be linked into that target.<br><br>If the Swift toolchain supports implementation-only imports (`private_deps` on `swift_library`), then targets in `deps` are treated as regular (non-implementation-only) imports that are propagated both to their direct and indirect (transitive) dependents.<br><br>Allowed kinds of dependencies are:<br><br>*`swift_library` (or anything propagating `SwiftInfo`)<br><br>*`cc_library` and `objc_library` (or anything propagating `CcInfo`) | <ahref="https://bazel.build/concepts/labels">List of labels</a> | optional |`[]`|
69
69
| <aid="swift_binary-srcs"></a>srcs | A list of `.swift` source files that will be compiled into the library.<br><br>Except in very rare circumstances, a Swift source file should only appear in a single `swift_*` target. Adding the same source file to multiple `swift_*` targets can lead to binary bloat and/or symbol collisions. If specific sources need to be shared by multiple targets, consider factoring them out into their own `swift_library` instead. | <ahref="https://bazel.build/concepts/labels">List of labels</a> | optional |`[]`|
70
70
| <aid="swift_binary-data"></a>data | The list of files needed by this target at runtime.<br><br>Files and targets named in the `data` attribute will appear in the `*.runfiles` area of this target, if it has one. This may include data files needed by a binary or library, or other programs needed by it. | <ahref="https://bazel.build/concepts/labels">List of labels</a> | optional |`[]`|
71
+
| <aid="swift_binary-additional_linker_inputs"></a>additional_linker_inputs | List of additional files needed by the linker.<br><br>These files will be passed to the linker when linking the binary target. Typically, these are linker scripts or other files referenced by `linkopts`. | <ahref="https://bazel.build/concepts/labels">List of labels</a> | optional |`[]`|
71
72
| <aid="swift_binary-copts"></a>copts | Additional compiler options that should be passed to `swiftc`. These strings are subject to `$(location ...)` and ["Make" variable](https://docs.bazel.build/versions/master/be/make-variables.html) expansion. | List of strings | optional |`[]`|
72
73
| <aid="swift_binary-defines"></a>defines | A list of defines to add to the compilation command line.<br><br>Note that unlike C-family languages, Swift defines do not have values; they are simply identifiers that are either defined or undefined. So strings in this list should be simple identifiers, **not**`name=value` pairs.<br><br>Each string is prepended with `-D` and added to the command line. Unlike `copts`, these flags are added for the target and every target that depends on it, so use this attribute with caution. It is preferred that you add defines directly to `copts`, only using this feature in the rare case that a library needs to propagate a symbol up to those that depend on it. | List of strings | optional |`[]`|
73
74
| <aid="swift_binary-env"></a>env | Specifies additional environment variables to set when the test is executed by `bazel run` or `bazel test`.<br><br>The values of these environment variables are subject to `$(location)` and "Make variable" substitution.<br><br>NOTE: The environment variables are not set when you run the target outside of Bazel (for example, by manually executing the binary in `bazel-bin/`). | <ahref="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | optional |`{}`|
@@ -85,8 +86,8 @@ please use one of the platform-specific application rules in
Compiles and links a Swift compiler plugin (for example, a macro).
@@ -157,6 +158,7 @@ swift_library(
157
158
| <aid="swift_compiler_plugin-deps"></a>deps | A list of targets that are dependencies of the target being built, which will be linked into that target.<br><br>If the Swift toolchain supports implementation-only imports (`private_deps` on `swift_library`), then targets in `deps` are treated as regular (non-implementation-only) imports that are propagated both to their direct and indirect (transitive) dependents.<br><br>Allowed kinds of dependencies are:<br><br>*`swift_library` (or anything propagating `SwiftInfo`)<br><br>*`cc_library` and `objc_library` (or anything propagating `CcInfo`) | <ahref="https://bazel.build/concepts/labels">List of labels</a> | optional |`[]`|
158
159
| <aid="swift_compiler_plugin-srcs"></a>srcs | A list of `.swift` source files that will be compiled into the library.<br><br>Except in very rare circumstances, a Swift source file should only appear in a single `swift_*` target. Adding the same source file to multiple `swift_*` targets can lead to binary bloat and/or symbol collisions. If specific sources need to be shared by multiple targets, consider factoring them out into their own `swift_library` instead. | <ahref="https://bazel.build/concepts/labels">List of labels</a> | optional |`[]`|
159
160
| <aid="swift_compiler_plugin-data"></a>data | The list of files needed by this target at runtime.<br><br>Files and targets named in the `data` attribute will appear in the `*.runfiles` area of this target, if it has one. This may include data files needed by a binary or library, or other programs needed by it. | <ahref="https://bazel.build/concepts/labels">List of labels</a> | optional |`[]`|
161
+
| <aid="swift_compiler_plugin-additional_linker_inputs"></a>additional_linker_inputs | List of additional files needed by the linker.<br><br>These files will be passed to the linker when linking the binary target. Typically, these are linker scripts or other files referenced by `linkopts`. | <ahref="https://bazel.build/concepts/labels">List of labels</a> | optional |`[]`|
160
162
| <aid="swift_compiler_plugin-copts"></a>copts | Additional compiler options that should be passed to `swiftc`. These strings are subject to `$(location ...)` and ["Make" variable](https://docs.bazel.build/versions/master/be/make-variables.html) expansion. | List of strings | optional |`[]`|
161
163
| <aid="swift_compiler_plugin-defines"></a>defines | A list of defines to add to the compilation command line.<br><br>Note that unlike C-family languages, Swift defines do not have values; they are simply identifiers that are either defined or undefined. So strings in this list should be simple identifiers, **not**`name=value` pairs.<br><br>Each string is prepended with `-D` and added to the command line. Unlike `copts`, these flags are added for the target and every target that depends on it, so use this attribute with caution. It is preferred that you add defines directly to `copts`, only using this feature in the rare case that a library needs to propagate a symbol up to those that depend on it. | List of strings | optional |`[]`|
162
164
| <aid="swift_compiler_plugin-linkopts"></a>linkopts | Additional linker options that should be passed to `clang`. These strings are subject to `$(location ...)` expansion. | List of strings | optional |`[]`|
Compiles and links Swift code into an executable test target.
@@ -996,6 +998,7 @@ root of your workspace (i.e. `$(SRCROOT)`).
996
998
| <aid="swift_test-deps"></a>deps | A list of targets that are dependencies of the target being built, which will be linked into that target.<br><br>If the Swift toolchain supports implementation-only imports (`private_deps` on `swift_library`), then targets in `deps` are treated as regular (non-implementation-only) imports that are propagated both to their direct and indirect (transitive) dependents.<br><br>Allowed kinds of dependencies are:<br><br>*`swift_library` (or anything propagating `SwiftInfo`)<br><br>*`cc_library` and `objc_library` (or anything propagating `CcInfo`) | <ahref="https://bazel.build/concepts/labels">List of labels</a> | optional |`[]`|
997
999
| <aid="swift_test-srcs"></a>srcs | A list of `.swift` source files that will be compiled into the library.<br><br>Except in very rare circumstances, a Swift source file should only appear in a single `swift_*` target. Adding the same source file to multiple `swift_*` targets can lead to binary bloat and/or symbol collisions. If specific sources need to be shared by multiple targets, consider factoring them out into their own `swift_library` instead. | <ahref="https://bazel.build/concepts/labels">List of labels</a> | optional |`[]`|
998
1000
| <aid="swift_test-data"></a>data | The list of files needed by this target at runtime.<br><br>Files and targets named in the `data` attribute will appear in the `*.runfiles` area of this target, if it has one. This may include data files needed by a binary or library, or other programs needed by it. | <ahref="https://bazel.build/concepts/labels">List of labels</a> | optional |`[]`|
1001
+
| <aid="swift_test-additional_linker_inputs"></a>additional_linker_inputs | List of additional files needed by the linker.<br><br>These files will be passed to the linker when linking the binary target. Typically, these are linker scripts or other files referenced by `linkopts`. | <ahref="https://bazel.build/concepts/labels">List of labels</a> | optional |`[]`|
999
1002
| <aid="swift_test-copts"></a>copts | Additional compiler options that should be passed to `swiftc`. These strings are subject to `$(location ...)` and ["Make" variable](https://docs.bazel.build/versions/master/be/make-variables.html) expansion. | List of strings | optional |`[]`|
1000
1003
| <aid="swift_test-defines"></a>defines | A list of defines to add to the compilation command line.<br><br>Note that unlike C-family languages, Swift defines do not have values; they are simply identifiers that are either defined or undefined. So strings in this list should be simple identifiers, **not**`name=value` pairs.<br><br>Each string is prepended with `-D` and added to the command line. Unlike `copts`, these flags are added for the target and every target that depends on it, so use this attribute with caution. It is preferred that you add defines directly to `copts`, only using this feature in the rare case that a library needs to propagate a symbol up to those that depend on it. | List of strings | optional |`[]`|
1001
1004
| <a id="swift_test-discover_tests"></a>discover_tests | Determines whether or not tests are automatically discovered in the binary. The default value is `True`.<br><br>Tests are discovered in a platform-specific manner. On Apple platforms, they are found using the XCTest framework's `XCTestSuite.default` accessor, which uses the Objective-C runtime to dynamically discover tests. On non-Apple platforms, discovery uses symbol graphs generated from dependencies to find classes and methods written in XCTest's style.<br><br>If tests are discovered, then you should not provide your own `main` entry point in the `swift_test` binary; the test runtime provides the entry point for you. If you set this attribute to `False`, then you are responsible for providing your own `main`. This allows you to write tests that use a framework other than Apple's `XCTest`. The only requirement of such a test is that it terminate with a zero exit code for success or a non-zero exit code for failure. | Boolean | optional | `True` |
0 commit comments