Skip to content

Commit 1aec64c

Browse files
authored
Delete deprecated swift proto library rules (#1193)
1 parent eaa3551 commit 1aec64c

File tree

25 files changed

+1
-2421
lines changed

25 files changed

+1
-2421
lines changed

doc/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ _DOC_SRCS = {
1717
"SwiftProtoCompilerInfo",
1818
"SwiftProtoInfo",
1919
"SwiftUsageInfo",
20-
"DeprecatedSwiftGRPCInfo",
2120
],
2221
"rules": [
2322
"swift_binary",

doc/doc.bzl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,10 @@ load(
4646
load(
4747
"//swift:swift.bzl",
4848
# providers
49-
_DeprecatedSwiftGRPCInfo = "SwiftGRPCInfo",
5049
_SwiftInfo = "SwiftInfo",
5150
_SwiftToolchainInfo = "SwiftToolchainInfo",
5251
_SwiftUsageInfo = "SwiftUsageInfo",
5352
# rules
54-
_deprecated_swift_grpc_library = "deprecated_swift_grpc_library",
55-
_deprecated_swift_proto_library = "deprecated_swift_proto_library",
5653
_swift_binary = "swift_binary",
5754
# api
5855
_swift_common = "swift_common",
@@ -83,12 +80,9 @@ swift_proto_library_group = _swift_proto_library_group
8380
# swift symbols
8481
swift_common = _swift_common
8582
swift_usage_aspect = _swift_usage_aspect
86-
DeprecatedSwiftGRPCInfo = _DeprecatedSwiftGRPCInfo
8783
SwiftInfo = _SwiftInfo
8884
SwiftToolchainInfo = _SwiftToolchainInfo
8985
SwiftUsageInfo = _SwiftUsageInfo
90-
deprecated_swift_grpc_library = _deprecated_swift_grpc_library
91-
deprecated_swift_proto_library = _deprecated_swift_proto_library
9286
swift_binary = _swift_binary
9387
swift_compiler_plugin = _swift_compiler_plugin
9488
universal_swift_compiler_plugin = _universal_swift_compiler_plugin

doc/providers.md

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,6 @@ On this page:
1212
* [SwiftProtoCompilerInfo](#SwiftProtoCompilerInfo)
1313
* [SwiftProtoInfo](#SwiftProtoInfo)
1414
* [SwiftUsageInfo](#SwiftUsageInfo)
15-
* [DeprecatedSwiftGRPCInfo](#DeprecatedSwiftGRPCInfo)
16-
17-
<a id="DeprecatedSwiftGRPCInfo"></a>
18-
19-
## DeprecatedSwiftGRPCInfo
20-
21-
<pre>
22-
DeprecatedSwiftGRPCInfo(<a href="#DeprecatedSwiftGRPCInfo-flavor">flavor</a>, <a href="#DeprecatedSwiftGRPCInfo-direct_pbgrpc_files">direct_pbgrpc_files</a>)
23-
</pre>
24-
25-
DEPRECATED -- Propagates Swift-specific information about a `swift_grpc_library`.
26-
27-
**FIELDS**
28-
29-
30-
| Name | Description |
31-
| :------------- | :------------- |
32-
| <a id="DeprecatedSwiftGRPCInfo-flavor"></a>flavor | The flavor of GRPC that was generated. E.g. server, client, or client_stubs. |
33-
| <a id="DeprecatedSwiftGRPCInfo-direct_pbgrpc_files"></a>direct_pbgrpc_files | `Depset` of `File`s. The Swift source files (`.grpc.swift`) generated from the `.proto` files in direct dependencies. |
34-
3515

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

doc/rules.md

Lines changed: 0 additions & 184 deletions
Original file line numberDiff line numberDiff line change
@@ -36,190 +36,6 @@ On this page:
3636
* [deprecated_swift_grpc_library](#deprecated_swift_grpc_library)
3737
* [deprecated_swift_proto_library](#deprecated_swift_proto_library)
3838

39-
<a id="deprecated_swift_grpc_library"></a>
40-
41-
## deprecated_swift_grpc_library
42-
43-
<pre>
44-
deprecated_swift_grpc_library(<a href="#deprecated_swift_grpc_library-name">name</a>, <a href="#deprecated_swift_grpc_library-deps">deps</a>, <a href="#deprecated_swift_grpc_library-srcs">srcs</a>, <a href="#deprecated_swift_grpc_library-flavor">flavor</a>)
45-
</pre>
46-
47-
DEPRECATED -- Please use the swift_proto_library rule defined in //proto:proto.bzl instead.
48-
This rule will be removed in the next rules_swift major version update.
49-
If you're already using this rule, see [the proto migration doc](proto_migration.md) for infomation on how to migrate.
50-
51-
Generates a Swift library from gRPC services defined in protocol buffer sources.
52-
53-
There should be one `swift_grpc_library` for any `proto_library` that defines
54-
services. A target based on this rule can be used as a dependency anywhere that
55-
a `swift_library` can be used.
56-
57-
We recommend that `swift_grpc_library` targets be located in the same package as
58-
the `proto_library` and `swift_proto_library` targets they depend on. For more
59-
best practices around the use of Swift protocol buffer build rules, see the
60-
documentation for `swift_proto_library`.
61-
62-
#### Defining Build Targets for Services
63-
64-
Note that `swift_grpc_library` only generates the gRPC service interfaces (the
65-
`service` definitions) from the `.proto` files. Any messages defined in the same
66-
`.proto` file must be generated using a `swift_proto_library` target. Thus, the
67-
typical structure of a Swift gRPC library is similar to the following:
68-
69-
```python
70-
proto_library(
71-
name = "my_protos",
72-
srcs = ["my_protos.proto"],
73-
)
74-
75-
# Generate Swift types from the protos.
76-
swift_proto_library(
77-
name = "my_protos_swift",
78-
deps = [":my_protos"],
79-
)
80-
81-
# Generate Swift types from the services.
82-
swift_grpc_library(
83-
name = "my_protos_client_services_swift",
84-
85-
# The `srcs` attribute points to the `proto_library` containing the service
86-
# definitions...
87-
srcs = [":my_protos"],
88-
89-
# ...the `flavor` attribute specifies the kind of definitions to generate...
90-
flavor = "client",
91-
92-
# ...and the `deps` attribute points to the `swift_proto_library` that was
93-
# generated from the same `proto_library` and which contains the messages
94-
# used by those services.
95-
deps = [":my_protos_swift"],
96-
)
97-
98-
# Generate test stubs from swift services.
99-
swift_grpc_library(
100-
name = "my_protos_client_stubs_swift",
101-
102-
# The `srcs` attribute points to the `proto_library` containing the service
103-
# definitions...
104-
srcs = [":my_protos"],
105-
106-
# ...the `flavor` attribute specifies the kind of definitions to generate...
107-
flavor = "client_stubs",
108-
109-
# ...and the `deps` attribute points to the `swift_grpc_library` that was
110-
# generated from the same `proto_library` and which contains the service
111-
# implementation.
112-
deps = [":my_protos_client_services_swift"],
113-
)
114-
```
115-
116-
**ATTRIBUTES**
117-
118-
119-
| Name | Description | Type | Mandatory | Default |
120-
| :------------- | :------------- | :------------- | :------------- | :------------- |
121-
| <a id="deprecated_swift_grpc_library-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
122-
| <a id="deprecated_swift_grpc_library-deps"></a>deps | Exactly one `swift_proto_library` or `swift_grpc_library` target that contains the Swift protos used by the services being generated. Test stubs should depend on the `swift_grpc_library` implementing the service. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | `[]` |
123-
| <a id="deprecated_swift_grpc_library-srcs"></a>srcs | Exactly one `proto_library` target that defines the services being generated. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | `[]` |
124-
| <a id="deprecated_swift_grpc_library-flavor"></a>flavor | The kind of definitions that should be generated:<br><br>* `"client"` to generate client definitions.<br><br>* `"client_stubs"` to generate client test stubs.<br><br>* `"server"` to generate server definitions. | String | required | |
125-
126-
127-
<a id="deprecated_swift_proto_library"></a>
128-
129-
## deprecated_swift_proto_library
130-
131-
<pre>
132-
deprecated_swift_proto_library(<a href="#deprecated_swift_proto_library-name">name</a>, <a href="#deprecated_swift_proto_library-deps">deps</a>)
133-
</pre>
134-
135-
DEPRECATED -- Please use the swift_proto_library rule defined in //proto:proto.bzl instead.
136-
This rule will be removed in the next rules_swift major version update.
137-
If you're already using this rule, see [the proto migration doc](proto_migration.md) for infomation on how to migrate.
138-
139-
Generates a Swift library from protocol buffer sources.
140-
141-
There should be one `swift_proto_library` for any `proto_library` that you wish
142-
to depend on. A target based on this rule can be used as a dependency anywhere
143-
that a `swift_library` can be used.
144-
145-
A `swift_proto_library` target only creates a Swift module if the
146-
`proto_library` on which it depends has a non-empty `srcs` attribute. If the
147-
`proto_library` does not contain `srcs`, then no module is produced, but the
148-
`swift_proto_library` still propagates the modules of its non-empty dependencies
149-
so that those generated protos can be used by depending on the
150-
`swift_proto_library` of the "collector" target.
151-
152-
Note that the module name of the Swift library produced by this rule (if any) is
153-
based on the name of the `proto_library` target, *not* the name of the
154-
`swift_proto_library` target. In other words, if the following BUILD file were
155-
located in `//my/pkg`, the target would create a Swift module named
156-
`my_pkg_foo`:
157-
158-
```python
159-
proto_library(
160-
name = "foo",
161-
srcs = ["foo.proto"],
162-
)
163-
164-
swift_proto_library(
165-
name = "foo_swift",
166-
deps = [":foo"],
167-
)
168-
```
169-
170-
Because the Swift modules are generated from an aspect that is applied to the
171-
`proto_library` targets, the module name and other compilation flags for the
172-
resulting Swift modules cannot be changed.
173-
174-
#### Tip: Where to locate `swift_proto_library` targets
175-
176-
Convention is to put the `swift_proto_library` in the same `BUILD` file as the
177-
`proto_library` it is generating for (just like all the other
178-
`LANG_proto_library` rules). This lets anyone needing the protos in Swift share
179-
the single rule as well as making it easier to realize what proto files are in
180-
use in what contexts.
181-
182-
This is not a requirement, however, as it may not be possible for Bazel
183-
workspaces that create `swift_proto_library` targets that depend on
184-
`proto_library` targets from different repositories.
185-
186-
#### Tip: Avoid `import` only `.proto` files
187-
188-
Avoid creating a `.proto` file that just contains `import` directives of all the
189-
other `.proto` files you need. While this does _group_ the protos into this new
190-
target, it comes with some high costs. This causes the proto compiler to parse
191-
all those files and invoke the generator for an otherwise empty source file.
192-
That empty source file then has to get compiled, but it will have dependencies
193-
on the full deps chain of the imports (recursively). The Swift compiler must
194-
load all of these module dependencies, which can be fairly slow if there are
195-
many of them, so this method of grouping via a `.proto` file actually ends up
196-
creating build steps that slow down the build.
197-
198-
#### Tip: Resolving unused import warnings
199-
200-
If you see warnings like the following during your build:
201-
202-
```
203-
path/file.proto: warning: Import other/path/file.proto but not used.
204-
```
205-
206-
The proto compiler is letting you know that you have an `import` statement
207-
loading a file from which nothing is used, so it is wasted work. The `import`
208-
can be removed (in this case, `import other/path/file.proto` could be removed
209-
from `path/file.proto`). These warnings can also mean that the `proto_library`
210-
has `deps` that aren't needed. Removing those along with the `import`
211-
statement(s) will speed up downstream Swift compilation actions, because it
212-
prevents unused modules from being loaded by `swiftc`.
213-
214-
**ATTRIBUTES**
215-
216-
217-
| Name | Description | Type | Mandatory | Default |
218-
| :------------- | :------------- | :------------- | :------------- | :------------- |
219-
| <a id="deprecated_swift_proto_library-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
220-
| <a id="deprecated_swift_proto_library-deps"></a>deps | Exactly one `proto_library` target (or any target that propagates a `proto` provider) from which the Swift library should be generated. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | `[]` |
221-
222-
22339
<a id="swift_binary"></a>
22440

22541
## swift_binary

examples/xplatform/deprecated_grpc/BUILD

Lines changed: 0 additions & 84 deletions
This file was deleted.

0 commit comments

Comments
 (0)