-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
Copy pathMakefile
79 lines (74 loc) · 3.7 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
GENERATED_DIR=$(shell pwd)/generated_python
FINAL_DIR=gcloud/bigtable/_generated
BREW_PREFIX=$(shell brew --prefix)
LD_LIBRARY_PATH=$(BREW_PREFIX)/lib
GRPC_PLUGIN=$(BREW_PREFIX)/bin/grpc_python_plugin
help:
@echo 'Makefile for gcloud-python Bigtable protos '
@echo ' '
@echo ' make generate Generates the protobuf modules '
@echo ' make check_generate Checks that generate succeeded '
@echo ' make clean Clean generated files '
generate:
[ -d cloud-bigtable-client ] || git clone https://github.com/GoogleCloudPlatform/cloud-bigtable-client
cd cloud-bigtable-client && git pull origin master
mkdir -p $(GENERATED_DIR)
# Data API
cd cloud-bigtable-client/bigtable-protos/src/main/proto && \
protoc --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
--plugin=protoc-gen-grpc=$(GRPC_PLUGIN) google/bigtable/v1/*.proto
mv $(GENERATED_DIR)/google/bigtable/v1/* $(FINAL_DIR)
# Cluster API
cd cloud-bigtable-client/bigtable-protos/src/main/proto && \
protoc --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
--plugin=protoc-gen-grpc=$(GRPC_PLUGIN) \
google/bigtable/admin/cluster/v1/*.proto
mv $(GENERATED_DIR)/google/bigtable/admin/cluster/v1/* $(FINAL_DIR)
# Table API
cd cloud-bigtable-client/bigtable-protos/src/main/proto && \
protoc --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
--plugin=protoc-gen-grpc=$(GRPC_PLUGIN) \
google/bigtable/admin/table/v1/*.proto
mv $(GENERATED_DIR)/google/bigtable/admin/table/v1/* $(FINAL_DIR)
# Auxiliary protos
cd cloud-bigtable-client/bigtable-protos/src/main/proto && \
protoc --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
--plugin=protoc-gen-grpc=$(GRPC_PLUGIN) \
google/api/*.proto
mv $(GENERATED_DIR)/google/api/* $(FINAL_DIR)
cd cloud-bigtable-client/bigtable-protos/src/main/proto && \
protoc --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
--plugin=protoc-gen-grpc=$(GRPC_PLUGIN) \
google/protobuf/any.proto
mv $(GENERATED_DIR)/google/protobuf/any_pb2.py $(FINAL_DIR)
cd cloud-bigtable-client/bigtable-protos/src/main/proto && \
protoc --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
--plugin=protoc-gen-grpc=$(GRPC_PLUGIN) \
google/protobuf/duration.proto
mv $(GENERATED_DIR)/google/protobuf/duration_pb2.py $(FINAL_DIR)
cd cloud-bigtable-client/bigtable-protos/src/main/proto && \
protoc --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
--plugin=protoc-gen-grpc=$(GRPC_PLUGIN) \
google/protobuf/empty.proto
mv $(GENERATED_DIR)/google/protobuf/empty_pb2.py $(FINAL_DIR)
cd cloud-bigtable-client/bigtable-protos/src/main/proto && \
protoc --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
--plugin=protoc-gen-grpc=$(GRPC_PLUGIN) \
google/protobuf/timestamp.proto
mv $(GENERATED_DIR)/google/protobuf/timestamp_pb2.py $(FINAL_DIR)
cd cloud-bigtable-client/bigtable-protos/src/main/proto && \
protoc --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
--plugin=protoc-gen-grpc=$(GRPC_PLUGIN) \
google/longrunning/operations.proto
mv $(GENERATED_DIR)/google/longrunning/operations_pb2.py $(FINAL_DIR)
cd cloud-bigtable-client/bigtable-protos/src/main/proto && \
protoc --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
--plugin=protoc-gen-grpc=$(GRPC_PLUGIN) \
google/rpc/status.proto
mv $(GENERATED_DIR)/google/rpc/status_pb2.py $(FINAL_DIR)
python scripts/rewrite_imports.py
check_generate:
python scripts/check_generate.py
clean:
rm -fr cloud-bigtable-client $(GENERATED_DIR)
.PHONY: generate check_generate clean