From 1d8ba3bda3616f108eb11159d6efa93892ecfd55 Mon Sep 17 00:00:00 2001 From: Aaron Sky Date: Sat, 30 Nov 2024 15:03:21 -0500 Subject: [PATCH] wip: upgrade stardoc and protobuf to restore Bazel HEAD CI --- .bcr/presubmit.yml | 3 +- MODULE.bazel | 22 +------- doc/api.md | 52 ++++++++++++++----- doc/proto_migration.md | 2 +- doc/providers.md | 22 ++++++-- doc/rules.md | 46 ++++++++++++++-- doc/setup.md | 2 + .../custom_swift_proto_compiler/protos/BUILD | 5 +- examples/xplatform/grpc/service/BUILD | 4 +- examples/xplatform/proto/BUILD | 4 +- examples/xplatform/proto_files/BUILD | 5 +- examples/xplatform/proto_glob/BUILD | 2 +- .../proto_library_group/request/BUILD | 7 +-- .../proto_library_group/response/BUILD | 5 +- .../proto_library_group/service/BUILD | 2 +- .../proto_path/protos/package_1/BUILD | 2 +- .../proto_path/protos/package_2/BUILD | 2 +- proto/BUILD | 4 +- proto/swift_proto_library.bzl | 9 ++-- proto/swift_proto_library_group.bzl | 5 +- swift/BUILD | 3 +- swift/extras.bzl | 10 +--- swift/repositories.bzl | 10 ---- third_party/BUILD | 3 +- third_party/bazel_protos/BUILD | 6 +-- third_party/rules_proto/BUILD | 9 ---- tools/protoc_wrapper/BUILD | 4 +- 27 files changed, 133 insertions(+), 117 deletions(-) delete mode 100644 third_party/rules_proto/BUILD diff --git a/.bcr/presubmit.yml b/.bcr/presubmit.yml index 130e94264..8110cce83 100644 --- a/.bcr/presubmit.yml +++ b/.bcr/presubmit.yml @@ -8,8 +8,7 @@ matrix: - 7.x # TODO: Uncomment once Bazel 8 is released # - 8.x - # TODO: Uncomment once we support HEAD again - # - latest + - last_green platform: - ubuntu2004 tasks: diff --git a/MODULE.bazel b/MODULE.bazel index ba159bfa3..26ee51e16 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -11,8 +11,7 @@ bazel_dep(name = "bazel_skylib", version = "1.3.0") bazel_dep(name = "apple_support", version = "1.15.1", repo_name = "build_bazel_apple_support") bazel_dep(name = "rules_cc", version = "0.0.2") bazel_dep(name = "platforms", version = "0.0.9") -bazel_dep(name = "protobuf", version = "21.7", repo_name = "com_google_protobuf") -bazel_dep(name = "rules_proto", version = "5.3.0-21.7") +bazel_dep(name = "protobuf", version = "29.0") bazel_dep(name = "nlohmann_json", version = "3.6.1", repo_name = "com_github_nlohmann_json") bazel_dep( name = "swift_argument_parser", @@ -43,7 +42,7 @@ register_toolchains("@build_bazel_rules_swift_local_config//:all") # Dev dependencies bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.5.0", dev_dependency = True) bazel_dep(name = "gazelle", version = "0.33.0", dev_dependency = True, repo_name = "bazel_gazelle") -bazel_dep(name = "stardoc", version = "0.6.2", dev_dependency = True, repo_name = "io_bazel_stardoc") +bazel_dep(name = "stardoc", version = "0.7.2", dev_dependency = True, repo_name = "io_bazel_stardoc") http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") @@ -54,20 +53,3 @@ http_archive( strip_prefix = "swift-syntax-01fc3e3ed4d26121c06790abf8fe5ddaa22a4cc5", url = "https://github.com/apple/swift-syntax/archive/01fc3e3ed4d26121c06790abf8fe5ddaa22a4cc5.tar.gz", ) - -# TODO: Remove override when a protobuf release is available that supports -# Bazel 8 -archive_override( - module_name = "protobuf", - integrity = "sha256-+dloYVexGlGsxKLTARuU4KXZ5ORo/BWPR6obFk73d+Q=", - strip_prefix = "protobuf-b93b8e5f64ed922d101759380d7c6a2bbe474e26", - urls = ["https://github.com/protocolbuffers/protobuf/archive/b93b8e5f64ed922d101759380d7c6a2bbe474e26.zip"], -) - -# TODO: Remove override when a protobuf release that marks `stardoc` as a -# dev_dependency is available, until then it's upgrading our stardoc version -# so override it here. -single_version_override( - module_name = "stardoc", - version = "0.6.2", -) diff --git a/doc/api.md b/doc/api.md index 655ed1deb..9112bb55d 100644 --- a/doc/api.md +++ b/doc/api.md @@ -13,8 +13,10 @@ module. ## create_swift_interop_info
-create_swift_interop_info(exclude_headers, module_map, module_name, requested_features, suppressed,
-                          swift_infos, unsupported_features)
+load("@rules_swift//doc:doc.bzl", "create_swift_interop_info")
+
+create_swift_interop_info(*, exclude_headers, module_map, module_name, requested_features,
+                          suppressed, swift_infos, unsupported_features)
 
