...
1# Copyright 2022 Google LLC
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15#!/bin/bash
16
17go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
18go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
19export PATH="$PATH:$(go env GOPATH)/bin"
20
21# Regenerate the S2A protos.
22protoc --go_out=. --go_opt=paths=source_relative \
23 --go-grpc_out=. --go-grpc_opt=paths=source_relative \
24 internal/proto/common/common.proto internal/proto/s2a/s2a.proto internal/proto/s2a_context/s2a_context.proto
25
26mkdir -p internal/proto/common_go_proto
27mv internal/proto/common/common.pb.go internal/proto/common_go_proto/common.pb.go
28
29mkdir -p internal/proto/s2a_go_proto
30mv internal/proto/s2a/s2a.pb.go internal/proto/s2a_go_proto/s2a.pb.go
31mv internal/proto/s2a/s2a_grpc.pb.go internal/proto/s2a_go_proto/s2a_grpc.pb.go
32sed -i 's/common_go_proto \"github.com\/google\/s2a\/internal\/proto\/common_go_proto\"/common_go_proto \"github.com\/google\/s2a-go\/internal\/proto\/common_go_proto\"/g' internal/proto/s2a_go_proto/s2a.pb.go
33
34mkdir -p internal/proto/s2a_context_go_proto
35mv internal/proto/s2a_context/s2a_context.pb.go internal/proto/s2a_context_go_proto/s2a_context.pb.go
36sed -i 's/common_go_proto \"github.com\/google\/s2a\/internal\/proto\/common_go_proto\"/common_go_proto \"github.com\/google\/s2a-go\/internal\/proto\/common_go_proto\"/g' internal/proto/s2a_context_go_proto/s2a_context.pb.go
37
38# Regenerate the S2Av2 protos.
39protoc --go_out=. --go_opt=paths=source_relative \
40 --go-grpc_out=. --go-grpc_opt=paths=source_relative \
41 internal/proto/v2/common/common.proto internal/proto/v2/s2a_context/s2a_context.proto internal/proto/v2/s2a/s2a.proto
42
43mkdir -p internal/proto/v2/common_go_proto
44mv internal/proto/v2/common/common.pb.go internal/proto/v2/common_go_proto/common.pb.go
45
46mkdir -p internal/proto/v2/s2a_go_proto
47mv internal/proto/v2/s2a/s2a.pb.go internal/proto/v2/s2a_go_proto/s2a.pb.go
48mv internal/proto/v2/s2a/s2a_grpc.pb.go internal/proto/v2/s2a_go_proto/s2a_grpc.pb.go
49sed -i 's/common_go_proto1 \"github.com\/google\/s2a\/internal\/proto\/common_go_proto\"/common_go_proto1 \"github.com\/google\/s2a-go\/internal\/proto\/common_go_proto\"/g' internal/proto/v2/s2a_go_proto/s2a.pb.go
50sed -i 's/common_go_proto \"github.com\/google\/s2a\/internal\/proto\/v2\/common_go_proto\"/common_go_proto \"github.com\/google\/s2a-go\/internal\/proto\/v2\/common_go_proto\"/g' internal/proto/v2/s2a_go_proto/s2a.pb.go
51sed -i 's/s2a_context_go_proto \"github.com\/google\/s2a\/internal\/proto\/v2\/s2a_context_go_proto\"/s2a_context_go_proto \"github.com\/google\/s2a-go\/internal\/proto\/v2\/s2a_context_go_proto\"/g' internal/proto/v2/s2a_go_proto/s2a.pb.go
52
53mkdir -p internal/proto/v2/s2a_context_go_proto
54mv internal/proto/v2/s2a_context/s2a_context.pb.go internal/proto/v2/s2a_context_go_proto/s2a_context.pb.go
55sed -i 's/common_go_proto \"github.com\/google\/s2a\/internal\/proto\/common_go_proto\"/common_go_proto \"github.com\/google\/s2a-go\/internal\/proto\/common_go_proto\"/g' internal/proto/v2/s2a_context_go_proto/s2a_context.pb.go
56
57# Regenerate the example protos.
58protoc --go_out=. --go_opt=paths=source_relative \
59 --go-grpc_out=. --go-grpc_opt=paths=source_relative \
60 internal/proto/examples/helloworld.proto
61
62mkdir -p internal/proto/examples/helloworld_go_proto
63mv internal/proto/examples/helloworld.pb.go internal/proto/examples/helloworld_go_proto/helloworld.pb.go
64mv internal/proto/examples/helloworld_grpc.pb.go internal/proto/examples/helloworld_go_proto/helloworld_grpc.pb.go
65
66# Regenerate the echo example protos.
67protoc --go_out=. --go_opt=paths=source_relative \
68 --go-grpc_out=. --go-grpc_opt=paths=source_relative \
69 example/proto/echo.proto
70
71mkdir -p example/proto/echo_go_proto
72mv example/proto/echo.pb.go example/proto/echo_go_proto/echo.pb.go
73mv example/proto/echo_grpc.pb.go example/proto/echo_go_proto/echo_grpc.pb.go
View as plain text