-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
64 lines (44 loc) · 2.01 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
#
# setup project
set -e
function setup_base() {
touch README.md
touch Makefile
mkdir -p app/{core,web}
mkdir -p cmd/{server,worker,cli}
mkdir -p protos/{core,web}
mkdir -p openapiv2
}
function setup_required_protos() {
echo "building directories for google api protos"
local google_api_dir_root="protos/includes/googleapis"
local grpc_ecosystem_dir_root="protos/includes/grpc_ecosystem/protoc-gen-openapiv2"
mkdir -p "${google_api_dir_root}/google/"{api,protobuf}
mkdir -p "${grpc_ecosystem_dir_root}/options"
ls "${google_api_dir_root}/google/api"
ls "${grpc_ecosystem_dir_root}/options"
curl "https://raw.githubusercontent.com/googleapis/googleapis/master/google/api/http.proto" \
-o "${google_api_dir_root}/google/api/http.proto" \
curl "https://raw.githubusercontent.com/googleapis/googleapis/master/google/api/annotations.proto" \
-o "${google_api_dir_root}/google/api/annotations.proto"
curl "https://raw.githubusercontent.com/protocolbuffers/protobuf/main/src/google/protobuf/descriptor.proto" \
-o "${google_api_dir_root}/google/protobuf/descriptor.proto"
curl "https://raw.githubusercontent.com/protocolbuffers/protobuf/main/src/google/protobuf/struct.proto" \
-o "${google_api_dir_root}/google/protobuf/struct.proto"
curl "https://raw.githubusercontent.com/grpc-ecosystem/grpc-gateway/main/protoc-gen-openapiv2/options/annotations.proto" \
-o "${grpc_ecosystem_dir_root}/options/annotations.proto"
curl "https://raw.githubusercontent.com/grpc-ecosystem/grpc-gateway/main/protoc-gen-openapiv2/options/openapiv2.proto" \
-o "${grpc_ecosystem_dir_root}/options/openapiv2.proto"
}
function setup_go_protogen_execs() {
export GOBIN=$(go env GOBIN)
go mod download google.golang.org/protobuf
go install google.golang.org/protobuf/cmd/protoc-gen-go
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2
}
setup_base
setup_required_protos
setup_go_protogen_execs
echo "run go mod tidy"