-
Notifications
You must be signed in to change notification settings - Fork 70
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
Support --include_source_info in native proto_library #56
Comments
We can add a global flag to control the command line created by I emphasize it being global - allowing some proto_library to have it and some not has two problems:
Alternative - modify your aspect to create a command line to compile Anyway - I'm no longer on the proto project, though I'm happy to give my 2 cents. |
As a workaround, we switched the aspect to compile from srcs, but that loses some of the advantages that What if we made the |
I'm running into the need for this, too. We have a plugin that does some code generation directed by comment-based annotations; without the source info, all of the annotations are missing. |
@abscondment the recommended approach is to use proto options - they show up in the descriptor set and are verified by the compiler at build time. |
@cgrushko Neat - thanks for the pointer! |
heh, I was getting ready for push back :) I realize the migration to options will take time, but I think the outcome will be better :) |
I think global option is not ideal, as when generating doc/swagger from proto files, I'd prefer to have Whoever needs |
Hey @cgrushko and @lberki, is there any update on this FR? I just stumbled into this issue again, as I found that I can't use |
ATM gapic now provides load("@com_google_api_codegen//rules_gapic:gapic.bzl", "proto_library_with_info")
proto_library(
name = "iam_admin_proto",
srcs = ["iam.proto"],
deps = [
"//google/api:annotations_proto",
"//google/iam/v1:iam_policy_proto",
"//google/iam/v1:policy_proto",
"@com_google_protobuf//:empty_proto",
"@com_google_protobuf//:field_mask_proto",
"@com_google_protobuf//:timestamp_proto",
],
)
proto_library_with_info(
name = "iam_admin_proto_with_info",
deps = [":iam_admin_proto"],
) Still, it would be nice to have this shipped with bazel natively. |
Duplicating into bazelbuild/bazel#9337 TL;DR: Bazel introduced |
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
68102: storage/storageccl: Add an option to break export mid key r=pbardea,sumeerbhola a=aliher1911 Previously when exporting ranges with very large number of versions export could hit the situation where single key export would exceed maximum export byte limit. To resolve this, safety threshold has to be raised which could cause nodes going out of memory. To address this, this patch adds an ability to stop and resume on the arbitrary key timestamp so that it could be stopped mid key and resumed later. Release note: None Fixes #68231 68390: ui: rebuild the databases pages r=matthewtodd a=matthewtodd Previously, the databases pages featured an older, outdated design. This change aligns their UX with that of the other modern pages in the DB console, statements, transactions, and sessions. This is a first pass at the job. We will return to layer on more features, including search, and more data, including node & region information. Addresses #65737. Before | After --- | --- <img width="1372" alt="Screen Shot 2021-08-05 at 4 54 31 PM" src="https://user-images.githubusercontent.com/5261/128420405-7a096c2f-32a1-42d9-a8f0-186f699fb612.png"> | <img width="1372" alt="Screen Shot 2021-08-03 at 2 50 12 PM" src="https://user-images.githubusercontent.com/5261/128070069-28d0f461-69dd-47cb-a04b-bc6cd0126ca4.png"> <img width="1372" alt="Screen Shot 2021-08-05 at 4 54 57 PM" src="https://user-images.githubusercontent.com/5261/128420491-71d03570-1c0d-413b-ab40-09b45cf614ee.png"> | <img width="1372" alt="Screen Shot 2021-08-03 at 2 50 21 PM" src="https://user-images.githubusercontent.com/5261/128070090-bd62d125-a1b2-4c83-b0a5-33d0723849eb.png"> <img width="1372" alt="Screen Shot 2021-08-05 at 5 03 37 PM" src="https://user-images.githubusercontent.com/5261/128420959-338ea79b-abf0-4773-91bf-cecac64fec5f.png"> | (This overview of database grants no longer exists.) (This rolled-up view of table grants did not previously exist.) | <img width="1372" alt="Screen Shot 2021-08-03 at 2 50 27 PM" src="https://user-images.githubusercontent.com/5261/128070100-1305c94f-c017-40a5-ba2d-f19fd61bdecf.png"> <img width="1372" alt="Screen Shot 2021-08-05 at 4 55 21 PM" src="https://user-images.githubusercontent.com/5261/128420596-2d9f04ad-718c-4dce-b045-b5647f718339.png"> | <img width="1372" alt="Screen Shot 2021-08-03 at 2 50 35 PM" src="https://user-images.githubusercontent.com/5261/128070103-831fd5c3-38da-4864-9d82-9091f3209606.png"> <img width="1372" alt="Screen Shot 2021-08-05 at 4 55 28 PM" src="https://user-images.githubusercontent.com/5261/128420658-4042c631-b283-4b0c-ac4a-3235bd3bcf39.png"> | <img width="1372" alt="Screen Shot 2021-08-03 at 2 50 41 PM" src="https://user-images.githubusercontent.com/5261/128070113-73528f2c-56bf-4fcf-a8d8-fcc3f100695f.png"> Release note (ui change): The databases pages in the DB console were updated to bring them into alignment with our modern UX. 68619: storage: add file storing min version needed for backwards compatibility r=jbowens a=andyyang890 A new STORAGE_MIN_VERSION file containing the minimum version that the storage engine needs to maintain backwards compatibility with will be added to the directory for each storage engine. This will be used in the encryption-at-rest registry migration. Release note: None 68621: dev: implement `dev generate docs` r=rail a=rickystewart Do some refactoring so that we don't have to repeat code in a bunch of places. The implementation is pretty straightforward and just involves building the docs then copying them over to the workspace. Closes #68563. Release note: None 68663: dev: hoist generated code out of sandbox into workspace r=rail a=rickystewart (Only the most recent commit applies for this review.) One might be expected that this command be implemented as `dev generate protobuf` or `dev generate execgen` or similar, but that's not really practical for a couple reasons: 1. Building all the protobuf in-tree isn't really possible on its own: see #58018 (comment). 2. For non-proto generated code, one can imagine that we do a bunch of `bazel query`s to list all the generated files in tree and to find which files are generated. Given that there are hundreds of generated files in tree, and a single `bazel query` can take ~1s, this is not tractable. The implementation here is ad-hoc and a bit hacky. Basically we search `bazel-bin` for files ending in `.go` and apply some heuristics to figure out whether they should be copied and where those files should go. This is gated behind a feature flag for now because actually copying these files into the workspace right now dirties a ton of files. (The diffs are benign -- mostly comments.) We can flip this option to be on by default when it's safe (probably after the `Makefile` is deleted). Closes #68565. Release note: None 68806: bazel: set `--include_source_info` when generating protobuf code r=rail a=rickystewart 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 #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 Co-authored-by: Oleg Afanasyev <[email protected]> Co-authored-by: Matthew Todd <[email protected]> Co-authored-by: Andy Yang <[email protected]> Co-authored-by: Ricky Stewart <[email protected]>
It's useful to be able to specify an optional inclusion of
source_code_info
in the proto descriptors generated byproto_library
, for the purpose of documentation generation tools etc. I was working on an aspect that used theproto_library
output descriptors, and this is stripped away. It's useful to strip by default, but it would be also good to have a param tonative.proto_library
that allows us to specify targets that provide the source code info.The text was updated successfully, but these errors were encountered: