From f68171748b5a03677762b7eaeef6e7f9ac086a37 Mon Sep 17 00:00:00 2001 From: Thomas Van Lenten Date: Thu, 6 Jul 2023 07:58:17 -0700 Subject: [PATCH] Adopt the `runtime` from proto_lang_toolchain. PiperOrigin-RevId: 545988587 --- swift/internal/BUILD | 1 + swift/internal/swift_protoc_gen_aspect.bzl | 16 +--------------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/swift/internal/BUILD b/swift/internal/BUILD index 55bc767ad..0a23ab8a4 100644 --- a/swift/internal/BUILD +++ b/swift/internal/BUILD @@ -16,6 +16,7 @@ proto_lang_toolchain( plugin = "@com_github_apple_swift_protobuf//:ProtoCompilerPlugin", plugin_format_flag = "--plugin=protoc-gen-swift=%s", progress_message = "Generating Swift sources for %{label}", + runtime = "@com_github_apple_swift_protobuf//:SwiftProtobuf", visibility = ["//visibility:public"], ) diff --git a/swift/internal/swift_protoc_gen_aspect.bzl b/swift/internal/swift_protoc_gen_aspect.bzl index 6ba0fc56d..3e8ef644d 100644 --- a/swift/internal/swift_protoc_gen_aspect.bzl +++ b/swift/internal/swift_protoc_gen_aspect.bzl @@ -269,14 +269,7 @@ def _swift_protoc_gen_aspect_impl(target, aspect_ctx): module_name = derive_swift_module_name(target.label) - # TODO: Revisit using `proto_lang_toolchain_info.runtime` here, was seeing: - # bazel_rules/rules_swift/test/fixtures/module_interface/library/ToyModule.swift:15:8: - # warning: module 'Foundation' was not compiled with library evolution support; using - # it means binary compatibility for 'ToyModule' can't be guaranteed - # import Foundation - # ^ - # - support_deps = aspect_ctx.attr._proto_support + support_deps = [proto_lang_toolchain_info.runtime] for p in support_deps: if CcInfo in p: transitive_cc_infos.append(p[CcInfo]) @@ -369,13 +362,6 @@ swift_protoc_gen_aspect = aspect( swift_toolchain_attrs(), swift_config_attrs(), { - # TODO: `proto_lang_toolchain_info.runtime` wasn't working in all cases, used - # custom attribute instead. - "_proto_support": attr.label_list( - default = [ - Label("@com_github_apple_swift_protobuf//:SwiftProtobuf"), - ], - ), "_proto_lang_toolchain": attr.label( default = Label("@build_bazel_rules_swift//swift/internal:proto_swift_toolchain"), ),