OLD | NEW |
| 1 # CQ Client Library. |
| 2 |
1 This directory contains CQ client library to be distributed to other repos. If | 3 This directory contains CQ client library to be distributed to other repos. If |
2 you need to modify some files in this directory, please make sure that you are | 4 you need to modify some files in this directory, please make sure that you are |
3 changing the canonical version of the source code and not one of the copies, | 5 changing the canonical version of the source code and not one of the copies, |
4 which should only be updated as a whole using Glyco (when available, see | 6 which should only be updated as a whole using Glyco (when available, see |
5 [chromium issue 489420](http://crbug.com/489420)). | 7 [chromium issue 489420](http://crbug.com/489420)). |
6 | 8 |
7 The canonical version is located at `https://chrome-internal.googlesource.com/ | 9 The canonical version is located at |
8 infra/infra_internal/+/master/commit_queue/cq_client`. | 10 [https://chrome-internal.googlesource.com/infra/infra_internal/+/master/commit_q
ueue/cq_client](). |
9 | 11 |
10 You'll need to use protoc version 2.6.1 and | 12 When modifying cq.proto, consider adding checks to validator in |
11 recent golang/protobuf package. Sadly, the latter has neither tags nor versions. | 13 [https://chrome-internal.googlesource.com/infra/infra_internal/+/master/appengin
e/commit_queue/src/commitqueue/validate.go](). |
12 | 14 |
13 You can get protobuf by downloading archive from | |
14 https://github.com/google/protobuf/tree/v2.6.1 and manually building it. As for | |
15 golang compiler, if you have go configured, just | |
16 | 15 |
17 go get -u github.com/golang/protobuf/{proto,protoc-gen-go} | 16 ## Generation of Python and Go bindings |
18 | 17 |
19 TODO(tandrii,sergiyb): decide how to pin the go protobuf generator. | 18 ### tl;dr |
| 19 |
| 20 make |
20 | 21 |
21 To generate `cq_pb2.py` and `cq.pb.go`: | |
22 | 22 |
23 cd commit_queue/cq_client | 23 ### Details |
24 protoc cq.proto --python_out $(pwd) --go_out $(pwd) | |
25 | 24 |
26 Additionally, please make sure to use proto3-compatible syntax, e.g. no default | 25 All commands below assume you are working in a standard infra_internal gclient |
27 values, no required fields. Ideally, we should use proto3 generator already, | 26 checkout (e.g., after you ran `mkdir src && cd src && fetch infra_internal`) and |
28 however alpha version thereof is still unstable. | 27 are in current directory of this README.md (that is, in |
| 28 `cd infra_internal/commit_queue/cq_client`). |
29 | 29 |
| 30 To generate Python's `cq_pb2.py` you'll need to get and `protoc` of version |
| 31 **2.6.1**. You can get it by `make py-prepare`. |
| 32 |
| 33 make py |
| 34 |
| 35 To generate Golang's protobuf file `cq.pb.go`, you'll need to bootstrap |
| 36 infra/infra repository and go utilities `make go-prepare`. |
| 37 |
| 38 make go |
| 39 |
| 40 ## Notes |
| 41 |
| 42 1. Please make sure to use proto3-compatible yntax, e.g. no default |
| 43 values, no required fields. As of this writing (Jan 2016), |
| 44 the Go protobuf compiler has been upgraded to 3.0.0. So, if you can generate go |
| 45 bindings, all is good. |
| 46 |
| 47 2. If after generating Python binding, CQ tests fail with: |
| 48 |
| 49 TypeError: __init__() got an unexpected keyword argument 'syntax' |
| 50 |
| 51 You've probably used 3.0.0 protoc generator. We should eventually switch to 3x |
| 52 Python version as well, but it requires upgrading infra's Python ENV to newer |
| 53 package. See [bootstrap/README.md](../../bootstrap/README.md) for more |
| 54 information. We may end up deprecating Python before all infra's Python code |
| 55 can be moved to protobuf v3. |
OLD | NEW |