Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bazel: set --include_source_info when generating protobuf code #68806

Merged
merged 1 commit into from
Aug 12, 2021

Conversation

rickystewart
Copy link
Collaborator

This flag instructs Bazel
to set a command-line flag
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 bazel: add build targets for HTTP API documentation, start building in CI #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

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
@rickystewart rickystewart requested a review from rail August 12, 2021 16:49
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Member

@rail rail left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @rickystewart)

@rickystewart
Copy link
Collaborator Author

bors r=rail

@craig
Copy link
Contributor

craig bot commented Aug 12, 2021

Build succeeded:

@craig craig bot merged commit ab15e5f into cockroachdb:master Aug 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants