Skip to content

Commit

Permalink
Move swift_usage_aspect and SwiftUsageInfo from rules_swift into …
Browse files Browse the repository at this point in the history
…rules_apple

With the toolchain information removed, this aspect/provider offers a minimal API. The only client is rules_apple, which uses it to determine if Swift support may need to be bundled at all, so it's better that that single client own it, rather than rules_swift try to provide an API that could serve all possible hypothetical clients.

PiperOrigin-RevId: 439577534
(cherry picked from commit c24a84a)
Signed-off-by: Brentley Jones <github@brentleyjones.com>
  • Loading branch information
allevato authored and brentleyjones committed Jun 19, 2024
1 parent d1b9974 commit 105cefc
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 125 deletions.
22 changes: 0 additions & 22 deletions doc/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,11 @@ _DOC_SRCS = {
"api": [
"swift_common",
],
"aspects": [
"swift_usage_aspect",
],
"providers": [
"SwiftInfo",
"SwiftToolchainInfo",
"SwiftProtoCompilerInfo",
"SwiftProtoInfo",
"SwiftUsageInfo",
],
"rules": [
"swift_binary",
Expand Down Expand Up @@ -51,24 +47,6 @@ write_file(
],
)

write_file(
name = "aspects_header",
out = "aspects_header.vm",
content = [
"<!-- Generated with Stardoc, Do Not Edit! -->",
"# Aspects",
"",
"The aspects described below are used within the build rule implementations.",
"Clients interested in writing custom rules that interface with the rules/provides",
"in this package might needs them to provide some of the same information.",
"",
"On this page:",
"",
] + [" * [{0}](#{0})".format(r) for r in _DOC_SRCS["aspects"]] + [
"",
],
)

write_file(
name = "rules_header",
out = "rules_header.vm",
Expand Down
4 changes: 0 additions & 4 deletions doc/doc.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ load(
# providers
_SwiftInfo = "SwiftInfo",
_SwiftToolchainInfo = "SwiftToolchainInfo",
_SwiftUsageInfo = "SwiftUsageInfo",
# rules
_swift_binary = "swift_binary",
# api
Expand All @@ -63,7 +62,6 @@ load(
_swift_package_configuration = "swift_package_configuration",
_swift_test = "swift_test",
# aspects
_swift_usage_aspect = "swift_usage_aspect",
_universal_swift_compiler_plugin = "universal_swift_compiler_plugin",
)

Expand All @@ -79,10 +77,8 @@ swift_proto_library_group = _swift_proto_library_group

# swift symbols
swift_common = _swift_common
swift_usage_aspect = _swift_usage_aspect
SwiftInfo = _SwiftInfo
SwiftToolchainInfo = _SwiftToolchainInfo
SwiftUsageInfo = _SwiftUsageInfo
swift_binary = _swift_binary
swift_compiler_plugin = _swift_compiler_plugin
universal_swift_compiler_plugin = _universal_swift_compiler_plugin
Expand Down
16 changes: 0 additions & 16 deletions doc/providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ On this page:
* [SwiftToolchainInfo](#SwiftToolchainInfo)
* [SwiftProtoCompilerInfo](#SwiftProtoCompilerInfo)
* [SwiftProtoInfo](#SwiftProtoInfo)
* [SwiftUsageInfo](#SwiftUsageInfo)

<a id="SwiftInfo"></a>

Expand Down Expand Up @@ -117,18 +116,3 @@ that use the toolchain.
| <a id="SwiftToolchainInfo-unsupported_features"></a>unsupported_features | `List` of `string`s. Features that should be implicitly disabled by default for targets built using this toolchain, unless overridden by the user by listing them in the `features` attribute of a target/package or in the `--features` command line flag.<br><br>These features determine various compilation and debugging behaviors of the Swift build rules, and they are also passed to the C++ APIs used when linking (so features defined in CROSSTOOL may be used here). |


<a id="SwiftUsageInfo"></a>

## SwiftUsageInfo

<pre>
SwiftUsageInfo()
</pre>

A provider that indicates that Swift was used by a target or any target that it
depends on.

**FIELDS**



1 change: 0 additions & 1 deletion swift/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ bzl_library(
"//swift/internal:swift_package_configuration",
"//swift/internal:swift_symbol_graph_aspect",
"//swift/internal:swift_test",
"//swift/internal:swift_usage_aspect",
],
)

Expand Down
7 changes: 0 additions & 7 deletions swift/internal/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -336,13 +336,6 @@ bzl_library(
],
)

bzl_library(
name = "swift_usage_aspect",
srcs = ["swift_usage_aspect.bzl"],
visibility = ["//swift:__subpackages__"],
deps = [":providers"],
)

bzl_library(
name = "toolchain_config",
srcs = ["toolchain_config.bzl"],
Expand Down
8 changes: 0 additions & 8 deletions swift/internal/providers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -329,14 +329,6 @@ Swift build rules, and they are also passed to the C++ APIs used when linking
},
)

SwiftUsageInfo = provider(
doc = """\
A provider that indicates that Swift was used by a target or any target that it
depends on.
""",
fields = {},
)

def create_module(
*,
name,
Expand Down
60 changes: 0 additions & 60 deletions swift/internal/swift_usage_aspect.bzl

This file was deleted.

7 changes: 0 additions & 7 deletions swift/swift.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ load(
_SwiftProtoInfo = "SwiftProtoInfo",
_SwiftSymbolGraphInfo = "SwiftSymbolGraphInfo",
_SwiftToolchainInfo = "SwiftToolchainInfo",
_SwiftUsageInfo = "SwiftUsageInfo",
)
load(
"@build_bazel_rules_swift//swift/internal:swift_binary.bzl",
Expand Down Expand Up @@ -93,18 +92,13 @@ load(
"@build_bazel_rules_swift//swift/internal:swift_test.bzl",
_swift_test = "swift_test",
)
load(
"@build_bazel_rules_swift//swift/internal:swift_usage_aspect.bzl",
_swift_usage_aspect = "swift_usage_aspect",
)

# Re-export providers.
SwiftInfo = _SwiftInfo
SwiftProtoCompilerInfo = _SwiftProtoCompilerInfo
SwiftProtoInfo = _SwiftProtoInfo
SwiftSymbolGraphInfo = _SwiftSymbolGraphInfo
SwiftToolchainInfo = _SwiftToolchainInfo
SwiftUsageInfo = _SwiftUsageInfo

# Re-export public API module.
swift_common = _swift_common
Expand All @@ -126,4 +120,3 @@ swift_test = _swift_test
# Re-export public aspects.
swift_clang_module_aspect = _swift_clang_module_aspect
swift_symbol_graph_aspect = _swift_symbol_graph_aspect
swift_usage_aspect = _swift_usage_aspect

0 comments on commit 105cefc

Please sign in to comment.