Skip to content

Commit

Permalink
bazel: set --include_source_info when generating protobuf code
Browse files Browse the repository at this point in the history
This flag [instructs Bazel](bazelbuild/rules_proto#56 (comment))
to set a [command-line flag](protocolbuffers/protobuf#7623 (comment))
when invoking `protoc` that causes the generated proto descriptor sets
to contain extra info:

```
  --include_source_info       When using --descriptor_set_out, do not strip
                              SourceCodeInfo from the FileDescriptorProto.
                              This results in vastly larger descriptors that
                              include information about the original
                              location of each decl in the source file as
                              well as surrounding comments.
```

Setting this solves two problems:

1. We need the descriptor sets to have comments for cockroachdb#65814.
2. Without this change, generated `.pb.go` files from the sandbox won't
   contain comments. This makes the files more difficult to read and
   dirties the files in your checkout if you copy those `.pb.go` files
   to your workspace.

Also delete an unnecessary `--symlink_prefix=_bazel/` from the `test`
configuration (it's inherited from the `build` configuration so it's
redundant).

Release note: None
  • Loading branch information
rickystewart committed Aug 12, 2021
1 parent 65abfcc commit 90f9e3b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .bazelrc
@@ -1,6 +1,6 @@
build --symlink_prefix=_bazel/ --ui_event_filters=-DEBUG --define gotags=bazel,crdb_test_off,gss
build --symlink_prefix=_bazel/ --ui_event_filters=-DEBUG --define gotags=bazel,crdb_test_off,gss --experimental_proto_descriptor_sets_include_source_info
test --config=test
build:test --symlink_prefix=_bazel/ --define gotags=bazel,crdb_test,gss --test_env=TZ=
build:test --define gotags=bazel,crdb_test,gss --test_env=TZ=
query --ui_event_filters=-DEBUG

try-import %workspace%/.bazelrc.user
Expand Down

0 comments on commit 90f9e3b

Please sign in to comment.