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

Generate protos in repo #335

Merged
merged 3 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# buf.gen.yaml
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is where all the configuration lives

version: v1
managed:
enabled: true
go_package_prefix:
# <module_name> : name in go.mod
# <relative_path> : where generated code should be output
default: github.com/xmtp/xmtp-node-go/pkg/proto
# Remove `except` field if googleapis is not used
except:
- buf.build/googleapis/googleapis
- buf.build/grpc-ecosystem/grpc-gateway
plugins:
- plugin: buf.build/grpc-ecosystem/gateway:v2.19.0
out: pkg/proto
opt:
- paths=source_relative
- plugin: buf.build/grpc/go:v1.3.0
out: pkg/proto
opt:
- paths=source_relative
# dependencies
- plugin: buf.build/protocolbuffers/go
out: pkg/proto
opt:
- paths=source_relative
- plugin: buf.build/grpc-ecosystem/openapiv2:v2.19.0
out: pkg/proto/openapi
7 changes: 6 additions & 1 deletion dev/generate
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,9 @@ set -e

go generate ./...

mockgen -package api github.com/xmtp/proto/v3/go/mls/api/v1 MlsApi_SubscribeGroupMessagesServer,MlsApi_SubscribeWelcomeMessagesServer > pkg/mls/api/v1/mock.gen.go
mockgen -package api github.com/xmtp/xmtp-node-go/pkg/proto/mls/api/v1 MlsApi_SubscribeGroupMessagesServer,MlsApi_SubscribeWelcomeMessagesServer > pkg/mls/api/v1/mock.gen.go
rm -rf pkg/proto/**/*.pb.go pkg/proto/**/*.pb.gw.go pkg/proto/**/*.swagger.json
if ! buf generate https://github.com/xmtp/proto.git#branch=main,subdir=proto; then
echo "Failed to generate protobuf definitions"
exit 1
fi
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ require (
github.com/uptrace/bun/driver/pgdriver v1.1.16
github.com/waku-org/go-waku v0.8.0
github.com/xmtp/go-msgio v0.2.1-0.20220510223757-25a701b79cd3
github.com/xmtp/proto/v3 v3.37.1-0.20240112125235-f02fe8d0f1a0
github.com/yoheimuta/protolint v0.39.0
go.uber.org/mock v0.4.0
go.uber.org/zap v1.24.0
Expand Down
4 changes: 2 additions & 2 deletions pkg/api/authentication.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"fmt"
"time"

messagev1 "github.com/xmtp/proto/v3/go/message_api/v1"
envelope "github.com/xmtp/proto/v3/go/message_contents"
"github.com/xmtp/xmtp-node-go/pkg/crypto"
messagev1 "github.com/xmtp/xmtp-node-go/pkg/proto/message_api/v1"
envelope "github.com/xmtp/xmtp-node-go/pkg/proto/message_contents"
"github.com/xmtp/xmtp-node-go/pkg/types"
"go.uber.org/zap"
"google.golang.org/protobuf/proto"
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/authentication_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"time"

"github.com/stretchr/testify/require"
messageV1 "github.com/xmtp/proto/v3/go/message_api/v1"
messageclient "github.com/xmtp/xmtp-node-go/pkg/api/message/v1/client"
messageV1 "github.com/xmtp/xmtp-node-go/pkg/proto/message_api/v1"
)

