Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bde00aa

Browse files
committed
Making pb2 auto-gen script also copy over .proto files.
1 parent 56218ef commit bde00aa

File tree

1 file changed

+65
-21
lines changed

1 file changed

+65
-21
lines changed

Makefile

Lines changed: 65 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
GENERATED_DIR=$(shell pwd)/generated_python
2-
FINAL_DIR=gcloud/bigtable/_generated
2+
FINAL_DIR=$(shell pwd)/gcloud/bigtable/_generated
33
GRPC_PLUGIN=grpc_python_plugin
4+
PROTOC_CMD=protoc
45

56
help:
67
@echo 'Makefile for gcloud-python Bigtable protos '
@@ -15,56 +16,99 @@ generate:
1516
mkdir -p $(GENERATED_DIR)
1617
# Data API
1718
cd cloud-bigtable-client/bigtable-protos/src/main/proto && \
18-
protoc --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
19-
--plugin=protoc-gen-grpc=$(GRPC_PLUGIN) google/bigtable/v1/*.proto
19+
$(PROTOC_CMD) --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
20+
--plugin=protoc-gen-grpc=$(GRPC_PLUGIN) google/bigtable/v1/*.proto && \
21+
cp google/bigtable/v1/bigtable_data.proto \
22+
$(FINAL_DIR)/_bigtable_data.proto && \
23+
cp google/bigtable/v1/bigtable_service.proto \
24+
$(FINAL_DIR)/_bigtable_service.proto && \
25+
cp google/bigtable/v1/bigtable_service_messages.proto \
26+
$(FINAL_DIR)/_bigtable_service_messages.proto && \
27+
chmod -x $(FINAL_DIR)/_bigtable_data.proto && \
28+
chmod -x $(FINAL_DIR)/_bigtable_service.proto && \
29+
chmod -x $(FINAL_DIR)/_bigtable_service_messages.proto
2030
mv $(GENERATED_DIR)/google/bigtable/v1/* $(FINAL_DIR)
2131
# Cluster API
2232
cd cloud-bigtable-client/bigtable-protos/src/main/proto && \
23-
protoc --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
33+
$(PROTOC_CMD) --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
2434
--plugin=protoc-gen-grpc=$(GRPC_PLUGIN) \
25-
google/bigtable/admin/cluster/v1/*.proto
35+
google/bigtable/admin/cluster/v1/*.proto && \
36+
cp google/bigtable/admin/cluster/v1/bigtable_cluster_data.proto \
37+
$(FINAL_DIR)/_bigtable_cluster_data.proto && \
38+
cp google/bigtable/admin/cluster/v1/bigtable_cluster_service.proto \
39+
$(FINAL_DIR)/_bigtable_cluster_service.proto && \
40+
cp google/bigtable/admin/cluster/v1/bigtable_cluster_service_messages.proto \
41+
$(FINAL_DIR)/_bigtable_cluster_service_messages.proto && \
42+
chmod -x $(FINAL_DIR)/_bigtable_cluster_data.proto && \
43+
chmod -x $(FINAL_DIR)/_bigtable_cluster_service.proto && \
44+
chmod -x $(FINAL_DIR)/_bigtable_cluster_service_messages.proto
2645
mv $(GENERATED_DIR)/google/bigtable/admin/cluster/v1/* $(FINAL_DIR)
2746
# Table API
2847
cd cloud-bigtable-client/bigtable-protos/src/main/proto && \
29-
protoc --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
48+
$(PROTOC_CMD) --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
3049
--plugin=protoc-gen-grpc=$(GRPC_PLUGIN) \
31-
google/bigtable/admin/table/v1/*.proto
50+
google/bigtable/admin/table/v1/*.proto && \
51+
cp google/bigtable/admin/table/v1/bigtable_table_data.proto \
52+
$(FINAL_DIR)/_bigtable_table_data.proto && \
53+
cp google/bigtable/admin/table/v1/bigtable_table_service.proto \
54+
$(FINAL_DIR)/_bigtable_table_service.proto && \
55+
cp google/bigtable/admin/table/v1/bigtable_table_service_messages.proto \
56+
$(FINAL_DIR)/_bigtable_table_service_messages.proto && \
57+
chmod -x $(FINAL_DIR)/_bigtable_table_data.proto && \
58+
chmod -x $(FINAL_DIR)/_bigtable_table_service.proto && \
59+
chmod -x $(FINAL_DIR)/_bigtable_table_service_messages.proto
3260
mv $(GENERATED_DIR)/google/bigtable/admin/table/v1/* $(FINAL_DIR)
3361
# Auxiliary protos
3462
cd cloud-bigtable-client/bigtable-protos/src/main/proto && \
35-
protoc --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
63+
$(PROTOC_CMD) --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
3664
--plugin=protoc-gen-grpc=$(GRPC_PLUGIN) \
37-
google/api/*.proto
65+
google/api/*.proto && \
66+
cp google/api/annotations.proto $(FINAL_DIR)/_annotations.proto && \
67+
cp google/api/http.proto $(FINAL_DIR)/_http.proto && \
68+
chmod -x $(FINAL_DIR)/_annotations.proto && \
69+
chmod -x $(FINAL_DIR)/_http.proto
3870
mv $(GENERATED_DIR)/google/api/* $(FINAL_DIR)
3971
cd cloud-bigtable-client/bigtable-protos/src/main/proto && \
40-
protoc --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
72+
$(PROTOC_CMD) --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
4173
--plugin=protoc-gen-grpc=$(GRPC_PLUGIN) \
42-
google/protobuf/any.proto
74+
google/protobuf/any.proto && \
75+
cp google/protobuf/any.proto $(FINAL_DIR)/_any.proto && \
76+
chmod -x $(FINAL_DIR)/_any.proto
4377
mv $(GENERATED_DIR)/google/protobuf/any_pb2.py $(FINAL_DIR)
4478
cd cloud-bigtable-client/bigtable-protos/src/main/proto && \
45-
protoc --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
79+
$(PROTOC_CMD) --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
4680
--plugin=protoc-gen-grpc=$(GRPC_PLUGIN) \
47-
google/protobuf/duration.proto
81+
google/protobuf/duration.proto && \
82+
cp google/protobuf/duration.proto $(FINAL_DIR)/_duration.proto && \
83+
chmod -x $(FINAL_DIR)/_duration.proto
4884
mv $(GENERATED_DIR)/google/protobuf/duration_pb2.py $(FINAL_DIR)
4985
cd cloud-bigtable-client/bigtable-protos/src/main/proto && \
50-
protoc --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
86+
$(PROTOC_CMD) --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
5187
--plugin=protoc-gen-grpc=$(GRPC_PLUGIN) \
52-
google/protobuf/empty.proto
88+
google/protobuf/empty.proto && \
89+
cp google/protobuf/empty.proto $(FINAL_DIR)/_empty.proto && \
90+
chmod -x $(FINAL_DIR)/_empty.proto
5391
mv $(GENERATED_DIR)/google/protobuf/empty_pb2.py $(FINAL_DIR)
5492
cd cloud-bigtable-client/bigtable-protos/src/main/proto && \
55-
protoc --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
93+
$(PROTOC_CMD) --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
5694
--plugin=protoc-gen-grpc=$(GRPC_PLUGIN) \
57-
google/protobuf/timestamp.proto
95+
google/protobuf/timestamp.proto && \
96+
cp google/protobuf/timestamp.proto $(FINAL_DIR)/_timestamp.proto && \
97+
chmod -x $(FINAL_DIR)/_timestamp.proto
5898
mv $(GENERATED_DIR)/google/protobuf/timestamp_pb2.py $(FINAL_DIR)
5999
cd cloud-bigtable-client/bigtable-protos/src/main/proto && \
60-
protoc --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
100+
$(PROTOC_CMD) --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
61101
--plugin=protoc-gen-grpc=$(GRPC_PLUGIN) \
62-
google/longrunning/operations.proto
102+
google/longrunning/operations.proto && \
103+
cp google/longrunning/operations.proto $(FINAL_DIR)/_operations.proto && \
104+
chmod -x $(FINAL_DIR)/_operations.proto
63105
mv $(GENERATED_DIR)/google/longrunning/operations_pb2.py $(FINAL_DIR)
64106
cd cloud-bigtable-client/bigtable-protos/src/main/proto && \
65-
protoc --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
107+
$(PROTOC_CMD) --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
66108
--plugin=protoc-gen-grpc=$(GRPC_PLUGIN) \
67-
google/rpc/status.proto
109+
google/rpc/status.proto && \
110+
cp google/rpc/status.proto $(FINAL_DIR)/_status.proto && \
111+
chmod -x $(FINAL_DIR)/_status.proto
68112
mv $(GENERATED_DIR)/google/rpc/status_pb2.py $(FINAL_DIR)
69113
python scripts/rewrite_imports.py
70114

0 commit comments

Comments
 (0)