-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
209 lines (201 loc) · 13.2 KB
/
Makefile
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
YB_SRC_DIR?=/tmp/ybdb
CURRENT_DIR=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
# do not add v2 here, the directory structure stays untouched
GO_PACKAGE=github.com/radekg/yugabyte-db-go-proto
.PHONY: clean
clean:
rm -rf ${CURRENT_DIR}/proto/*
rm -rf ${CURRENT_DIR}/yb
.PHONY: get-proto
get-proto:
YB_SRC_DIR=${YB_SRC_DIR} ${CURRENT_DIR}/bin/get-proto.sh
.PHONY: gen-proto
gen-proto:
protoc --proto_path=./proto \
--go_opt=Myb/cdc/cdc_consumer.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/cdc/cdc_service.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/common/common_net.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/common/common_types.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/common/common.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/common/pgsql_protocol.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/common/ql_protocol.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/common/redis_protocol.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/common/transaction.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/common/value.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/common/wire_protocol.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/consensus/consensus_metadata.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/consensus/consensus_types.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/consensus/consensus.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/consensus/log.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/docdb/docdb.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/encryption/encryption.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/fs/fs.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/master/catalog_entity_info.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/master/master_admin.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/master/master_backup.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/master/master_client.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/master/master_cluster.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/master/master_dcl.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/master/master_ddl.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/master/master_encryption.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/master/master_heartbeat.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/master/master_replication.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/master/master_types.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/rocksdb/db/version_edit.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/rpc/any.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/rpc/lightweight_message.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/rpc/rpc_header.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/rpc/rpc_introspection.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/rpc/rtest_diff_package.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/rpc/rtest.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/rpc/service.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/server/server_base.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/tablet/operations.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/tablet/tablet_metadata.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/tablet/tablet_types.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/tablet/tablet.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/tserver/backup.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/tserver/pg_client.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/tserver/remote_bootstrap.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/tserver/tserver_admin.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/tserver/tserver_forward_service.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/tserver/tserver_service.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/tserver/tserver_types.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/tserver/tserver.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/util/histogram.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/util/jsonwriter_test.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/util/opid.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/util/pb_util.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/util/proto_container_test.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/util/proto_container_test2.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/util/proto_container_test3.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/util/version_info.proto=${GO_PACKAGE}/yb/api \
--go_opt=Myb/yql/cql/cqlserver/cql_service.proto=${GO_PACKAGE}/yb/api/yql/cql/cqlserver \
--go_opt=Myb/yql/redis/redisserver/redis_service.proto=${GO_PACKAGE}/yb/api/yql/redis/redisserver \
--go-grpc_opt=Myb/cdc/cdc_consumer.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/cdc/cdc_service.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/common/common_net.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/common/common_types.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/common/common.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/common/pgsql_protocol.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/common/ql_protocol.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/common/redis_protocol.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/common/transaction.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/common/value.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/common/wire_protocol.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/consensus/consensus_metadata.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/consensus/consensus_types.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/consensus/consensus.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/consensus/log.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/docdb/docdb.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/encryption/encryption.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/fs/fs.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/master/catalog_entity_info.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/master/master_admin.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/master/master_backup.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/master/master_client.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/master/master_cluster.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/master/master_dcl.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/master/master_ddl.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/master/master_encryption.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/master/master_heartbeat.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/master/master_replication.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/master/master_types.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/rocksdb/db/version_edit.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/rpc/any.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/rpc/lightweight_message.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/rpc/rpc_header.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/rpc/rpc_introspection.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/rpc/rtest_diff_package.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/rpc/rtest.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/rpc/service.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/server/server_base.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/tablet/operations.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/tablet/tablet_metadata.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/tablet/tablet_types.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/tablet/tablet.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/tserver/backup.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/tserver/pg_client.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/tserver/remote_bootstrap.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/tserver/tserver_admin.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/tserver/tserver_forward_service.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/tserver/tserver_service.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/tserver/tserver_types.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/tserver/tserver.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/util/histogram.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/util/jsonwriter_test.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/util/opid.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/util/pb_util.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/util/proto_container_test.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/util/proto_container_test2.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/util/proto_container_test3.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/util/version_info.proto=${GO_PACKAGE}/yb/api \
--go-grpc_opt=Myb/yql/cql/cqlserver/cql_service.proto=${GO_PACKAGE}/yb/api/yql/cql/cqlserver \
--go-grpc_opt=Myb/yql/redis/redisserver/redis_service.proto=${GO_PACKAGE}/yb/api/yql/redis/redisserver \
--go_out=${GOPATH}/src/ \
--go-grpc_out=${GOPATH}/src/ \
--go-grpc_opt=require_unimplemented_servers=false \
$$(find proto/yb -iname "*.proto")
$(MAKE) fix-cdc-service-types fix-consensus-types fix-master-types fix-rtest-types
.PHONY: fix-cdc-service-types
fix-cdc-service-types:
sed -i.bak -e 's!ListTabletsRequestPB!CDCListTabletsRequestPB!g' ${GOPATH}/src/${GO_PACKAGE}/yb/api/cdc_service.pb.go \
&& rm -- ${GOPATH}/src/${GO_PACKAGE}/yb/api/cdc_service.pb.go.bak
sed -i.bak -e 's!ListTabletsResponsePB!CDCListTabletsResponsePB!g' ${GOPATH}/src/${GO_PACKAGE}/yb/api/cdc_service.pb.go \
&& rm -- ${GOPATH}/src/${GO_PACKAGE}/yb/api/cdc_service.pb.go.bak
sed -i.bak -e 's!KeyValuePairPB!CDCKeyValuePairPB!g' ${GOPATH}/src/${GO_PACKAGE}/yb/api/cdc_service.pb.go \
&& rm -- ${GOPATH}/src/${GO_PACKAGE}/yb/api/cdc_service.pb.go.bak
sed -i.bak -e 's!ListTabletsRequestPB!CDCListTabletsRequestPB!g' ${GOPATH}/src/${GO_PACKAGE}/yb/api/cdc_service_grpc.pb.go \
&& rm -- ${GOPATH}/src/${GO_PACKAGE}/yb/api/cdc_service_grpc.pb.go.bak
sed -i.bak -e 's!ListTabletsResponsePB!CDCListTabletsResponsePB!g' ${GOPATH}/src/${GO_PACKAGE}/yb/api/cdc_service_grpc.pb.go \
&& rm -- ${GOPATH}/src/${GO_PACKAGE}/yb/api/cdc_service_grpc.pb.go.bak
sed -i.bak -e 's!KeyValuePairPB!CDCKeyValuePairPB!g' ${GOPATH}/src/${GO_PACKAGE}/yb/api/cdc_service_grpc.pb.go \
&& rm -- ${GOPATH}/src/${GO_PACKAGE}/yb/api/cdc_service_grpc.pb.go.bak
.PHONY: fix-consensus-types
fix-consensus-types:
sed -i.bak -e 's!NoOpRequestPB!ConsensusNoOpRequestPB!g' ${GOPATH}/src/${GO_PACKAGE}/yb/api/consensus.pb.go \
&& rm -- ${GOPATH}/src/${GO_PACKAGE}/yb/api/consensus.pb.go.bak
sed -i.bak -e 's!NoOpResponsePB!ConsensusNoOpResponsePB!g' ${GOPATH}/src/${GO_PACKAGE}/yb/api/consensus.pb.go \
&& rm -- ${GOPATH}/src/${GO_PACKAGE}/yb/api/consensus.pb.go.bak
.PHONY: fix-rtest-types
fix-rtest-types:
sed -i.bak -e 's!PingRequestPB!RTestPingRequestPB!g' ${GOPATH}/src/${GO_PACKAGE}/yb/api/rtest_grpc.pb.go \
&& rm -- ${GOPATH}/src/${GO_PACKAGE}/yb/api/rtest_grpc.pb.go.bak
sed -i.bak -e 's!PingResponsePB!RTestPingResponsePB!g' ${GOPATH}/src/${GO_PACKAGE}/yb/api/rtest_grpc.pb.go \
&& rm -- ${GOPATH}/src/${GO_PACKAGE}/yb/api/rtest_grpc.pb.go.bak
sed -i.bak -e 's!PingRequestPB!RTestPingRequestPB!g' ${GOPATH}/src/${GO_PACKAGE}/yb/api/rtest.pb.go \
&& rm -- ${GOPATH}/src/${GO_PACKAGE}/yb/api/rtest.pb.go.bak
sed -i.bak -e 's!PingResponsePB!RTestPingResponsePB!g' ${GOPATH}/src/${GO_PACKAGE}/yb/api/rtest.pb.go \
&& rm -- ${GOPATH}/src/${GO_PACKAGE}/yb/api/rtest.pb.go.bak
.PHONY: fix-master-types
fix-master-types:
sed -i.bak -e 's!SplitTabletRequestPB!MasterSplitTabletRequestPB!g' ${GOPATH}/src/${GO_PACKAGE}/yb/api/master_admin.pb.go \
&& rm -- ${GOPATH}/src/${GO_PACKAGE}/yb/api/master_admin.pb.go.bak
sed -i.bak -e 's!SplitTabletResponsePB!MasterSplitTabletResponsePB!g' ${GOPATH}/src/${GO_PACKAGE}/yb/api/master_admin.pb.go \
&& rm -- ${GOPATH}/src/${GO_PACKAGE}/yb/api/master_admin.pb.go.bak
sed -i.bak -e 's!BackfillIndexRequestPB!MasterBackfillIndexRequestPB!g' ${GOPATH}/src/${GO_PACKAGE}/yb/api/master_ddl.pb.go \
&& rm -- ${GOPATH}/src/${GO_PACKAGE}/yb/api/master_ddl.pb.go.bak
sed -i.bak -e 's!BackfillIndexResponsePB!MasterBackfillIndexResponsePB!g' ${GOPATH}/src/${GO_PACKAGE}/yb/api/master_ddl.pb.go \
&& rm -- ${GOPATH}/src/${GO_PACKAGE}/yb/api/master_ddl.pb.go.bak
sed -i.bak -e 's!CreateCDCStreamRequestPB!MasterCreateCDCStreamRequestPB!g' ${GOPATH}/src/${GO_PACKAGE}/yb/api/master_replication.pb.go \
&& rm -- ${GOPATH}/src/${GO_PACKAGE}/yb/api/master_replication.pb.go.bak
sed -i.bak -e 's!CreateCDCStreamResponsePB!MasterCreateCDCStreamResponsePB!g' ${GOPATH}/src/${GO_PACKAGE}/yb/api/master_replication.pb.go \
&& rm -- ${GOPATH}/src/${GO_PACKAGE}/yb/api/master_replication.pb.go.bak
sed -i.bak -e 's!DeleteCDCStreamRequestPB!MasterDeleteCDCStreamRequestPB!g' ${GOPATH}/src/${GO_PACKAGE}/yb/api/master_replication.pb.go \
&& rm -- ${GOPATH}/src/${GO_PACKAGE}/yb/api/master_replication.pb.go.bak
sed -i.bak -e 's!DeleteCDCStreamResponsePB!MasterDeleteCDCStreamResponsePB!g' ${GOPATH}/src/${GO_PACKAGE}/yb/api/master_replication.pb.go \
&& rm -- ${GOPATH}/src/${GO_PACKAGE}/yb/api/master_replication.pb.go.bak
sed -i.bak -e 's!GetCDCDBStreamInfoRequestPB!MasterGetCDCDBStreamInfoRequestPB!g' ${GOPATH}/src/${GO_PACKAGE}/yb/api/master_replication.pb.go \
&& rm -- ${GOPATH}/src/${GO_PACKAGE}/yb/api/master_replication.pb.go.bak
sed -i.bak -e 's!GetCDCDBStreamInfoResponsePB!MasterGetCDCDBStreamInfoResponsePB!g' ${GOPATH}/src/${GO_PACKAGE}/yb/api/master_replication.pb.go \
&& rm -- ${GOPATH}/src/${GO_PACKAGE}/yb/api/master_replication.pb.go.bak
.PHONY: prototools
prototools:
go get -u github.com/golang/protobuf/proto \
github.com/golang/protobuf/protoc-gen-go \
google.golang.org/grpc \
google.golang.org/protobuf/cmd/protoc-gen-go \
google.golang.org/grpc/cmd/protoc-gen-go-grpc
go install google.golang.org/protobuf/cmd/protoc-gen-go \
google.golang.org/grpc/cmd/protoc-gen-go-grpc
go mod tidy