Skip to content

Commit

Permalink
Use proto packages that exist in dapr/dapr instead of generating them…
Browse files Browse the repository at this point in the history
… locally in the SDK. This enables the ability to embed Dapr and also use the SDK to interact with the Dapr APIs. Also moved go mod to 1.17. (dapr#211)
  • Loading branch information
pkedy authored Oct 17, 2021
1 parent 9fceff8 commit de68193
Show file tree
Hide file tree
Showing 26 changed files with 87 additions and 6,268 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release-on-tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

- name: Tidy
run: |
go mod tidy
go mod tidy -compat=1.17
go mod vendor
- name: Test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-on-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Tidy
run: |
go mod tidy
go mod tidy -compat=1.17
go mod vendor
- name: Test
Expand Down
35 changes: 1 addition & 34 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ all: help

.PHONY: tidy
tidy: ## Updates the go modules
go mod tidy
go mod tidy -compat=1.17

.PHONY: test
test: tidy ## Tests the entire project
Expand Down Expand Up @@ -43,39 +43,6 @@ clean: ## Cleans go and generated files in ./dapr/proto/
rm -fr ./dapr/proto/common/v1/*
rm -fr ./dapr/proto/runtime/v1/*

.PHONY: protos
protos: ## Downloads proto files from dapr/dapr master and generates gRPC proto clients
go install github.com/gogo/protobuf/gogoreplace

rm -f ./dapr/proto/common/v1/*
rm -f ./dapr/proto/runtime/v1/*

wget -q $(PROTO_ROOT)/common/v1/common.proto -O ./dapr/proto/common/v1/common.proto
gogoreplace 'option go_package = "github.com/dapr/dapr/pkg/proto/common/v1;common";' \
'option go_package = "github.com/dapr/go-sdk/dapr/proto/common/v1;common";' \
./dapr/proto/common/v1/common.proto

wget -q $(PROTO_ROOT)/runtime/v1/appcallback.proto -O ./dapr/proto/runtime/v1/appcallback.proto
gogoreplace 'option go_package = "github.com/dapr/dapr/pkg/proto/runtime/v1;runtime";' \
'option go_package = "github.com/dapr/go-sdk/dapr/proto/runtime/v1;runtime";' \
./dapr/proto/runtime/v1/appcallback.proto

wget -q $(PROTO_ROOT)/runtime/v1/dapr.proto -O ./dapr/proto/runtime/v1/dapr.proto
gogoreplace 'option go_package = "github.com/dapr/dapr/pkg/proto/runtime/v1;runtime";' \
'option go_package = "github.com/dapr/go-sdk/dapr/proto/runtime/v1;runtime";' \
./dapr/proto/runtime/v1/dapr.proto

protoc --go_out=. --go_opt=paths=source_relative \
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
dapr/proto/common/v1/common.proto

protoc --go_out=. --go_opt=paths=source_relative \
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
dapr/proto/runtime/v1/*.proto

rm -f ./dapr/proto/common/v1/*.proto
rm -f ./dapr/proto/runtime/v1/*.proto

.PHONY: help
help: ## Display available commands
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk \
Expand Down
2 changes: 1 addition & 1 deletion client/binding.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/pkg/errors"

pb "github.com/dapr/go-sdk/dapr/proto/runtime/v1"
pb "github.com/dapr/dapr/pkg/proto/runtime/v1"
)

// InvokeBindingRequest represents binding invocation request.
Expand Down
2 changes: 1 addition & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"google.golang.org/grpc/metadata"
"google.golang.org/protobuf/types/known/emptypb"

pb "github.com/dapr/go-sdk/dapr/proto/runtime/v1"
pb "github.com/dapr/dapr/pkg/proto/runtime/v1"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (
"google.golang.org/grpc/test/bufconn"
"google.golang.org/protobuf/types/known/anypb"

commonv1pb "github.com/dapr/go-sdk/dapr/proto/common/v1"
pb "github.com/dapr/go-sdk/dapr/proto/runtime/v1"
commonv1pb "github.com/dapr/dapr/pkg/proto/common/v1"
pb "github.com/dapr/dapr/pkg/proto/runtime/v1"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions client/invoke.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
anypb "github.com/golang/protobuf/ptypes/any"
"github.com/pkg/errors"

v1 "github.com/dapr/go-sdk/dapr/proto/common/v1"
pb "github.com/dapr/go-sdk/dapr/proto/runtime/v1"
v1 "github.com/dapr/dapr/pkg/proto/common/v1"
pb "github.com/dapr/dapr/pkg/proto/runtime/v1"
)

// DataContent the service invocation content.
Expand Down
2 changes: 1 addition & 1 deletion client/invoke_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/stretchr/testify/assert"

v1 "github.com/dapr/go-sdk/dapr/proto/common/v1"
v1 "github.com/dapr/dapr/pkg/proto/common/v1"
)

type _testStructwithText struct {
Expand Down
2 changes: 1 addition & 1 deletion client/pubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/pkg/errors"

pb "github.com/dapr/go-sdk/dapr/proto/runtime/v1"
pb "github.com/dapr/dapr/pkg/proto/runtime/v1"
)

// PublishEventOption is the type for the functional option.
Expand Down
2 changes: 1 addition & 1 deletion client/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/pkg/errors"

pb "github.com/dapr/go-sdk/dapr/proto/runtime/v1"
pb "github.com/dapr/dapr/pkg/proto/runtime/v1"
)

// GetSecret retrieves preconfigured secret from specified store using key.
Expand Down
4 changes: 2 additions & 2 deletions client/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"github.com/golang/protobuf/ptypes/duration"
"github.com/pkg/errors"

v1 "github.com/dapr/go-sdk/dapr/proto/common/v1"
pb "github.com/dapr/go-sdk/dapr/proto/runtime/v1"
v1 "github.com/dapr/dapr/pkg/proto/common/v1"
pb "github.com/dapr/dapr/pkg/proto/runtime/v1"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion client/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/stretchr/testify/assert"

v1 "github.com/dapr/go-sdk/dapr/proto/common/v1"
v1 "github.com/dapr/dapr/pkg/proto/common/v1"
)

const (
Expand Down
Loading

0 comments on commit de68193

Please sign in to comment.