| 1 |
VERSION=3.9.1 |
| 2 |
URL="https://raw.githubusercontent.com/protocolbuffers/protobuf/v${VERSION}/src/google/protobuf" |
| 3 |
|
| 4 |
regenerate: |
| 5 |
go install github.com/gogo/protobuf/protoc-gen-gogotypes |
| 6 |
go install github.com/gogo/protobuf/protoc-min-version |
| 7 |
|
| 8 |
protoc-min-version \ |
| 9 |
--version="3.0.0" \ |
| 10 |
--gogotypes_out=../types/ \ |
| 11 |
-I=. \ |
| 12 |
google/protobuf/any.proto \ |
| 13 |
google/protobuf/type.proto \ |
| 14 |
google/protobuf/empty.proto \ |
| 15 |
google/protobuf/api.proto \ |
| 16 |
google/protobuf/timestamp.proto \ |
| 17 |
google/protobuf/duration.proto \ |
| 18 |
google/protobuf/struct.proto \ |
| 19 |
google/protobuf/wrappers.proto \ |
| 20 |
google/protobuf/field_mask.proto \ |
| 21 |
google/protobuf/source_context.proto |
| 22 |
|
| 23 |
mv ../types/google/protobuf/*.pb.go ../types/ || true |
| 24 |
rmdir ../types/google/protobuf || true |
| 25 |
rmdir ../types/google || true |
| 26 |
|
| 27 |
update: |
| 28 |
go install github.com/gogo/protobuf/gogoreplace |
| 29 |
|
| 30 |
(cd ./google/protobuf && rm descriptor.proto; wget ${URL}/descriptor.proto) |
| 31 |
# gogoprotobuf requires users to import gogo.proto which imports descriptor.proto |
| 32 |
# The descriptor.proto is only compatible with proto3 just because of the reserved keyword. |
| 33 |
# We remove it to stay compatible with previous versions of protoc before proto3 |
| 34 |
gogoreplace 'reserved 38;' '//reserved 38;' ./google/protobuf/descriptor.proto |
| 35 |
gogoreplace 'reserved 8;' '//reserved 8;' ./google/protobuf/descriptor.proto |
| 36 |
gogoreplace 'reserved 9;' '//reserved 9;' ./google/protobuf/descriptor.proto |
| 37 |
gogoreplace 'reserved 4;' '//reserved 4;' ./google/protobuf/descriptor.proto |
| 38 |
gogoreplace 'reserved 5;' '//reserved 5;' ./google/protobuf/descriptor.proto |
| 39 |
gogoreplace 'option go_package = "github.com/golang/protobuf/protoc-gen-go/descriptor;descriptor";' 'option go_package = "descriptor";' ./google/protobuf/descriptor.proto |
| 40 |
|
| 41 |
(cd ./google/protobuf/compiler && rm plugin.proto; wget ${URL}/compiler/plugin.proto) |
| 42 |
gogoreplace 'option go_package = "github.com/golang/protobuf/protoc-gen-go/plugin;plugin_go";' 'option go_package = "plugin_go";' ./google/protobuf/compiler/plugin.proto |
| 43 |
|
| 44 |
(cd ./google/protobuf && rm any.proto; wget ${URL}/any.proto) |
| 45 |
gogoreplace 'go_package = "github.com/golang/protobuf/ptypes/any";' 'go_package = "types";' ./google/protobuf/any.proto |
| 46 |
(cd ./google/protobuf && rm empty.proto; wget ${URL}/empty.proto) |
| 47 |
gogoreplace 'go_package = "github.com/golang/protobuf/ptypes/empty";' 'go_package = "types";' ./google/protobuf/empty.proto |
| 48 |
(cd ./google/protobuf && rm timestamp.proto; wget ${URL}/timestamp.proto) |
| 49 |
gogoreplace 'go_package = "github.com/golang/protobuf/ptypes/timestamp";' 'go_package = "types";' ./google/protobuf/timestamp.proto |
| 50 |
(cd ./google/protobuf && rm duration.proto; wget ${URL}/duration.proto) |
| 51 |
gogoreplace 'go_package = "github.com/golang/protobuf/ptypes/duration";' 'go_package = "types";' ./google/protobuf/duration.proto |
| 52 |
(cd ./google/protobuf && rm struct.proto; wget ${URL}/struct.proto) |
| 53 |
gogoreplace 'go_package = "github.com/golang/protobuf/ptypes/struct;structpb";' 'go_package = "types";' ./google/protobuf/struct.proto |
| 54 |
(cd ./google/protobuf && rm wrappers.proto; wget ${URL}/wrappers.proto) |
| 55 |
gogoreplace 'go_package = "github.com/golang/protobuf/ptypes/wrappers";' 'go_package = "types";' ./google/protobuf/wrappers.proto |
| 56 |
(cd ./google/protobuf && rm field_mask.proto; wget ${URL}/field_mask.proto) |
| 57 |
gogoreplace 'option go_package = "google.golang.org/genproto/protobuf/field_mask;field_mask";' 'option go_package = "types";' ./google/protobuf/field_mask.proto |
| 58 |
(cd ./google/protobuf && rm api.proto; wget ${URL}/api.proto) |
| 59 |
gogoreplace 'option go_package = "google.golang.org/genproto/protobuf/api;api";' 'option go_package = "types";' ./google/protobuf/api.proto |
| 60 |
(cd ./google/protobuf && rm type.proto; wget ${URL}/type.proto) |
| 61 |
gogoreplace 'option go_package = "google.golang.org/genproto/protobuf/ptype;ptype";' 'option go_package = "types";' ./google/protobuf/type.proto |
| 62 |
(cd ./google/protobuf && rm source_context.proto; wget ${URL}/source_context.proto) |
| 63 |
gogoreplace 'option go_package = "google.golang.org/genproto/protobuf/source_context;source_context";' 'option go_package = "types";' ./google/protobuf/source_context.proto |
| 64 |
|
| 65 |
|