-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Use one Buf workspace instead of three #19774
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
Changes from all commits
c316548
24f3837
2570da0
c585f09
3e20e92
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -987,21 +987,15 @@ protos/all: protos/build protos/lint protos/format | |
| .PHONY: protos/build | ||
| protos/build: buf/installed | ||
| $(BUF) build | ||
| cd lib/teleterm && $(BUF) build | ||
| cd lib/prehog && $(BUF) build | ||
|
|
||
| .PHONY: protos/format | ||
| protos/format: buf/installed | ||
| $(BUF) format -w | ||
| cd lib/teleterm && $(BUF) format -w | ||
| cd lib/prehog && $(BUF) format -w | ||
|
|
||
| .PHONY: protos/lint | ||
| protos/lint: buf/installed | ||
| $(BUF) lint | ||
| cd api/proto && $(BUF) lint --config=buf-legacy.yaml | ||
| cd lib/teleterm && $(BUF) lint | ||
| cd lib/prehog && $(BUF) lint | ||
| $(BUF) lint --config=api/proto/buf-legacy.yaml api/proto | ||
|
|
||
| .PHONY: lint-protos | ||
| lint-protos: protos/lint | ||
|
|
@@ -1045,7 +1039,7 @@ grpc-teleterm: | |
| # Unlike grpc-teleterm, this target runs locally. | ||
| .PHONY: grpc-teleterm/host | ||
| grpc-teleterm/host: protos/all | ||
| cd lib/teleterm && $(BUF) generate | ||
| $(BUF) generate --template=lib/teleterm/buf.gen.yaml lib/teleterm/api/proto | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure but I think I should move those
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My 2c is to keep buf.gens besides the workspace file, as it is the same path were we expect codegen commands to start from. I suggest doing away with all the additional buf.gen files and using go_package to control the output location, like we do for for everything under proto/ today. We can control whether to use protoc-gen-go or gogo in genproto.sh. (FYI @timothyb89 for prehog.)
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I forgot to mention that in this PR explicitly but we'll need to generate JS files from lib/prehog protos. For now I planned to maintain a separate But I suppose once we get rid of I'm not sure how to control the output path for the JS files without configuring that in On top of that, lib/prehog seems to use connect-go on top of protoc-gen-go. For now though I'd probably just keep them as they are and clean it up while removing
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That would be ideal, yes. :)
I'm not sure either. If there's no .proto option, then we might be stuck with multiple files, but that isn't that terrible. We could output both under
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Ah, that's right. For some reason I was super focus on outputting them to the existing locations. But having them both under the same path might be even better due to how the generated import paths look like in JS files. |
||
|
|
||
| .PHONY: goinstall | ||
| goinstall: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,6 @@ | ||
| version: v1 | ||
| directories: | ||
| - api/proto | ||
| - lib/prehog/proto | ||
| - lib/teleterm/api/proto | ||
| - proto |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -13,8 +13,9 @@ main() { | |||||||||
| trap 'rm -fr github.com' EXIT # don't leave github.com/ behind | ||||||||||
| rm -fr api/gen/proto gen/proto # cleanup gen/proto folders | ||||||||||
|
|
||||||||||
| # Generate Gogo protos (default). | ||||||||||
| buf generate --template=buf-gogo.gen.yaml | ||||||||||
| # Generate Gogo protos. | ||||||||||
| buf generate --template=buf-gogo.gen.yaml api/proto | ||||||||||
| buf generate --template=buf-gogo.gen.yaml proto | ||||||||||
|
codingllama marked this conversation as resolved.
|
||||||||||
|
|
||||||||||
| # Generate protoc-gen-go protos (preferred). | ||||||||||
| # Add your protos to the list if you can. | ||||||||||
|
|
@@ -23,11 +24,9 @@ main() { | |||||||||
| --path=api/proto/teleport/loginrule/ \ | ||||||||||
| --path=api/proto/teleport/proxy/ \ | ||||||||||
| --path=proto/teleport/lib/multiplexer/ | ||||||||||
| buf generate --template=lib/prehog/buf.gen.yaml lib/prehog/proto | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Possibly? Because this is Go it still follows go_package, so we should be able to control the output path through that and have a single gen file.
Suggested change
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll move |
||||||||||
|
|
||||||||||
| cp -r github.com/gravitational/teleport/* . | ||||||||||
|
|
||||||||||
| # Generate prehog protos. | ||||||||||
| cd lib/prehog && buf generate | ||||||||||
| } | ||||||||||
|
|
||||||||||
| main "$@" | ||||||||||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,25 +1,25 @@ | ||
| version: v1 | ||
| plugins: | ||
| - name: go | ||
| out: api/protogen/golang | ||
| out: lib/teleterm/api/protogen/golang | ||
| opt: | ||
| - paths=source_relative | ||
|
|
||
| - name: go-grpc | ||
| out: api/protogen/golang | ||
| out: lib/teleterm/api/protogen/golang | ||
| opt: | ||
| - paths=source_relative | ||
|
|
||
| - name: js | ||
| out: api/protogen/js | ||
| out: lib/teleterm/api/protogen/js | ||
| opt: | ||
| - import_style=commonjs,binary | ||
|
|
||
| - name: grpc | ||
| out: api/protogen/js | ||
| out: lib/teleterm/api/protogen/js | ||
| opt: grpc_js | ||
| path: grpc_tools_node_protoc_plugin | ||
|
|
||
| - name: ts | ||
| out: api/protogen/js | ||
| out: lib/teleterm/api/protogen/js | ||
| opt: "service=grpc-node" |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If run with no additional arguments, buf commands run across all modules.