chore(*): update plugin default options && add examples

Signed-off-by: storyicon <yuanchao@bilibili.com>
This commit is contained in:
storyicon 2021-07-28 11:57:21 +08:00
parent bc28762992
commit 4f4006ee7d
No known key found for this signature in database
GPG key ID: 245915D985F966CF
18 changed files with 342 additions and 10 deletions

View file

@ -0,0 +1,26 @@
# Greeter
This is the simplest grpc example, which does not reference any external grpc libraries.
The following plug-ins are used:
* [protoc-gen-go](google.golang.org/protobuf/cmd/protoc-gen-go)
* [protoc-gen-go-grpc](google.golang.org/grpc/cmd/protoc-gen-go-grpc)
You can compile the proto file in this directory by executing the following command:
```
powerproto build -r ./apis
```
Not surprisingly, you will get the following output:
```
➜ tree
.
├── README.md
├── apis
│   ├── greeter.pb.go
│   ├── greeter.proto
│   └── greeter_grpc.pb.go
└── powerproto.yaml
1 directory, 5 files
```

View file

@ -0,0 +1,16 @@
syntax = "proto3";
package powerproto.examples.greeter;
option go_package = "github.com/storyicon/powerproto/examples/greeter/apis;apis";
service Greeter {
rpc SayHello (HelloRequest) returns (HelloReply);
}
message HelloRequest {
string name = 1;
}
message HelloReply {
string message = 1;
}

View file

@ -0,0 +1,22 @@
scopes:
- ./
protoc: v3.17.3
protocWorkDir: ""
plugins:
protoc-gen-go: google.golang.org/protobuf/cmd/protoc-gen-go@v1.27.1
protoc-gen-go-grpc: google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.1.0
repositories:
GOOGLE_APIS: https://github.com/googleapis/googleapis@75e9812478607db997376ccea247dd6928f70f45
options:
- --go_out=.
- --go_opt=paths=source_relative
- --go-grpc_out=.
- --go-grpc_opt=paths=source_relative
importPaths:
- .
- $GOPATH
- $POWERPROTO_INCLUDE
- $SOURCE_RELATIVE
- $GOOGLE_APIS/github.com/googleapis/googleapis
postActions: []
postShell: ""