func Test_AuthnNoToken(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/interceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"

messagev1 "github.com/xmtp/proto/v3/go/message_api/v1"
"github.com/xmtp/xmtp-node-go/pkg/logging"
messagev1 "github.com/xmtp/xmtp-node-go/pkg/proto/message_api/v1"
"github.com/xmtp/xmtp-node-go/pkg/ratelimiter"
"github.com/xmtp/xmtp-node-go/pkg/types"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/message/v1/client/grpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package client
import (
"context"

messagev1 "github.com/xmtp/proto/v3/go/message_api/v1"
messagev1 "github.com/xmtp/xmtp-node-go/pkg/proto/message_api/v1"
"google.golang.org/grpc"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/api/message/v1/client/grpc_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"errors"
"io"

messagev1 "github.com/xmtp/proto/v3/go/message_api/v1"
messagev1 "github.com/xmtp/xmtp-node-go/pkg/proto/message_api/v1"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/message/v1/client/http_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"net/http"

"github.com/hashicorp/go-retryablehttp"
messagev1 "github.com/xmtp/proto/v3/go/message_api/v1"
messagev1 "github.com/xmtp/xmtp-node-go/pkg/proto/message_api/v1"
"go.uber.org/zap"
"google.golang.org/grpc/metadata"
"google.golang.org/protobuf/encoding/protojson"
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/message/v1/client/http_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"io"
"net/http"

messagev1 "github.com/xmtp/proto/v3/go/message_api/v1"
messagev1 "github.com/xmtp/xmtp-node-go/pkg/proto/message_api/v1"
"go.uber.org/zap"
"google.golang.org/protobuf/encoding/protojson"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/message/v1/client/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package client
import (
"context"

messagev1 "github.com/xmtp/proto/v3/go/message_api/v1"
messagev1 "github.com/xmtp/xmtp-node-go/pkg/proto/message_api/v1"
)

type Client interface {
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/message/v1/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import (
"github.com/nats-io/nats.go"
"github.com/pkg/errors"
wakupb "github.com/waku-org/go-waku/waku/v2/protocol/pb"
proto "github.com/xmtp/proto/v3/go/message_api/v1"
apicontext "github.com/xmtp/xmtp-node-go/pkg/api/message/v1/context"
"github.com/xmtp/xmtp-node-go/pkg/logging"
"github.com/xmtp/xmtp-node-go/pkg/metrics"
proto "github.com/xmtp/xmtp-node-go/pkg/proto/message_api/v1"
"github.com/xmtp/xmtp-node-go/pkg/store"
"github.com/xmtp/xmtp-node-go/pkg/topic"
"go.uber.org/zap"
Expand Down
6 changes: 3 additions & 3 deletions pkg/api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import (
swgui "github.com/swaggest/swgui/v3"
wakupb "github.com/waku-org/go-waku/waku/v2/protocol/pb"
wakurelay "github.com/waku-org/go-waku/waku/v2/protocol/relay"
proto "github.com/xmtp/proto/v3/go/message_api/v1"
mlsv1pb "github.com/xmtp/proto/v3/go/mls/api/v1"
messagev1openapi "github.com/xmtp/proto/v3/openapi/message_api/v1"
proto "github.com/xmtp/xmtp-node-go/pkg/proto/message_api/v1"
mlsv1pb "github.com/xmtp/xmtp-node-go/pkg/proto/mls/api/v1"
messagev1openapi "github.com/xmtp/xmtp-node-go/pkg/proto/openapi"
"github.com/xmtp/xmtp-node-go/pkg/ratelimiter"
"github.com/xmtp/xmtp-node-go/pkg/topic"
"github.com/xmtp/xmtp-node-go/pkg/tracing"
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (
"time"

"github.com/stretchr/testify/require"
messageV1 "github.com/xmtp/proto/v3/go/message_api/v1"
messagev1api "github.com/xmtp/xmtp-node-go/pkg/api/message/v1"
messageclient "github.com/xmtp/xmtp-node-go/pkg/api/message/v1/client"
messageV1 "github.com/xmtp/xmtp-node-go/pkg/proto/message_api/v1"
"github.com/xmtp/xmtp-node-go/pkg/ratelimiter"
test "github.com/xmtp/xmtp-node-go/pkg/testing"
"google.golang.org/grpc/codes"
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"time"

"github.com/stretchr/testify/require"
v1 "github.com/xmtp/proto/v3/go/message_api/v1"
messageclient "github.com/xmtp/xmtp-node-go/pkg/api/message/v1/client"
"github.com/xmtp/xmtp-node-go/pkg/authz"
v1 "github.com/xmtp/xmtp-node-go/pkg/proto/message_api/v1"
"github.com/xmtp/xmtp-node-go/pkg/store"
test "github.com/xmtp/xmtp-node-go/pkg/testing"
"go.uber.org/zap"
Expand Down
4 changes: 2 additions & 2 deletions pkg/api/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"time"

ethcrypto "github.com/ethereum/go-ethereum/crypto"
messagev1 "github.com/xmtp/proto/v3/go/message_api/v1"
envelope "github.com/xmtp/proto/v3/go/message_contents"
"github.com/xmtp/xmtp-node-go/pkg/crypto"
messagev1 "github.com/xmtp/xmtp-node-go/pkg/proto/message_api/v1"
envelope "github.com/xmtp/xmtp-node-go/pkg/proto/message_contents"
"google.golang.org/protobuf/proto"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/api/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"time"

"github.com/stretchr/testify/require"
messageV1 "github.com/xmtp/proto/v3/go/message_api/v1"
messageclient "github.com/xmtp/xmtp-node-go/pkg/api/message/v1/client"
messageV1 "github.com/xmtp/xmtp-node-go/pkg/proto/message_api/v1"
)

func makeEnvelopes(count int) (envs []*messageV1.Envelope) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/e2e/test_messagev1.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/pkg/errors"
messagev1 "github.com/xmtp/proto/v3/go/message_api/v1"
messageclient "github.com/xmtp/xmtp-node-go/pkg/api/message/v1/client"
messagev1 "github.com/xmtp/xmtp-node-go/pkg/proto/message_api/v1"
"go.uber.org/zap"
"google.golang.org/protobuf/proto"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/logging/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"fmt"

"github.com/waku-org/go-waku/logging"
proto "github.com/xmtp/proto/v3/go/message_api/v1"
proto "github.com/xmtp/xmtp-node-go/pkg/proto/message_api/v1"
"github.com/xmtp/xmtp-node-go/pkg/types"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
Expand Down
2 changes: 1 addition & 1 deletion pkg/metrics/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"time"

"github.com/prometheus/client_golang/prometheus"
proto "github.com/xmtp/proto/v3/go/message_api/v1"
apicontext "github.com/xmtp/xmtp-node-go/pkg/api/message/v1/context"
"github.com/xmtp/xmtp-node-go/pkg/logging"
proto "github.com/xmtp/xmtp-node-go/pkg/proto/message_api/v1"
"github.com/xmtp/xmtp-node-go/pkg/topic"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
Expand Down
10 changes: 5 additions & 5 deletions pkg/mls/api/v1/mock.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/mls/api/v1/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
"github.com/nats-io/nats-server/v2/server"
"github.com/nats-io/nats.go"
wakupb "github.com/waku-org/go-waku/waku/v2/protocol/pb"
mlsv1 "github.com/xmtp/proto/v3/go/mls/api/v1"
mlsstore "github.com/xmtp/xmtp-node-go/pkg/mls/store"
"github.com/xmtp/xmtp-node-go/pkg/mlsvalidate"
mlsv1 "github.com/xmtp/xmtp-node-go/pkg/proto/mls/api/v1"
"github.com/xmtp/xmtp-node-go/pkg/topic"
"go.uber.org/zap"
"google.golang.org/grpc/codes"
Expand Down
2 changes: 1 addition & 1 deletion pkg/mls/api/v1/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (
"github.com/stretchr/testify/require"
"github.com/uptrace/bun"
wakupb "github.com/waku-org/go-waku/waku/v2/protocol/pb"
mlsv1 "github.com/xmtp/proto/v3/go/mls/api/v1"
mlsstore "github.com/xmtp/xmtp-node-go/pkg/mls/store"
"github.com/xmtp/xmtp-node-go/pkg/mlsvalidate"
mlsv1 "github.com/xmtp/xmtp-node-go/pkg/proto/mls/api/v1"
test "github.com/xmtp/xmtp-node-go/pkg/testing"
"github.com/xmtp/xmtp-node-go/pkg/topic"
"go.uber.org/mock/gomock"
Expand Down
2 changes: 1 addition & 1 deletion pkg/mls/store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (

"github.com/uptrace/bun"
"github.com/uptrace/bun/migrate"
mlsv1 "github.com/xmtp/proto/v3/go/mls/api/v1"
migrations "github.com/xmtp/xmtp-node-go/pkg/migrations/mls"
mlsv1 "github.com/xmtp/xmtp-node-go/pkg/proto/mls/api/v1"
"go.uber.org/zap"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/mls/store/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"time"

"github.com/stretchr/testify/require"
mlsv1 "github.com/xmtp/proto/v3/go/mls/api/v1"
mlsv1 "github.com/xmtp/xmtp-node-go/pkg/proto/mls/api/v1"
test "github.com/xmtp/xmtp-node-go/pkg/testing"
)

Expand Down
4 changes: 2 additions & 2 deletions pkg/mlsvalidate/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"context"
"fmt"

mlsv1 "github.com/xmtp/proto/v3/go/mls/api/v1"
svc "github.com/xmtp/proto/v3/go/mls_validation/v1"
mlsv1 "github.com/xmtp/xmtp-node-go/pkg/proto/mls/api/v1"
svc "github.com/xmtp/xmtp-node-go/pkg/proto/mls_validation/v1"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/mlsvalidate/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
svc "github.com/xmtp/proto/v3/go/mls_validation/v1"
svc "github.com/xmtp/xmtp-node-go/pkg/proto/mls_validation/v1"
"google.golang.org/grpc"
)

Expand Down
Loading