Skip to content

Commit

Permalink
Fix small bug in gen_rs_proto
Browse files Browse the repository at this point in the history
A bug was introduced that removed "trap" in the gen_rs_proto rule
that made it no longer clean up the temp directory it made when
generating the rust proto files.

Also makes it so if the `gen_poroto_tool` fails will properly abort.
  • Loading branch information
allada committed Apr 4, 2021
1 parent 59720c9 commit 627c0f8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion proto/BUILD
Expand Up @@ -30,13 +30,14 @@ genrule(
srcs = _proto_files,
outs = _genproto_files,
cmd = "\n".join([
"set -e",
# By default `rustfmt` will be named `cargo_bin_rustfmt`, but in
# `tonic_build` it is hard codded to look for `rustfmt` program, so we
# make a temp directory symlink a new file with the right name in that
# directory then change our path to look there first before running
# `tonic_build`. Also cleanup the tmp directory after it runs.
"TMPPATH=$$(mktemp -d -t gen_proto.XXXX)",
# "trap \"rm -rf $$TMPPATH\" EXIT",
"trap \"rm -rf $$TMPPATH\" EXIT",
"ln -s $$PWD/$(location //third_party:cargo_bin_rustfmt) $$TMPPATH/rustfmt",
"export PATH=$$TMPPATH:$$PATH",
"$(execpath :gen_protos_tool) --output_dir $(RULEDIR) " + " ".join([
Expand Down

0 comments on commit 627c0f8

Please sign in to comment.