Returns a provider that lets a target expose C/Objective-C APIs to Swift. @@ -74,7 +76,9 @@ A provider whose type/layout is an implementation detail and should not ## derive_swift_module_name
-derive_swift_module_name(args)
+load("@rules_swift//doc:doc.bzl", "derive_swift_module_name")
+
+derive_swift_module_name(*args)
 
Returns a derived module name from the given build label. @@ -112,6 +116,8 @@ The module name derived from the label. ## is_swift_overlay
+load("@rules_swift//doc:doc.bzl", "is_swift_overlay")
+
 is_swift_overlay(target)
 
@@ -140,6 +146,8 @@ True if the target is a `swift_overlay`, otherwise False. ## swift_common.cc_feature_configuration
+load("@rules_swift//doc:doc.bzl", "swift_common")
+
 swift_common.cc_feature_configuration(feature_configuration)
 
@@ -164,7 +172,9 @@ A C++ `FeatureConfiguration` value (see ## swift_common.compile
-swift_common.compile(actions, additional_inputs, cc_infos, copts, defines, exec_group,
+load("@rules_swift//doc:doc.bzl", "swift_common")
+
+swift_common.compile(*, actions, additional_inputs, cc_infos, copts, defines, exec_group,
                      extra_swift_infos, feature_configuration, generated_header_name, is_test,
                      include_dev_srch_paths, module_name, package_name, plugins, private_cc_infos,
                      private_swift_infos, srcs, swift_infos, swift_toolchain, target_name,
@@ -249,7 +259,9 @@ A `struct` with the following fields:
 ## swift_common.compile_module_interface
 
 
-swift_common.compile_module_interface(actions, clang_module, compilation_contexts, copts,
+load("@rules_swift//doc:doc.bzl", "swift_common")
+
+swift_common.compile_module_interface(*, actions, clang_module, compilation_contexts, copts,
                                       exec_group, feature_configuration, is_framework, module_name,
                                       swiftinterface_file, swift_infos, swift_toolchain, target_name)
 
@@ -289,7 +301,9 @@ A Swift module context (as returned by `create_swift_module_context`) ## swift_common.configure_features
-swift_common.configure_features(ctx, swift_toolchain, requested_features, unsupported_features)
+load("@rules_swift//doc:doc.bzl", "swift_common")
+
+swift_common.configure_features(ctx, swift_toolchain, *, requested_features, unsupported_features)
 
Creates a feature configuration to be passed to Swift build APIs. @@ -323,6 +337,8 @@ An opaque value representing the feature configuration that can be ## swift_common.create_compilation_context
+load("@rules_swift//doc:doc.bzl", "swift_common")
+
 swift_common.create_compilation_context(defines, srcs, transitive_modules)
 
@@ -356,8 +372,10 @@ A `struct` containing four fields: ## swift_common.create_linking_context_from_compilation_outputs
-swift_common.create_linking_context_from_compilation_outputs(actions, additional_inputs, alwayslink,
-                                                             compilation_outputs,
+load("@rules_swift//doc:doc.bzl", "swift_common")
+
+swift_common.create_linking_context_from_compilation_outputs(*, actions, additional_inputs,
+                                                             alwayslink, compilation_outputs,
                                                              feature_configuration, is_test,
                                                              include_dev_srch_paths, label,
                                                              linking_contexts, module_context, name,
@@ -405,7 +423,9 @@ A tuple of `(CcLinkingContext, CcLinkingOutputs)` containing the linking
 ## swift_common.extract_symbol_graph
 
 
-swift_common.extract_symbol_graph(actions, compilation_contexts, emit_extension_block_symbols,
+load("@rules_swift//doc:doc.bzl", "swift_common")
+
+swift_common.extract_symbol_graph(*, actions, compilation_contexts, emit_extension_block_symbols,
                                   feature_configuration, include_dev_srch_paths, minimum_access_level,
                                   module_name, output_dir, swift_infos, swift_toolchain)
 
@@ -434,7 +454,9 @@ Extracts the symbol graph from a Swift module. ## swift_common.get_toolchain
-swift_common.get_toolchain(ctx, exec_group, mandatory, attr)
+load("@rules_swift//doc:doc.bzl", "swift_common")
+
+swift_common.get_toolchain(ctx, *, exec_group, mandatory, attr)
 
Gets the Swift toolchain associated with the rule or aspect. @@ -460,6 +482,8 @@ A `SwiftToolchainInfo` provider, or `None` if the toolchain was not ## swift_common.is_enabled
+load("@rules_swift//doc:doc.bzl", "swift_common")
+
 swift_common.is_enabled(feature_configuration, feature_name)
 
@@ -488,7 +512,9 @@ check it. ## swift_common.precompile_clang_module
-swift_common.precompile_clang_module(actions, cc_compilation_context, exec_group,
+load("@rules_swift//doc:doc.bzl", "swift_common")
+
+swift_common.precompile_clang_module(*, actions, cc_compilation_context, exec_group,
                                      feature_configuration, module_map_file, module_name,
                                      swift_toolchain, target_name, swift_infos)
 
@@ -521,7 +547,9 @@ A struct containing the precompiled module and optional indexstore directory, ## swift_common.use_toolchain
-swift_common.use_toolchain(mandatory)
+load("@rules_swift//doc:doc.bzl", "swift_common")
+
+swift_common.use_toolchain(*, mandatory)
 
Returns a list of toolchain types needed to use the Swift toolchain. diff --git a/doc/proto_migration.md b/doc/proto_migration.md index f08ef0b59..b55f3e723 100644 --- a/doc/proto_migration.md +++ b/doc/proto_migration.md @@ -116,7 +116,7 @@ proto_library( name = "bar_proto", srcs = ["bar.proto"], deps = [ - "@com_google_protobuf//:api_proto", + "@protobuf//:api_proto", ":foo_proto", ], ) diff --git a/doc/providers.md b/doc/providers.md index b905e6783..00c48f40a 100644 --- a/doc/providers.md +++ b/doc/providers.md @@ -17,7 +17,9 @@ On this page: ## SwiftInfo
-SwiftInfo(direct_modules, transitive_modules)
+load("@rules_swift//doc:doc.bzl", "SwiftInfo")
+
+SwiftInfo(*, direct_swift_infos, modules, swift_infos)
 
Contains information about the compiled artifacts of a Swift module. @@ -48,8 +50,15 @@ where the arguments are: When reading an existing `SwiftInfo` provider, it has the two fields described below. -**FIELDS** +**CONSTRUCTOR PARAMETERS** +| Name | Description | Default Value | +| :------------- | :------------- | :------------- | +| direct_swift_infos |

-

| `[]` | +| modules |

-

| `[]` | +| swift_infos |

-

| `[]` | + +**FIELDS** | Name | Description | | :------------- | :------------- | @@ -62,6 +71,8 @@ below. ## SwiftProtoCompilerInfo
+load("@rules_swift//doc:doc.bzl", "SwiftProtoCompilerInfo")
+
 SwiftProtoCompilerInfo(bundled_proto_paths, compile, compiler_deps, internal)
 
@@ -69,7 +80,6 @@ Provides information needed to generate Swift code from `ProtoInfo` providers **FIELDS** - | Name | Description | | :------------- | :------------- | | bundled_proto_paths | List of proto paths for which to skip generation because they're built into the modules imported by the generated Swift proto code, e.g., SwiftProtobuf. | @@ -83,6 +93,8 @@ Provides information needed to generate Swift code from `ProtoInfo` providers ## SwiftProtoInfo
+load("@rules_swift//doc:doc.bzl", "SwiftProtoInfo")
+
 SwiftProtoInfo(module_name, module_mappings, direct_pbswift_files, pbswift_files)
 
@@ -90,7 +102,6 @@ Propagates Swift-specific information about a `proto_library`. **FIELDS** - | Name | Description | | :------------- | :------------- | | module_name | The name of the Swift module compiled from the `swift_proto_library` which produced this provider. | @@ -104,6 +115,8 @@ Propagates Swift-specific information about a `proto_library`. ## SwiftToolchainInfo
+load("@rules_swift//doc:doc.bzl", "SwiftToolchainInfo")
+
 SwiftToolchainInfo(action_configs, cc_language, cc_toolchain_info, clang_implicit_deps_providers,
                    const_protocols_to_gather, cross_import_overlays, debug_outputs_provider,
                    developer_dirs, entry_point_linkopts_provider, feature_allowlists,
@@ -117,7 +130,6 @@ that use the toolchain.
 
 **FIELDS**
 
-
 | Name  | Description |
 | :------------- | :------------- |
 | action_configs |  This field is an internal implementation detail of the build rules.    |
diff --git a/doc/rules.md b/doc/rules.md
index c1c62514e..81a64b63f 100644
--- a/doc/rules.md
+++ b/doc/rules.md
@@ -41,6 +41,8 @@ On this page:
 ## swift_binary
 
 
+load("@rules_swift//doc:doc.bzl", "swift_binary")
+
 swift_binary(name, deps, srcs, data, copts, defines, linkopts, malloc, module_name, package_name,
              plugins, stamp, swiftc_inputs)
 
@@ -84,6 +86,8 @@ please use one of the platform-specific application rules in ## swift_compiler_plugin
+load("@rules_swift//doc:doc.bzl", "swift_compiler_plugin")
+
 swift_compiler_plugin(name, deps, srcs, data, copts, defines, linkopts, malloc, module_name,
                       package_name, plugins, stamp, swiftc_inputs)
 
@@ -172,6 +176,8 @@ swift_library( ## swift_compiler_plugin_import
+load("@rules_swift//doc:doc.bzl", "swift_compiler_plugin_import")
+
 swift_compiler_plugin_import(name, executable, module_names)
 
@@ -194,6 +200,8 @@ using `swift_compiler_plugin`. ## swift_cross_import_overlay
+load("@rules_swift//doc:doc.bzl", "swift_cross_import_overlay")
+
 swift_cross_import_overlay(name, deps, bystanding_module, bystanding_module_name, declaring_module,
                            declaring_module_name)
 
@@ -238,6 +246,8 @@ the future, this rule is not recommended for other widespread use. ## swift_feature_allowlist
+load("@rules_swift//doc:doc.bzl", "swift_feature_allowlist")
+
 swift_feature_allowlist(name, aspect_ids, managed_features, packages)
 
@@ -269,6 +279,8 @@ package. ## swift_import
+load("@rules_swift//doc:doc.bzl", "swift_import")
+
 swift_import(name, deps, data, archives, module_name, plugins, swiftdoc, swiftinterface,
              swiftmodule)
 
@@ -311,6 +323,8 @@ uses the API marked with `@_spi`. ## swift_interop_hint
+load("@rules_swift//doc:doc.bzl", "swift_interop_hint")
+
 swift_interop_hint(name, exclude_hdrs, module_map, module_name, suppressed)
 
@@ -453,6 +467,8 @@ its transitive dependencies be propagated. ## swift_library
+load("@rules_swift//doc:doc.bzl", "swift_library")
+
 swift_library(name, deps, srcs, data, always_include_developer_search_paths, alwayslink, copts,
               defines, generated_header_name, generates_header, library_evolution, linkopts,
               linkstatic, module_name, package_name, plugins, private_deps, swiftc_inputs)
@@ -490,6 +506,8 @@ Compiles and links Swift code into a static library and Swift module.
 ## swift_library_group
 
 
+load("@rules_swift//doc:doc.bzl", "swift_library_group")
+
 swift_library_group(name, deps)
 
@@ -514,6 +532,8 @@ libraries directly. ## swift_module_mapping
+load("@rules_swift//doc:doc.bzl", "swift_module_mapping")
+
 swift_module_mapping(name, aliases)
 
@@ -579,6 +599,8 @@ source asked to `import Utils`. ## swift_module_mapping_test
+load("@rules_swift//doc:doc.bzl", "swift_module_mapping_test")
+
 swift_module_mapping_test(name, deps, exclude, mapping)
 
@@ -613,6 +635,8 @@ remaining modules collected are not present in the `aliases` of the ## swift_overlay
+load("@rules_swift//doc:doc.bzl", "swift_overlay")
+
 swift_overlay(name, deps, srcs, always_include_developer_search_paths, alwayslink, copts, defines,
               library_evolution, linkopts, linkstatic, package_name, plugins, private_deps,
               swiftc_inputs)
@@ -714,6 +738,8 @@ almost always an anti-pattern.
 ## swift_package_configuration
 
 
+load("@rules_swift//doc:doc.bzl", "swift_package_configuration")
+
 swift_package_configuration(name, configured_features, packages)
 
@@ -739,6 +765,8 @@ target's label is included by the package specifications in the configuration. ## swift_proto_compiler
+load("@rules_swift//doc:doc.bzl", "swift_proto_compiler")
+
 swift_proto_compiler(name, deps, bundled_proto_paths, plugin, plugin_name, plugin_option_allowlist,
                      plugin_options, protoc, suffixes)
 
@@ -766,6 +794,8 @@ swift_proto_compiler(name, name, deps, srcs, data, additional_compiler_deps, additional_compiler_info, always_include_developer_search_paths, alwayslink, compilers, copts, defines, generated_header_name, generates_header, library_evolution, linkopts, linkstatic, @@ -775,7 +805,7 @@ swift_proto_library(name, +load("@rules_swift//doc:doc.bzl", "swift_proto_library_group") + swift_proto_library_group(name, compiler, proto)
@@ -920,6 +952,8 @@ swift_binary( ## swift_test
+load("@rules_swift//doc:doc.bzl", "swift_test")
+
 swift_test(name, deps, srcs, data, copts, defines, discover_tests, env, linkopts, malloc,
            module_name, package_name, plugins, stamp, swiftc_inputs)
 
@@ -1013,6 +1047,8 @@ root of your workspace (i.e. `$(SRCROOT)`). ## universal_swift_compiler_plugin
+load("@rules_swift//doc:doc.bzl", "universal_swift_compiler_plugin")
+
 universal_swift_compiler_plugin(name, plugin)
 
@@ -1064,11 +1100,13 @@ swift_library( ## mixed_language_library
-mixed_language_library(name, alwayslink, clang_copts, clang_defines, clang_srcs, data,
+load("@rules_swift//doc:doc.bzl", "mixed_language_library")
+
+mixed_language_library(*, name, alwayslink, clang_copts, clang_defines, clang_srcs, data,
                        enable_modules, hdrs, includes, linkopts, module_map, module_name,
                        non_arc_srcs, package_name, private_deps, sdk_dylibs, sdk_frameworks,
                        swift_copts, swift_defines, swift_srcs, swiftc_inputs, textual_hdrs,
-                       umbrella_header, weak_sdk_frameworks, deps, kwargs)
+                       umbrella_header, weak_sdk_frameworks, deps, **kwargs)
 
Creates a mixed language library from a Clang and Swift library target pair. diff --git a/doc/setup.md b/doc/setup.md index 933e79208..90c42bacd 100644 --- a/doc/setup.md +++ b/doc/setup.md @@ -5,6 +5,8 @@ ## swift_rules_dependencies
+load("@rules_swift//swift:repositories.bzl", "swift_rules_dependencies")
+
 swift_rules_dependencies(include_bzlmod_ready_dependencies)
 
diff --git a/examples/xplatform/custom_swift_proto_compiler/protos/BUILD b/examples/xplatform/custom_swift_proto_compiler/protos/BUILD index 4e1ca608f..de0bc7134 100644 --- a/examples/xplatform/custom_swift_proto_compiler/protos/BUILD +++ b/examples/xplatform/custom_swift_proto_compiler/protos/BUILD @@ -1,7 +1,4 @@ -load( - "@rules_proto//proto:defs.bzl", - "proto_library", -) +load("@protobuf//bazel:proto_library.bzl", "proto_library") proto_library( name = "example_proto", diff --git a/examples/xplatform/grpc/service/BUILD b/examples/xplatform/grpc/service/BUILD index 3c5d43045..e50273f47 100644 --- a/examples/xplatform/grpc/service/BUILD +++ b/examples/xplatform/grpc/service/BUILD @@ -1,4 +1,4 @@ -load("@rules_proto//proto:defs.bzl", "proto_library") +load("@protobuf//bazel:proto_library.bzl", "proto_library") load("//proto:swift_proto_library.bzl", "swift_proto_library") proto_library( @@ -8,7 +8,7 @@ proto_library( "service_messages.proto", ], deps = [ - "@com_google_protobuf//:any_proto", + "@protobuf//:any_proto", ], ) diff --git a/examples/xplatform/proto/BUILD b/examples/xplatform/proto/BUILD index 6b62eaf2c..1b922b963 100644 --- a/examples/xplatform/proto/BUILD +++ b/examples/xplatform/proto/BUILD @@ -1,4 +1,4 @@ -load("@rules_proto//proto:defs.bzl", "proto_library") +load("@protobuf//bazel:proto_library.bzl", "proto_library") load("//proto:swift_proto_library.bzl", "swift_proto_library") load("//swift:swift_binary.bzl", "swift_binary") @@ -8,7 +8,7 @@ proto_library( name = "example_proto", srcs = ["example.proto"], deps = [ - "@com_google_protobuf//:api_proto", + "@protobuf//:api_proto", ], ) diff --git a/examples/xplatform/proto_files/BUILD b/examples/xplatform/proto_files/BUILD index f43ebeec7..e85cb3f61 100644 --- a/examples/xplatform/proto_files/BUILD +++ b/examples/xplatform/proto_files/BUILD @@ -1,7 +1,4 @@ -load( - "@rules_proto//proto:defs.bzl", - "proto_library", -) +load("@protobuf//bazel:proto_library.bzl", "proto_library") load("//proto:swift_proto_library.bzl", "swift_proto_library") load("//swift:swift_binary.bzl", "swift_binary") diff --git a/examples/xplatform/proto_glob/BUILD b/examples/xplatform/proto_glob/BUILD index 3de3cdcec..00fb73bd6 100644 --- a/examples/xplatform/proto_glob/BUILD +++ b/examples/xplatform/proto_glob/BUILD @@ -1,4 +1,4 @@ -load("@rules_proto//proto:defs.bzl", "proto_library") +load("@protobuf//bazel:proto_library.bzl", "proto_library") load("//proto:swift_proto_library.bzl", "swift_proto_library") load("//swift:swift_binary.bzl", "swift_binary") diff --git a/examples/xplatform/proto_library_group/request/BUILD b/examples/xplatform/proto_library_group/request/BUILD index ae1b9e7d0..ec48b8beb 100644 --- a/examples/xplatform/proto_library_group/request/BUILD +++ b/examples/xplatform/proto_library_group/request/BUILD @@ -1,13 +1,10 @@ -load( - "@rules_proto//proto:defs.bzl", - "proto_library", -) +load("@protobuf//bazel:proto_library.bzl", "proto_library") proto_library( name = "request_proto", srcs = glob(["*.proto"]), visibility = ["//visibility:public"], deps = [ - "@com_google_protobuf//:any_proto", + "@protobuf//:any_proto", ], ) diff --git a/examples/xplatform/proto_library_group/response/BUILD b/examples/xplatform/proto_library_group/response/BUILD index 9c6b1d3ae..63e96a81f 100644 --- a/examples/xplatform/proto_library_group/response/BUILD +++ b/examples/xplatform/proto_library_group/response/BUILD @@ -1,7 +1,4 @@ -load( - "@rules_proto//proto:defs.bzl", - "proto_library", -) +load("@protobuf//bazel:proto_library.bzl", "proto_library") proto_library( name = "response_proto", diff --git a/examples/xplatform/proto_library_group/service/BUILD b/examples/xplatform/proto_library_group/service/BUILD index e8968ea95..0d66349bb 100644 --- a/examples/xplatform/proto_library_group/service/BUILD +++ b/examples/xplatform/proto_library_group/service/BUILD @@ -1,4 +1,4 @@ -load("@rules_proto//proto:defs.bzl", "proto_library") +load("@protobuf//bazel:proto_library.bzl", "proto_library") load("//proto:swift_proto_library.bzl", "swift_proto_library") load("//proto:swift_proto_library_group.bzl", "swift_proto_library_group") diff --git a/examples/xplatform/proto_path/protos/package_1/BUILD b/examples/xplatform/proto_path/protos/package_1/BUILD index 6180b5abd..98792e7e6 100644 --- a/examples/xplatform/proto_path/protos/package_1/BUILD +++ b/examples/xplatform/proto_path/protos/package_1/BUILD @@ -1,4 +1,4 @@ -load("@rules_proto//proto:defs.bzl", "proto_library") +load("@protobuf//bazel:proto_library.bzl", "proto_library") load("//proto:swift_proto_library.bzl", "swift_proto_library") proto_library( diff --git a/examples/xplatform/proto_path/protos/package_2/BUILD b/examples/xplatform/proto_path/protos/package_2/BUILD index 565231d30..cca190702 100644 --- a/examples/xplatform/proto_path/protos/package_2/BUILD +++ b/examples/xplatform/proto_path/protos/package_2/BUILD @@ -1,4 +1,4 @@ -load("@rules_proto//proto:defs.bzl", "proto_library") +load("@protobuf//bazel:proto_library.bzl", "proto_library") load("//proto:swift_proto_library.bzl", "swift_proto_library") proto_library( diff --git a/proto/BUILD b/proto/BUILD index ee9d2647e..d243bf20f 100644 --- a/proto/BUILD +++ b/proto/BUILD @@ -39,7 +39,7 @@ bzl_library( "//swift/internal:toolchain_utils", "//swift/internal:utils", "@bazel_skylib//lib:dicts", - "@rules_proto//proto:defs", + "@protobuf//bazel/common:proto_info_bzl", ], ) @@ -59,7 +59,7 @@ bzl_library( "//swift/internal:toolchain_utils", "//swift/internal:utils", "@bazel_skylib//lib:dicts", - "@rules_proto//proto:defs", + "@protobuf//bazel/common:proto_info_bzl", ], ) diff --git a/proto/swift_proto_library.bzl b/proto/swift_proto_library.bzl index 6b71147ea..3045b1ab2 100644 --- a/proto/swift_proto_library.bzl +++ b/proto/swift_proto_library.bzl @@ -20,10 +20,7 @@ load( "@bazel_skylib//lib:dicts.bzl", "dicts", ) -load( - "@rules_proto//proto:defs.bzl", - "ProtoInfo", -) +load("@protobuf//bazel/common:proto_info.bzl", "ProtoInfo") load("//swift:module_name.bzl", "derive_swift_module_name") load("//swift:providers.bzl", "SwiftProtoCompilerInfo") load("//swift:swift_clang_module_aspect.bzl", "swift_clang_module_aspect") @@ -154,7 +151,7 @@ on which fields are accepted and how they are used. Generates a Swift static library from one or more targets producing `ProtoInfo`. ```python -load("@rules_proto//proto:defs.bzl", "proto_library") +load("@protobuf//bazel:proto_library.bzl", "proto_library") load("//proto:swift_proto_library.bzl", "swift_proto_library") proto_library( @@ -172,7 +169,7 @@ If your protos depend on protos from other targets, add dependencies between the swift_proto_library targets which mirror the dependencies between the proto targets. ```python -load("@rules_proto//proto:defs.bzl", "proto_library") +load("@protobuf//bazel:proto_library.bzl", "proto_library") load("//proto:swift_proto_library.bzl", "swift_proto_library") proto_library( diff --git a/proto/swift_proto_library_group.bzl b/proto/swift_proto_library_group.bzl index 89b4c85b4..67aacd4b8 100644 --- a/proto/swift_proto_library_group.bzl +++ b/proto/swift_proto_library_group.bzl @@ -20,10 +20,7 @@ load( "@bazel_skylib//lib:dicts.bzl", "dicts", ) -load( - "@rules_proto//proto:defs.bzl", - "ProtoInfo", -) +load("@protobuf//bazel/common:proto_info.bzl", "ProtoInfo") load( "//proto:swift_proto_utils.bzl", "SwiftProtoCcInfo", diff --git a/swift/BUILD b/swift/BUILD index 0f6dd8db3..e0944a35a 100644 --- a/swift/BUILD +++ b/swift/BUILD @@ -23,7 +23,6 @@ bzl_library( srcs = ["extras.bzl"], deps = [ "@build_bazel_apple_support//lib:repositories", - "@rules_proto//proto:repositories", ], ) @@ -331,7 +330,7 @@ bzl_library( # Consumed by Bazel integration tests. filegroup( name = "for_bazel_tests", - testonly = 1, + testonly = True, srcs = glob(["**"]) + [ "//swift/internal:for_bazel_tests", "//swift/toolchains:for_bazel_tests", diff --git a/swift/extras.bzl b/swift/extras.bzl index f163680db..89a237986 100644 --- a/swift/extras.bzl +++ b/swift/extras.bzl @@ -18,11 +18,7 @@ dependencies of the Swift rules. load("@bazel_features//:deps.bzl", "bazel_features_deps") load("@build_bazel_apple_support//lib:repositories.bzl", "apple_support_dependencies") -load( - "@rules_proto//proto:repositories.bzl", - "rules_proto_dependencies", - "rules_proto_toolchains", -) +load("@protobuf//:protobuf_deps.bzl", "protobuf_deps") def swift_rules_extra_dependencies(): """Fetches transitive repositories of the dependencies of `rules_swift`. @@ -35,8 +31,6 @@ def swift_rules_extra_dependencies(): apple_support_dependencies() - rules_proto_dependencies() - - rules_proto_toolchains() + protobuf_deps() bazel_features_deps() diff --git a/swift/repositories.bzl b/swift/repositories.bzl index bcbad3974..41644ce30 100644 --- a/swift/repositories.bzl +++ b/swift/repositories.bzl @@ -61,16 +61,6 @@ def swift_rules_dependencies(include_bzlmod_ready_dependencies = True): sha256 = "c4bb2b7367c484382300aee75be598b92f847896fb31bbd22f3a2346adf66a80", ) - _maybe( - http_archive, - name = "rules_proto", - urls = [ - "https://github.com/bazelbuild/rules_proto/archive/refs/tags/5.3.0-21.7.tar.gz", - ], - sha256 = "dc3fb206a2cb3441b485eb1e423165b231235a1ea9b031b4433cf7bc1fa460dd", - strip_prefix = "rules_proto-5.3.0-21.7", - ) - _maybe( http_archive, name = "com_github_nlohmann_json", diff --git a/third_party/BUILD b/third_party/BUILD index add95e55d..ca8924fee 100644 --- a/third_party/BUILD +++ b/third_party/BUILD @@ -1,10 +1,9 @@ # Consumed by Bazel integration tests. filegroup( name = "for_bazel_tests", - testonly = 1, + testonly = True, srcs = glob(["**"]) + [ "//third_party/bazel_protos:for_bazel_tests", - "//third_party/rules_proto:for_bazel_tests", ], visibility = [ "//:__pkg__", diff --git a/third_party/bazel_protos/BUILD b/third_party/bazel_protos/BUILD index b3df6822c..9541e4563 100644 --- a/third_party/bazel_protos/BUILD +++ b/third_party/bazel_protos/BUILD @@ -1,5 +1,5 @@ -load("@rules_cc//cc:defs.bzl", "cc_proto_library") -load("@rules_proto//proto:defs.bzl", "proto_library") +load("@protobuf//bazel:cc_proto_library.bzl", "cc_proto_library") +load("@protobuf//bazel:proto_library.bzl", "proto_library") licenses(["notice"]) @@ -17,7 +17,7 @@ cc_proto_library( # Consumed by Bazel integration tests. filegroup( name = "for_bazel_tests", - testonly = 1, + testonly = True, srcs = glob(["**"]), visibility = [ "//third_party:__pkg__", diff --git a/third_party/rules_proto/BUILD b/third_party/rules_proto/BUILD deleted file mode 100644 index 13f34237d..000000000 --- a/third_party/rules_proto/BUILD +++ /dev/null @@ -1,9 +0,0 @@ -# Consumed by Bazel integration tests. -filegroup( - name = "for_bazel_tests", - testonly = 1, - srcs = glob(["**"]), - visibility = [ - "//third_party:__pkg__", - ], -) diff --git a/tools/protoc_wrapper/BUILD b/tools/protoc_wrapper/BUILD index 4c0932288..7f2f7dd97 100644 --- a/tools/protoc_wrapper/BUILD +++ b/tools/protoc_wrapper/BUILD @@ -6,7 +6,7 @@ package(default_visibility = ["//visibility:public"]) universal_binary( name = "universal_protoc", - binary = "@com_google_protobuf//:protoc", + binary = "@protobuf//:protoc", tags = ["manual"], target_compatible_with = select({ "@platforms//os:windows": ["@platforms//:incompatible"], @@ -18,7 +18,7 @@ alias( name = "protoc", actual = select({ "//swift:universal_tools_config": ":universal_protoc", - "//conditions:default": "@com_google_protobuf//:protoc", + "//conditions:default": "@protobuf//:protoc", }), target_compatible_with = select({ "@platforms//os:windows": ["@platforms//:incompatible"],