You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Instead of calling native.sh_binary in def go_proto_link why not just add executable = True to _go_proto_link?
We currently have a rule that is a rule runner, in other words, is capable of aggregating multiple rules in a single bazel run //:copy_protos target, that in turn invokes all go_proto_link rules in the repo.
Because of this extra level of indirection using native.sh_binary, I have to create the targets in my rule by appending _copy_gen, for my rule to work.
proto.bzl could be just:
load("//:golink.bzl", "gen_copy_files_script")
defgo_proto_link_impl(ctx, **kwargs):
returngen_copy_files_script(ctx, ctx.attr.dep[OutputGroupInfo].go_generated_srcs.to_list())
_go_proto_link=rule(
implementation=go_proto_link_impl,
attrs= {
"dir": attr.string(),
"dep": attr.label(),
"_template": attr.label(
default="//:copy_into_workspace.sh",
allow_single_file=True,
),
# It is not used, just used for versioning since this is experimental"version": attr.string(),
},
executable=True,
)
defgo_proto_link(**kwargs):
ifnot"dir"inkwargs:
dir=native.package_name()
kwargs["dir"] =dir_go_proto_link(**kwargs)
The text was updated successfully, but these errors were encountered:
Instead of calling
native.sh_binary
indef go_proto_link
why not just addexecutable = True
to_go_proto_link
?We currently have a rule that is a rule runner, in other words, is capable of aggregating multiple rules in a single
bazel run //:copy_protos
target, that in turn invokes allgo_proto_link
rules in the repo.Something like:
Because of this extra level of indirection using
native.sh_binary
, I have to create the targets in my rule by appending_copy_gen
, for my rule to work.proto.bzl
could be just:The text was updated successfully, but these errors were encountered: