Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate the umbrella proto.bzl file #1236

Merged
merged 1 commit into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions doc/doc.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,31 @@ For example:
```build
load("@build_bazel_rules_swift//swift:swift_library.bzl", "swift_library")
load("@build_bazel_rules_swift//proto:proto.bzl", "swift_proto_library")
load("@build_bazel_rules_swift//proto:swift_proto_library.bzl", "swift_proto_library")
```
"""

load(
"//proto:proto.bzl",
# providers
_SwiftProtoCompilerInfo = "SwiftProtoCompilerInfo",
_SwiftProtoInfo = "SwiftProtoInfo",
# api
"//proto:swift_proto_common.bzl",
_swift_proto_common = "swift_proto_common",
# rules
)
load(
"//proto:swift_proto_compiler.bzl",
_swift_proto_compiler = "swift_proto_compiler",
)
load(
"//proto:swift_proto_library.bzl",
_swift_proto_library = "swift_proto_library",
)
load(
"//proto:swift_proto_library_group.bzl",
_swift_proto_library_group = "swift_proto_library_group",
)
load(
"//swift:providers.bzl",
_SwiftInfo = "SwiftInfo",
_SwiftProtoCompilerInfo = "SwiftProtoCompilerInfo",
_SwiftProtoInfo = "SwiftProtoInfo",
_SwiftToolchainInfo = "SwiftToolchainInfo",
)
load("//swift:swift_binary.bzl", _swift_binary = "swift_binary")
Expand Down
6 changes: 3 additions & 3 deletions doc/rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ For example:

```build
load("@build_bazel_rules_swift//swift:swift_library.bzl", "swift_library")
load("@build_bazel_rules_swift//proto:proto.bzl", "swift_proto_library")
load("@build_bazel_rules_swift//proto:swift_proto_library.bzl", "swift_proto_library")
```
On this page:

Expand Down Expand Up @@ -535,7 +535,7 @@ Generates a Swift static library from one or more targets producing `ProtoInfo`.

```python
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//proto:proto.bzl", "swift_proto_library")
load("//proto:swift_proto_library.bzl", "swift_proto_library")

proto_library(
name = "foo",
Expand All @@ -553,7 +553,7 @@ swift_proto_library targets which mirror the dependencies between the proto targ

```python
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//proto:proto.bzl", "swift_proto_library")
load("//proto:swift_proto_library.bzl", "swift_proto_library")

proto_library(
name = "bar",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,9 @@
Defines a rule for compiling Swift source files from ProtoInfo providers.
"""

load(
"@bazel_skylib//lib:paths.bzl",
"paths",
)
load(
"//proto:proto.bzl",
"SwiftProtoCompilerInfo",
"swift_proto_common",
)
load("//swift:providers.bzl", "SwiftInfo")
load("@bazel_skylib//lib:paths.bzl", "paths")
load("//proto:swift_proto_common.bzl", "swift_proto_common")
load("//swift:providers.bzl", "SwiftInfo", "SwiftProtoCompilerInfo")

