Make UpbWrappedGeneratedSrcsInfo private.

It is not actually needed by other Bazel rules.

PiperOrigin-RevId: 504993976
pull/13171/head
Joshua Haberman 2 years ago committed by Copybara-Service
parent b29761fece
commit ceba58d6e7
  1. 14
      bazel/upb_proto_library.bzl
  2. 9
      protos/bazel/upb_cc_proto_library.bzl

@ -198,7 +198,7 @@ GeneratedSrcsInfo = provider(
UpbWrappedCcInfo = provider("Provider for cc_info for protos", fields = ["cc_info"]) UpbWrappedCcInfo = provider("Provider for cc_info for protos", fields = ["cc_info"])
_UpbDefsWrappedCcInfo = provider("Provider for cc_info for protos", fields = ["cc_info"]) _UpbDefsWrappedCcInfo = provider("Provider for cc_info for protos", fields = ["cc_info"])
UpbWrappedGeneratedSrcsInfo = provider("Provider for generated sources", fields = ["srcs"]) _UpbWrappedGeneratedSrcsInfo = provider("Provider for generated sources", fields = ["srcs"])
_WrappedDefsGeneratedSrcsInfo = provider( _WrappedDefsGeneratedSrcsInfo = provider(
"Provider for generated reflective sources", "Provider for generated reflective sources",
fields = ["srcs"], fields = ["srcs"],
@ -248,10 +248,10 @@ def _upb_proto_rule_impl(ctx):
if _WrappedDefsGeneratedSrcsInfo in dep: if _WrappedDefsGeneratedSrcsInfo in dep:
srcs = dep[_WrappedDefsGeneratedSrcsInfo].srcs srcs = dep[_WrappedDefsGeneratedSrcsInfo].srcs
elif UpbWrappedGeneratedSrcsInfo in dep: elif _UpbWrappedGeneratedSrcsInfo in dep:
srcs = dep[UpbWrappedGeneratedSrcsInfo].srcs srcs = dep[_UpbWrappedGeneratedSrcsInfo].srcs
else: else:
fail("proto_library rule must generate UpbWrappedGeneratedSrcsInfo or " + fail("proto_library rule must generate _UpbWrappedGeneratedSrcsInfo or " +
"_WrappedDefsGeneratedSrcsInfo (aspect should have handled this).") "_WrappedDefsGeneratedSrcsInfo (aspect should have handled this).")
if _UpbDefsWrappedCcInfo in dep: if _UpbDefsWrappedCcInfo in dep:
@ -297,7 +297,7 @@ def _upb_proto_aspect_impl(target, ctx, generator, cc_provider, file_provider):
return [cc_provider(cc_info = cc_info), file_provider(srcs = files)] return [cc_provider(cc_info = cc_info), file_provider(srcs = files)]
def upb_proto_library_aspect_impl(target, ctx): def upb_proto_library_aspect_impl(target, ctx):
return _upb_proto_aspect_impl(target, ctx, "upb", UpbWrappedCcInfo, UpbWrappedGeneratedSrcsInfo) return _upb_proto_aspect_impl(target, ctx, "upb", UpbWrappedCcInfo, _UpbWrappedGeneratedSrcsInfo)
def _upb_proto_reflection_library_aspect_impl(target, ctx): def _upb_proto_reflection_library_aspect_impl(target, ctx):
return _upb_proto_aspect_impl(target, ctx, "upbdefs", _UpbDefsWrappedCcInfo, _WrappedDefsGeneratedSrcsInfo) return _upb_proto_aspect_impl(target, ctx, "upbdefs", _UpbDefsWrappedCcInfo, _WrappedDefsGeneratedSrcsInfo)
@ -339,7 +339,7 @@ upb_proto_library_aspect = aspect(
implementation = upb_proto_library_aspect_impl, implementation = upb_proto_library_aspect_impl,
provides = [ provides = [
UpbWrappedCcInfo, UpbWrappedCcInfo,
UpbWrappedGeneratedSrcsInfo, _UpbWrappedGeneratedSrcsInfo,
], ],
attr_aspects = ["deps"], attr_aspects = ["deps"],
fragments = ["cpp"], fragments = ["cpp"],
@ -392,7 +392,7 @@ _upb_proto_reflection_library_aspect = aspect(
], ],
required_aspect_providers = [ required_aspect_providers = [
UpbWrappedCcInfo, UpbWrappedCcInfo,
UpbWrappedGeneratedSrcsInfo, _UpbWrappedGeneratedSrcsInfo,
], ],
attr_aspects = ["deps"], attr_aspects = ["deps"],
fragments = ["cpp"], fragments = ["cpp"],

@ -28,7 +28,7 @@
""" """
load("@bazel_skylib//lib:paths.bzl", "paths") load("@bazel_skylib//lib:paths.bzl", "paths")
load("//bazel:upb_proto_library.bzl", "GeneratedSrcsInfo", "UpbWrappedCcInfo", "UpbWrappedGeneratedSrcsInfo", "upb_proto_library_aspect") load("//bazel:upb_proto_library.bzl", "GeneratedSrcsInfo", "UpbWrappedCcInfo", "upb_proto_library_aspect")
# begin:google_only # begin:google_only
# load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain", "use_cpp_toolchain") # load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain", "use_cpp_toolchain")
@ -204,11 +204,9 @@ def _upb_cc_proto_rule_impl(ctx):
if _WrappedCcGeneratedSrcsInfo in dep: if _WrappedCcGeneratedSrcsInfo in dep:
srcs = dep[_WrappedCcGeneratedSrcsInfo].srcs srcs = dep[_WrappedCcGeneratedSrcsInfo].srcs
elif UpbWrappedGeneratedSrcsInfo in dep:
srcs = dep[UpbWrappedGeneratedSrcsInfo].srcs
else: else:
fail("proto_library rule must generate UpbWrappedGeneratedSrcsInfo or " + fail("proto_library rule must generate _WrappedCcGeneratedSrcsInfo (aspect should have " +
"_WrappedCcGeneratedSrcsInfo (aspect should have handled this).") "handled this).")
if _UpbCcWrappedCcInfo in dep: if _UpbCcWrappedCcInfo in dep:
cc_info = dep[_UpbCcWrappedCcInfo].cc_info cc_info = dep[_UpbCcWrappedCcInfo].cc_info
@ -298,7 +296,6 @@ _upb_cc_proto_library_aspect = aspect(
], ],
required_aspect_providers = [ required_aspect_providers = [
UpbWrappedCcInfo, UpbWrappedCcInfo,
UpbWrappedGeneratedSrcsInfo,
], ],
attr_aspects = ["deps"], attr_aspects = ["deps"],
fragments = ["cpp"], fragments = ["cpp"],

Loading…
Cancel
Save