bazel: remove old protos when generating new ones#76163
bazel: remove old protos when generating new ones#76163craig[bot] merged 2 commits intocockroachdb:masterfrom
Conversation
c75d2b2 to
f5c00bd
Compare
|
@rickystewart I reworked this to make it more generally composable for where I think this is going. I also took the opportunity to generate the dependency list. PTAL |
build/bazelutil/bazel-generate.sh
Outdated
| bazel query 'kind(go_proto_library, //pkg/...)' \ | ||
| | sort \ | ||
| | awk ' | ||
| BEGIN {printf("# Generated by bazel-generate.sh\n\nprotobuf_srcs = [\n") } |
There was a problem hiding this comment.
Err, I decided to take this one step further because I think I'm going to generate a bunch of these.
pkg/gen/protobuf_srcs.bzl
Outdated
| @@ -0,0 +1,64 @@ | |||
| # Generated by bazel-generate.sh | |||
|
|
|||
| protobuf_srcs = [ | |||
There was a problem hiding this comment.
Nit: I would expect this variable name to be in ALL_CAPS.
c4bca4e to
1e0695e
Compare
| @@ -0,0 +1,131 @@ | |||
| // Command genbzl is used to generate bazel files which then get imported by | |||
There was a problem hiding this comment.
Nit: the other Go binaries we use for generating Bazel stuff are in pkg/cmd (e.g.: mirror, generate-staticcheck, generate-test-suites). This one should live in the same place IMO.
There was a problem hiding this comment.
I have noticed that, but I think, honestly, it's a mistake. We've long had binaries all over the place. The cmd directory, as far as I'm concerned, is for binaries which we might expect somebody to want to actually run as a binary. Maybe that's controversial. I'd honestly be more inclined to move all of those to some common subdirectory which makes it more obvious what they are there for.
8f9a2a7 to
1e889ea
Compare
It's the only checked in proto file. Release note: None
…ones This is what the Makefile did. It was painful to have the old onces because they'd lead to spurious diffs. This commit also automates the generation of the protobuf sources into a bzl file which is now an unexported input to the rule. Release note: None
1e889ea to
8b01152
Compare
|
bors r+ |
|
Build succeeded: |
This is what the Makefile did. It was painful to have the old onces because
they'd lead to spurious diffs.
Release note: None