Skip to content

Commit bbe6fbe

Browse files
AttilaTheFunthiiluispadron
authored
Implement new swift_proto_library rule (#1140)
This PR introduces a new swift_proto_library rule which is intended to replace both the swift_proto_library and swift_grpc_library rules. The PR marks those rules as deprecated and provides a comprehensive migration guide to the new rules. Co-authored-by: Thi Doan <[email protected]> Co-authored-by: Luis Padron <[email protected]> Co-authored-by: Logan Shire <[email protected]>
1 parent fe6c470 commit bbe6fbe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+3125
-362
lines changed

doc/BUILD.bazel renamed to doc/BUILD

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,29 @@ _DOC_SRCS = {
1212
"swift_usage_aspect",
1313
],
1414
"providers": [
15-
"SwiftGRPCInfo",
1615
"SwiftInfo",
1716
"SwiftToolchainInfo",
17+
"SwiftProtoCompilerInfo",
1818
"SwiftProtoInfo",
1919
"SwiftUsageInfo",
20+
"DeprecatedSwiftGRPCInfo",
2021
],
2122
"rules": [
2223
"swift_binary",
2324
"swift_c_module",
2425
"swift_compiler_plugin",
2526
"universal_swift_compiler_plugin",
2627
"swift_feature_allowlist",
27-
"swift_grpc_library",
2828
"swift_import",
2929
"swift_library",
3030
"swift_library_group",
3131
"swift_module_alias",
3232
"swift_package_configuration",
33-
"swift_proto_library",
3433
"swift_test",
34+
"swift_proto_library",
35+
"swift_proto_compiler",
36+
"deprecated_swift_grpc_library",
37+
"deprecated_swift_proto_library",
3538
],
3639
}
3740

@@ -112,9 +115,9 @@ write_file(
112115
name = file + "_doc",
113116
out = file + ".md_",
114117
header_template = file + "_header.vm",
115-
input = "//swift:swift.bzl",
118+
input = "//doc:doc.bzl",
116119
symbol_names = symbols,
117-
deps = ["//swift"],
120+
deps = ["//doc"],
118121
)
119122
for [
120123
file,
@@ -182,3 +185,14 @@ bzl_library(
182185
srcs = ["@bazel_tools//tools:bzl_srcs"],
183186
visibility = ["//swift:__pkg__"],
184187
)
188+
189+
# gazelle:ignore
190+
bzl_library(
191+
name = "doc",
192+
srcs = ["//doc:doc.bzl"],
193+
visibility = ["//doc:__pkg__"],
194+
deps = [
195+
"//proto",
196+
"//swift",
197+
],
198+
)

doc/doc.bzl

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Copyright 2024 The Bazel Authors. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
"""Bazel rules to define Swift libraries and executable binaries.
16+
17+
Users should load these rules from one or both of the following Bazel files:
18+
19+
```build
20+
@build_bazel_rules_swift//swift:swift.bzl
21+
@build_bazel_rules_swift//proto:proto.bzl
22+
```
23+
24+
Do not import definitions from the `internal` subdirectory directly.
25+
26+
For example:
27+
28+
```build
29+
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
30+
load("@build_bazel_rules_swift//proto:proto.bzl", "swift_proto_library")
31+
```
32+
"""
33+
34+
load(
35+
"//proto:proto.bzl",
36+
# providers
37+
_SwiftProtoCompilerInfo = "SwiftProtoCompilerInfo",
38+
_SwiftProtoInfo = "SwiftProtoInfo",
39+
# api
40+
_swift_proto_common = "swift_proto_common",
41+
# rules
42+
_swift_proto_compiler = "swift_proto_compiler",
43+
_swift_proto_library = "swift_proto_library",
44+
)
45+
load(
46+
"//swift:swift.bzl",
47+
# providers
48+
_DeprecatedSwiftGRPCInfo = "SwiftGRPCInfo",
49+
_SwiftInfo = "SwiftInfo",
50+
_SwiftToolchainInfo = "SwiftToolchainInfo",
51+
_SwiftUsageInfo = "SwiftUsageInfo",
52+
# rules
53+
_deprecated_swift_grpc_library = "deprecated_swift_grpc_library",
54+
_deprecated_swift_proto_library = "deprecated_swift_proto_library",
55+
_swift_binary = "swift_binary",
56+
_swift_c_module = "swift_c_module",
57+
# api
58+
_swift_common = "swift_common",
59+
_swift_compiler_plugin = "swift_compiler_plugin",
60+
_swift_feature_allowlist = "swift_feature_allowlist",
61+
_swift_import = "swift_import",
62+
_swift_library = "swift_library",
63+
_swift_library_group = "swift_library_group",
64+
_swift_module_alias = "swift_module_alias",
65+
_swift_package_configuration = "swift_package_configuration",
66+
_swift_test = "swift_test",
67+
# aspects
68+
_swift_usage_aspect = "swift_usage_aspect",
69+
_universal_swift_compiler_plugin = "universal_swift_compiler_plugin",
70+
)
71+
72+
# The following are re-exported symbols for consumption from stardoc.
73+
74+
# proto symbols
75+
swift_proto_common = _swift_proto_common
76+
SwiftProtoCompilerInfo = _SwiftProtoCompilerInfo
77+
SwiftProtoInfo = _SwiftProtoInfo
78+
swift_proto_compiler = _swift_proto_compiler
79+
swift_proto_library = _swift_proto_library
80+
81+
# swift symbols
82+
swift_common = _swift_common
83+
swift_usage_aspect = _swift_usage_aspect
84+
DeprecatedSwiftGRPCInfo = _DeprecatedSwiftGRPCInfo
85+
SwiftInfo = _SwiftInfo
86+
SwiftToolchainInfo = _SwiftToolchainInfo
87+
SwiftUsageInfo = _SwiftUsageInfo
88+
deprecated_swift_grpc_library = _deprecated_swift_grpc_library
89+
deprecated_swift_proto_library = _deprecated_swift_proto_library
90+
swift_binary = _swift_binary
91+
swift_c_module = _swift_c_module
92+
swift_compiler_plugin = _swift_compiler_plugin
93+
universal_swift_compiler_plugin = _universal_swift_compiler_plugin
94+
swift_feature_allowlist = _swift_feature_allowlist
95+
swift_import = _swift_import
96+
swift_library = _swift_library
97+
swift_library_group = _swift_library_group
98+
swift_module_alias = _swift_module_alias
99+
swift_package_configuration = _swift_package_configuration
100+
swift_test = _swift_test

0 commit comments

Comments
 (0)