diff options
-rw-r--r-- | BUILD | 7 | ||||
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | build_defs.bzl | 17 |
3 files changed, 15 insertions, 11 deletions
@@ -49,8 +49,6 @@ cc_library( "upb/decode.c", "upb/encode.c", "upb/msg.c", - "upb/port_def.inc", - "upb/port_undef.inc", "upb/table.c", "upb/table.int.h", "upb/upb.c", @@ -62,6 +60,11 @@ cc_library( "upb/msg.h", "upb/upb.h", ], + # Internal-only, but we have to make them public for generated code. + textual_hdrs = [ + "upb/port_def.inc", + "upb/port_undef.inc", + ], copts = COPTS, visibility = ["//visibility:public"], ) diff --git a/CMakeLists.txt b/CMakeLists.txt index e6bc5b4..675f41a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,8 +64,6 @@ add_library(upb upb/decode.c upb/encode.c upb/msg.c - upb/port_def.inc - upb/port_undef.inc upb/table.c upb/table.int.h upb/upb.c diff --git a/build_defs.bzl b/build_defs.bzl index db7e668..70854d9 100644 --- a/build_defs.bzl +++ b/build_defs.bzl @@ -192,6 +192,8 @@ def _file_list_aspect_impl(target, ctx): srcs += src.files.to_list() for hdr in ctx.rule.attr.hdrs: hdrs += hdr.files.to_list() + for hdr in ctx.rule.attr.textual_hdrs: + hdrs += hdr.files.to_list() return [SrcList(srcs = srcs, hdrs = hdrs)] _file_list_aspect = aspect( @@ -372,16 +374,16 @@ def _compile_upb_protos(ctx, proto_info, proto_sources, ext): # upb_proto_library() shared code ############################################# -# Can share these with upb_proto_library() once cc_common.link() supports name -# param. +_WrappedCcInfo = provider(fields = ["cc_info"]) def _upb_proto_rule_impl(ctx): if len(ctx.attr.deps) != 1: fail("only one deps dependency allowed.") dep = ctx.attr.deps[0] - if CcInfo not in dep: - fail("proto_library rule must generate CcInfo (aspect should have handled this).") - lib = dep[CcInfo].linking_context.libraries_to_link[0] + if _WrappedCcInfo not in dep: + fail("proto_library rule must generate _WrappedCcInfo (aspect should have handled this).") + cc_info = dep[_WrappedCcInfo].cc_info + lib = cc_info.linking_context.libraries_to_link[0] files = filter_none([ lib.static_library, lib.pic_static_library, @@ -389,7 +391,7 @@ def _upb_proto_rule_impl(ctx): ]) return [ DefaultInfo(files = depset(files)), - dep[CcInfo], + cc_info, ] def _upb_proto_aspect_impl(target, ctx): @@ -397,6 +399,7 @@ def _upb_proto_aspect_impl(target, ctx): files = _compile_upb_protos(ctx, proto_info, proto_info.direct_sources, ctx.attr._ext) deps = ctx.rule.attr.deps + [ctx.attr._upb] dep_ccinfos = [dep[CcInfo] for dep in deps if CcInfo in dep] + dep_ccinfos += [dep[_WrappedCcInfo].cc_info for dep in deps if _WrappedCcInfo in dep] cc_info = cc_library_func( ctx = ctx, name = ctx.rule.attr.name + "_upb", @@ -404,7 +407,7 @@ def _upb_proto_aspect_impl(target, ctx): srcs = files.srcs, dep_ccinfos = dep_ccinfos, ) - return [cc_info] + return [_WrappedCcInfo(cc_info = cc_info)] # upb_proto_library() ########################################################## |