Skip to content

Commit

Permalink
Always generate files in closure_grpc_web_library()
Browse files Browse the repository at this point in the history
This adds a `ctx.actions.write` to each of the automatically generated source targets
that have been declared.  This prevents an issue if the source targets do not yield a
`.grpc.js` generated file because they do not contain an `rpc` definition (e.g. proto
files that only contain a `message`).

Resolves: grpc#1076
  • Loading branch information
psigen authored May 2, 2021
1 parent 35c16a9 commit 69f8567
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bazel/private/rules/closure_grpc_web_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def _generate_closure_grpc_web_srcs(
basename = src.basename[:-(len(src.extension) + 1)]

js = actions.declare_file(basename + "_grpc_web_pb.js", sibling = src)
actions.write(output = js, content = "")
files.append(js)

_assert(
Expand All @@ -83,6 +84,7 @@ def _generate_closure_grpc_web_srcs(

if "es6" == import_style:
es6 = actions.declare_file(basename + ".pb.grpc-web.js", sibling = src)
actions.write(output = es6, content = "")
es6_files.append(es6)

_assert(root == es6.root.path, "ES6 file should have same root: '{}' != '{}'".format(root, es6.root.path))
Expand Down

0 comments on commit 69f8567

Please sign in to comment.