mirror of
https://github.com/gravitational/teleport.git
synced 2026-10-11 22:49:54 +00:00
Use buf.gen.yaml v2 (#46247)
This commit is contained in:
+14
-8
@@ -1,22 +1,28 @@
|
||||
version: v1
|
||||
version: v2
|
||||
|
||||
inputs:
|
||||
- directory: .
|
||||
paths:
|
||||
- proto/prehog/
|
||||
|
||||
managed:
|
||||
enabled: true
|
||||
go_package_prefix:
|
||||
default: github.com/gravitational/teleport/gen/proto/go
|
||||
override:
|
||||
- file_option: go_package_prefix
|
||||
value: github.com/gravitational/teleport/gen/proto/go
|
||||
|
||||
plugins:
|
||||
- name: go
|
||||
strategy: all
|
||||
path:
|
||||
- local:
|
||||
- go
|
||||
- run
|
||||
- google.golang.org/protobuf/cmd/protoc-gen-go
|
||||
out: .
|
||||
opt: module=github.com/gravitational/teleport
|
||||
- name: connect-go
|
||||
strategy: all
|
||||
path:
|
||||
- local:
|
||||
- go
|
||||
- run
|
||||
- connectrpc.com/connect/cmd/protoc-gen-connect-go
|
||||
out: .
|
||||
opt: module=github.com/gravitational/teleport
|
||||
strategy: all
|
||||
|
||||
+25
-8
@@ -1,24 +1,41 @@
|
||||
version: v1
|
||||
version: v2
|
||||
|
||||
inputs:
|
||||
- directory: .
|
||||
exclude_paths:
|
||||
# generated by buf-gogo.gen.yaml
|
||||
- api/proto/teleport/attestation/
|
||||
- api/proto/teleport/legacy/
|
||||
- api/proto/teleport/mfa/
|
||||
- api/proto/teleport/usageevents/
|
||||
- proto/teleport/lib/web/terminal/envelope.proto
|
||||
# generated by buf-connect-go.gen.yaml
|
||||
- proto/prehog/
|
||||
- directory: .
|
||||
paths:
|
||||
# excluded by buf-gogo.gen.yaml
|
||||
- api/proto/teleport/legacy/client/proto/event.proto
|
||||
|
||||
plugins:
|
||||
- name: go
|
||||
strategy: all
|
||||
path:
|
||||
- local:
|
||||
- go
|
||||
- run
|
||||
- google.golang.org/protobuf/cmd/protoc-gen-go
|
||||
out: .
|
||||
opt:
|
||||
- module=github.com/gravitational/teleport
|
||||
# needed by teleport/lib/teleterm/v1/usage_events.proto
|
||||
# needed by teleport/lib/teleterm/v1/usage_events.proto because we use
|
||||
# managed mode for the go package name there
|
||||
- Mprehog/v1alpha/connect.proto=github.com/gravitational/teleport/gen/proto/go/prehog/v1alpha;prehogv1alpha
|
||||
- name: go-grpc
|
||||
strategy: all
|
||||
path:
|
||||
- local:
|
||||
- go
|
||||
- run
|
||||
- google.golang.org/grpc/cmd/protoc-gen-go-grpc
|
||||
out: .
|
||||
opt:
|
||||
- module=github.com/gravitational/teleport
|
||||
# needed by teleport/lib/teleterm/v1/usage_events.proto
|
||||
# needed by teleport/lib/teleterm/v1/usage_events.proto because we use
|
||||
# managed mode for the go package name there
|
||||
- Mprehog/v1alpha/connect.proto=github.com/gravitational/teleport/gen/proto/go/prehog/v1alpha;prehogv1alpha
|
||||
strategy: all
|
||||
|
||||
+15
-2
@@ -1,6 +1,19 @@
|
||||
version: v1
|
||||
version: v2
|
||||
|
||||
inputs:
|
||||
- directory: .
|
||||
paths:
|
||||
- api/proto/teleport/attestation/
|
||||
- api/proto/teleport/legacy/
|
||||
- api/proto/teleport/mfa/
|
||||
- api/proto/teleport/usageevents/
|
||||
- proto/teleport/lib/web/terminal/envelope.proto
|
||||
exclude_paths:
|
||||
# generated by buf-go.gen.yaml
|
||||
- api/proto/teleport/legacy/client/proto/event.proto
|
||||
|
||||
plugins:
|
||||
- name: gogofast
|
||||
- local: protoc-gen-gogofast
|
||||
out: ./gogogen
|
||||
opt:
|
||||
- Mgoogle/protobuf/any.proto=github.com/gogo/protobuf/types
|
||||
|
||||
+22
-5
@@ -1,13 +1,30 @@
|
||||
version: v1
|
||||
version: v2
|
||||
|
||||
inputs:
|
||||
- directory: .
|
||||
paths:
|
||||
- api/proto/teleport/accesslist/
|
||||
- api/proto/teleport/devicetrust/
|
||||
- api/proto/teleport/header/
|
||||
- api/proto/teleport/trait/
|
||||
- api/proto/teleport/userpreferences/
|
||||
- proto/prehog/
|
||||
- proto/teleport/lib/teleterm/
|
||||
|
||||
plugins:
|
||||
- name: typescript
|
||||
out: gen/proto/ts
|
||||
opt: eslint_disable,add_pb_suffix,server_grpc1,ts_nocheck
|
||||
path:
|
||||
- local:
|
||||
- npm
|
||||
- exec
|
||||
- --yes
|
||||
- --package=@protobuf-ts/[email protected]
|
||||
- --
|
||||
- protoc-gen-ts
|
||||
out: gen/proto/ts
|
||||
opt:
|
||||
# the next time we tweak the ts codegen we should put the options in
|
||||
# alphabetical order
|
||||
- eslint_disable
|
||||
- add_pb_suffix
|
||||
- server_grpc1
|
||||
- ts_nocheck
|
||||
strategy: all
|
||||
|
||||
@@ -42,45 +42,18 @@ main() {
|
||||
# this for us (and which is what we use for the non-gogo protogen).
|
||||
rm -fr gogogen
|
||||
trap 'rm -fr gogogen' EXIT # don't leave files behind
|
||||
echoed buf generate --template=buf-gogo.gen.yaml \
|
||||
--path=api/proto/teleport/legacy/ \
|
||||
--path=api/proto/teleport/attestation/ \
|
||||
--path=api/proto/teleport/usageevents/ \
|
||||
--path=api/proto/teleport/mfa/ \
|
||||
--path=proto/teleport/lib/web/terminal/envelope.proto \
|
||||
--exclude-path=api/proto/teleport/legacy/client/proto/event.proto
|
||||
echoed buf generate --template=buf-gogo.gen.yaml
|
||||
cp -r gogogen/github.com/gravitational/teleport/. .
|
||||
# error out if there's anything outside of github.com/gravitational/teleport
|
||||
rm -fr gogogen/github.com/gravitational/teleport
|
||||
rmdir gogogen/github.com/gravitational gogogen/github.com gogogen
|
||||
|
||||
# Generate protoc-gen-go protos (preferred).
|
||||
echoed buf generate --template=buf-go.gen.yaml \
|
||||
--exclude-path=api/proto/teleport/legacy/ \
|
||||
--exclude-path=api/proto/teleport/attestation/ \
|
||||
--exclude-path=api/proto/teleport/usageevents/ \
|
||||
--exclude-path=api/proto/teleport/mfa/ \
|
||||
--exclude-path=proto/teleport/lib/web/terminal/envelope.proto \
|
||||
--exclude-path=proto/prehog/
|
||||
|
||||
# Generate event.proto separately because we only want to run it on this
|
||||
# one particular file in legacy.
|
||||
echoed buf generate --template=buf-go.gen.yaml \
|
||||
--path=api/proto/teleport/legacy/client/proto/event.proto
|
||||
|
||||
# Generate connect-go protos.
|
||||
echoed buf generate --template=buf-connect-go.gen.yaml \
|
||||
--path=proto/prehog/
|
||||
# Generate go, go-grpc and connect-go protos (preferred).
|
||||
echoed buf generate --template=buf-go.gen.yaml
|
||||
echoed buf generate --template=buf-connect-go.gen.yaml
|
||||
|
||||
# Generate TS protos.
|
||||
[[ $skip_js -eq 0 ]] && echoed buf generate --template=buf-ts.gen.yaml \
|
||||
--path=proto/prehog/ \
|
||||
--path=proto/teleport/lib/teleterm/ \
|
||||
--path=api/proto/teleport/accesslist/ \
|
||||
--path=api/proto/teleport/devicetrust/ \
|
||||
--path=api/proto/teleport/header/ \
|
||||
--path=api/proto/teleport/trait/ \
|
||||
--path=api/proto/teleport/userpreferences/
|
||||
[[ $skip_js -eq 0 ]] && echoed buf generate --template=buf-ts.gen.yaml
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
||||
Reference in New Issue
Block a user