Skip to content

Commit

Permalink
protobuf.bzl: skip '.' when handling includes in _proto_gen_impl()
Browse files Browse the repository at this point in the history
When generating `-I` arguments from `ctx.attr.includes` in
`_proto_gen_impl()`, we might find '.' in the list. That's effectively
source_dir, which we've already handled earlier, and has more
specialized expansion code. Skip it here.

#test-continuous

PiperOrigin-RevId: 689557912
  • Loading branch information
protobuf-github-bot authored and copybara-github committed Oct 24, 2024
1 parent d83a536 commit 923ee76
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions protobuf.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ def _proto_gen_impl(ctx):

if ctx.attr.includes:
for include in ctx.attr.includes:
if include == ".":
# This is effectively source_dir, which has already been handled,
# and may be generated incorrectly here.
continue
import_flags += ["-I" + _GetPath(ctx, include)]

import_flags = depset(direct = import_flags)
Expand Down

0 comments on commit 923ee76

Please sign in to comment.