def _custom_swift_proto_compile(label, actions, swift_proto_compiler_info, additional_compiler_info, proto_infos, module_mappings):
"""Compiles Swift source files from `ProtoInfo` providers.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
load(
"//proto:proto.bzl",
"swift_proto_library",
)
load("//proto:swift_proto_library.bzl", "swift_proto_library")

swift_proto_library(
name = "example_proto_swift",
Expand Down
2 changes: 1 addition & 1 deletion examples/xplatform/grpc/service/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//proto:proto.bzl", "swift_proto_library")
load("//proto:swift_proto_library.bzl", "swift_proto_library")

proto_library(
name = "service_proto",
Expand Down
10 changes: 2 additions & 8 deletions examples/xplatform/proto/BUILD
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
load(
"@rules_proto//proto:defs.bzl",
"proto_library",
)
load(
"//proto:proto.bzl",
"swift_proto_library",
)
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//proto:swift_proto_library.bzl", "swift_proto_library")
load("//swift:swift_binary.bzl", "swift_binary")

licenses(["notice"])
Expand Down
5 changes: 1 addition & 4 deletions examples/xplatform/proto_files/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ load(
"@rules_proto//proto:defs.bzl",
"proto_library",
)
load(
"//proto:proto.bzl",
"swift_proto_library",
)
load("//proto:swift_proto_library.bzl", "swift_proto_library")
load("//swift:swift_binary.bzl", "swift_binary")

proto_library(
Expand Down
10 changes: 2 additions & 8 deletions examples/xplatform/proto_glob/BUILD
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
load(
"@rules_proto//proto:defs.bzl",
"proto_library",
)
load(
"//proto:proto.bzl",
"swift_proto_library",
)
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//proto:swift_proto_library.bzl", "swift_proto_library")
load("//swift:swift_binary.bzl", "swift_binary")

proto_library(
Expand Down
7 changes: 2 additions & 5 deletions examples/xplatform/proto_library_group/service/BUILD
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
load("@rules_proto//proto:defs.bzl", "proto_library")
load(
"//proto:proto.bzl",
"swift_proto_library",
"swift_proto_library_group",
)
load("//proto:swift_proto_library.bzl", "swift_proto_library")
load("//proto:swift_proto_library_group.bzl", "swift_proto_library_group")

proto_library(
name = "service_proto",
Expand Down
10 changes: 2 additions & 8 deletions examples/xplatform/proto_path/protos/package_1/BUILD
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
load(
"@rules_proto//proto:defs.bzl",
"proto_library",
)
load(
"//proto:proto.bzl",
"swift_proto_library",
)
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//proto:swift_proto_library.bzl", "swift_proto_library")

proto_library(
name = "message_1_proto",
Expand Down
10 changes: 2 additions & 8 deletions examples/xplatform/proto_path/protos/package_2/BUILD
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
load(
"@rules_proto//proto:defs.bzl",
"proto_library",
)
load(
"//proto:proto.bzl",
"swift_proto_library",
)
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//proto:swift_proto_library.bzl", "swift_proto_library")

proto_library(
name = "message_2_proto",
Expand Down
5 changes: 1 addition & 4 deletions proto/compilers/BUILD
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load(
"//proto:proto.bzl",
"swift_proto_compiler",
)
load("//proto:swift_proto_compiler.bzl", "swift_proto_compiler")
load(
"//proto/compilers:swift_proto_compiler_macros.bzl",
"GRPC_VARIANT_CLIENT",
Expand Down
10 changes: 2 additions & 8 deletions proto/compilers/swift_proto_compiler_macros.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,8 @@
Utilities for proto compiler rules.
"""

load(
"@bazel_skylib//lib:dicts.bzl",
"dicts",
)
load(
"//proto:proto.bzl",
"swift_proto_compiler",
)
load("@bazel_skylib//lib:dicts.bzl", "dicts")
load("//proto:swift_proto_compiler.bzl", "swift_proto_compiler")

# NOTE: The ProtoPathModuleMappings option is set internally for all plugins.
# This is used to inform the plugins which Swift module the generated code for each plugin is located in.
Expand Down
10 changes: 9 additions & 1 deletion proto/proto.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""Bazel rules to define Swift proto libraries and compilers."""
"""BUILD rules to define Swift proto libraries and compilers.
**NOTE:** This file is deprecated. To avoid having Bazel do more work than
necessary, users should import each rule/build definition they use from the
`.bzl` file that defines it in this directory.
Do not import any definitions directly from the `internal` directory; those are
meant for build rule use only.
"""

load(
"//proto:swift_proto_common.bzl",
Expand Down
4 changes: 2 additions & 2 deletions proto/swift_proto_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ Generates a Swift static library from one or more targets producing `ProtoInfo`.
```python
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//proto:proto.bzl", "swift_proto_library")
load("//proto:swift_proto_library.bzl", "swift_proto_library")
proto_library(
name = "foo",
Expand All @@ -173,7 +173,7 @@ swift_proto_library targets which mirror the dependencies between the proto targ
```python
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//proto:proto.bzl", "swift_proto_library")
load("//proto:swift_proto_library.bzl", "swift_proto_library")
proto_library(
name = "bar",
Expand Down