|
|
@ -52,7 +52,7 @@ def _filter_none(elems): |
|
|
|
out.append(elem) |
|
|
|
out.append(elem) |
|
|
|
return out |
|
|
|
return out |
|
|
|
|
|
|
|
|
|
|
|
def _cc_library_func(ctx, name, hdrs, srcs, dep_ccinfos): |
|
|
|
def _cc_library_func(ctx, name, hdrs, srcs, copts, dep_ccinfos): |
|
|
|
"""Like cc_library(), but callable from rules. |
|
|
|
"""Like cc_library(), but callable from rules. |
|
|
|
|
|
|
|
|
|
|
|
Args: |
|
|
|
Args: |
|
|
@ -88,6 +88,7 @@ def _cc_library_func(ctx, name, hdrs, srcs, dep_ccinfos): |
|
|
|
name = name, |
|
|
|
name = name, |
|
|
|
srcs = srcs, |
|
|
|
srcs = srcs, |
|
|
|
public_hdrs = hdrs, |
|
|
|
public_hdrs = hdrs, |
|
|
|
|
|
|
|
user_compile_flags = copts, |
|
|
|
compilation_contexts = compilation_contexts, |
|
|
|
compilation_contexts = compilation_contexts, |
|
|
|
**blaze_only_args |
|
|
|
**blaze_only_args |
|
|
|
) |
|
|
|
) |
|
|
@ -128,6 +129,22 @@ upb_fasttable_enabled = rule( |
|
|
|
build_setting = config.bool(flag = True) |
|
|
|
build_setting = config.bool(flag = True) |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Dummy rule to expose select() copts to aspects ############################## |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_UpbProtoLibraryCopts = provider( |
|
|
|
|
|
|
|
fields = { |
|
|
|
|
|
|
|
"copts": "copts for upb_proto_library()", |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def upb_proto_library_copts_impl(ctx): |
|
|
|
|
|
|
|
return _UpbProtoLibraryCopts(copts = ctx.attr.copts) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
upb_proto_library_copts = rule( |
|
|
|
|
|
|
|
implementation = upb_proto_library_copts_impl, |
|
|
|
|
|
|
|
attrs = {"copts": attr.string_list(default = [])}, |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
# upb_proto_library / upb_proto_reflection_library shared code ################# |
|
|
|
# upb_proto_library / upb_proto_reflection_library shared code ################# |
|
|
|
|
|
|
|
|
|
|
|
GeneratedSrcsInfo = provider( |
|
|
|
GeneratedSrcsInfo = provider( |
|
|
@ -223,6 +240,7 @@ def _upb_proto_aspect_impl(target, ctx, cc_provider, file_provider): |
|
|
|
name = ctx.rule.attr.name + ctx.attr._ext, |
|
|
|
name = ctx.rule.attr.name + ctx.attr._ext, |
|
|
|
hdrs = files.hdrs, |
|
|
|
hdrs = files.hdrs, |
|
|
|
srcs = files.srcs, |
|
|
|
srcs = files.srcs, |
|
|
|
|
|
|
|
copts = ctx.attr._copts[_UpbProtoLibraryCopts].copts, |
|
|
|
dep_ccinfos = dep_ccinfos, |
|
|
|
dep_ccinfos = dep_ccinfos, |
|
|
|
) |
|
|
|
) |
|
|
|
return [cc_provider(cc_info = cc_info), file_provider(srcs = files)] |
|
|
|
return [cc_provider(cc_info = cc_info), file_provider(srcs = files)] |
|
|
@ -246,6 +264,9 @@ def _maybe_add(d): |
|
|
|
|
|
|
|
|
|
|
|
_upb_proto_library_aspect = aspect( |
|
|
|
_upb_proto_library_aspect = aspect( |
|
|
|
attrs = _maybe_add({ |
|
|
|
attrs = _maybe_add({ |
|
|
|
|
|
|
|
"_copts": attr.label( |
|
|
|
|
|
|
|
default = "//:upb_proto_library_copts__for_generated_code_only_do_not_use", |
|
|
|
|
|
|
|
), |
|
|
|
"_upbc": attr.label( |
|
|
|
"_upbc": attr.label( |
|
|
|
executable = True, |
|
|
|
executable = True, |
|
|
|
cfg = "host", |
|
|
|
cfg = "host", |
|
|
@ -292,6 +313,9 @@ upb_proto_library = rule( |
|
|
|
|
|
|
|
|
|
|
|
_upb_proto_reflection_library_aspect = aspect( |
|
|
|
_upb_proto_reflection_library_aspect = aspect( |
|
|
|
attrs = _maybe_add({ |
|
|
|
attrs = _maybe_add({ |
|
|
|
|
|
|
|
"_copts": attr.label( |
|
|
|
|
|
|
|
default = "//:upb_proto_library_copts__for_generated_code_only_do_not_use", |
|
|
|
|
|
|
|
), |
|
|
|
"_upbc": attr.label( |
|
|
|
"_upbc": attr.label( |
|
|
|
executable = True, |
|
|
|
executable = True, |
|
|
|
cfg = "host", |
|
|
|
cfg = "host", |
|
|
|