Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update protobuf version #2239

Merged
merged 36 commits into from Oct 10, 2019
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
3c12e0c
update protobuf version
zaqqwerty Sep 29, 2019
228b2f6
Updated protos
zaqqwerty Sep 29, 2019
455ab9f
Merge branch 'master' into update_protobuf_version
zaqqwerty Oct 1, 2019
feb999d
Proto rebuild
zaqqwerty Oct 1, 2019
91ec48a
Merge branch 'master' into update_protobuf_version
zaqqwerty Oct 1, 2019
f587101
Added missing proto builds
zaqqwerty Oct 1, 2019
2cfd259
Renamed proto builder
zaqqwerty Oct 1, 2019
7435c9b
bazel machinery does not work
zaqqwerty Oct 1, 2019
f8887f2
Merge branch 'master' into update_protobuf_version
zaqqwerty Oct 3, 2019
e739f31
Updated protos
zaqqwerty Oct 5, 2019
ca0d2e6
Proto 3.8.0 working in bazel
zaqqwerty Oct 5, 2019
1804ec3
Updated proto BUILDS
zaqqwerty Oct 5, 2019
9e31a21
Updated grpc dep to allow proto 3.8
zaqqwerty Oct 5, 2019
e639145
Tweaked proto req
zaqqwerty Oct 5, 2019
2836a32
Removed proto building from the bash script
zaqqwerty Oct 5, 2019
3db8f98
Changed bash script to only build mypy stubs
zaqqwerty Oct 5, 2019
5d85777
Corrected proto build
zaqqwerty Oct 5, 2019
59c55e0
Added all the rule to proto build script
zaqqwerty Oct 5, 2019
86b58e6
Bazel proto gen functioning
zaqqwerty Oct 5, 2019
11315a3
Updated
zaqqwerty Oct 5, 2019
a456cbc
Merge branch 'master' into update_protobuf_version
zaqqwerty Oct 5, 2019
891dd53
ls
zaqqwerty Oct 6, 2019
482eeb4
reverted proto builder
zaqqwerty Oct 6, 2019
f6eeb81
Build update
zaqqwerty Oct 6, 2019
38134e3
Added bazel to builder\
zaqqwerty Oct 6, 2019
722a429
Moved bazel install to linux specific stage
zaqqwerty Oct 6, 2019
0fce37e
Updated documentation of cirq proto
zaqqwerty Oct 6, 2019
46cba1f
Added script
zaqqwerty Oct 6, 2019
babd577
Harder proto dep
zaqqwerty Oct 6, 2019
58fadd4
Fixed doc typo
zaqqwerty Oct 7, 2019
5d34f2d
Merge branch 'master' into update_protobuf_version
zaqqwerty Oct 8, 2019
a185eb2
Merge branch 'master' into update_protobuf_version
zaqqwerty Oct 8, 2019
3b1bd23
Merge branch 'master' into update_protobuf_version
zaqqwerty Oct 8, 2019
df992d8
Merge branch 'master' into update_protobuf_version
zaqqwerty Oct 9, 2019
3447936
Merge branch 'master' into update_protobuf_version
zaqqwerty Oct 9, 2019
c88a6a6
Merge branch 'master' into update_protobuf_version
zaqqwerty Oct 9, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -34,5 +34,8 @@ docs/generated
# Ignore generated Jupyter files
*.ipynb_checkpoints/

# Ignore Bazel files
/bazel-*

# Default pycharm virtual env
.venv/
9 changes: 9 additions & 0 deletions .travis.yml
Expand Up @@ -93,6 +93,15 @@ matrix:
install:
- cat dev_tools/conf/pip-list-dev-tools.txt | grep mypy | xargs pip install
script: check/mypy
- stage: test
os: linux
env: NAME=build-protos
python: '3.6'
install:
- python -m pip install -r dev_tools/conf/pip-list-dev-tools.txt
- wget https://github.com/bazelbuild/bazel/releases/download/0.26.0/bazel_0.26.0-linux-x86_64.deb
- sudo dpkg -i bazel_0.26.0-linux-x86_64.deb
script: check/build-protos
- stage: test
os: linux
env: NAME=format
Expand Down
53 changes: 48 additions & 5 deletions WORKSPACE
@@ -1,9 +1,52 @@
# proto_library, cc_proto_library, and java_proto_library rules implicitly
# General bazel utility
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

# =========================
# Proto dependencies below.
# =========================

# Native proto_library is deprecated; this is a replacement. See
# https://docs.bazel.build/versions/master/be/protocol-buffer.html#proto_library
http_archive(
name = "rules_proto",
sha256 = "602e7161d9195e50246177e7c55b2f39950a9cf7366f74ed5f22fd45750cd208",
strip_prefix = "rules_proto-97d8af4dc474595af3900dd85cb3a29ad28cc313",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/97d8af4dc474595af3900dd85cb3a29ad28cc313.tar.gz",
"https://github.com/bazelbuild/rules_proto/archive/97d8af4dc474595af3900dd85cb3a29ad28cc313.tar.gz",
],
)
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
rules_proto_dependencies()
rules_proto_toolchains()

# In protobuf 3.8.0, this function is used only to load the zlib dependency.
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
protobuf_deps()

http_archive(
name = "bazel_skylib",
url = "https://github.com/bazelbuild/bazel-skylib/releases/download/0.9.0/bazel_skylib-0.9.0.tar.gz",
sha256 = "1dde365491125a3db70731e25658dfdd3bc5dbdfd11b840b3e987ecf043c7ca0",
)

# Python compatibility.
http_archive(
name = "six_archive",
build_file = "@com_google_protobuf//:six.BUILD",
sha256 = "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a",
url = "https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz#md5=34eed507548117b2ab523ab14b2f8b55",
)
bind(
name = "six",
actual = "@six_archive//:six",
)

# proto_library, py_proto_library, and cc_proto_library rules implicitly
# depend on @com_google_protobuf for protoc and proto runtimes.
# This statement defines the @com_google_protobuf repo.
http_archive(
name = "com_google_protobuf",
sha256 = "cef7f1b5a7c5fba672bec2a319246e8feba471f04dcebfe362d55930ee7c1c30",
strip_prefix = "protobuf-3.5.0",
urls = ["https://github.com/google/protobuf/archive/v3.5.0.zip"],
sha256 = "1e622ce4b84b88b6d2cdf1db38d1a634fe2392d74f0b7b74ff98f3a51838ee53",
strip_prefix = "protobuf-3.8.0",
urls = ["https://github.com/google/protobuf/archive/v3.8.0.zip"],
)
21 changes: 0 additions & 21 deletions check/bazel

This file was deleted.

46 changes: 46 additions & 0 deletions check/build-protos
@@ -0,0 +1,46 @@
#!/usr/bin/env bash

################################################################################
# Runs bazel build for proto files in Cirq/cirq/api/google/*
#
# Usage:
# check/bazel
################################################################################

# Get the working directory to the repo root.
cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$(git rev-parse --show-toplevel)"

# V1 protos below.
bazel build //cirq/api/google/v1:operations_proto
bazel build //cirq/api/google/v1:operations_py_proto
bazel build //cirq/api/google/v1:operations_cc_proto

bazel build //cirq/api/google/v1:params_proto
bazel build //cirq/api/google/v1:params_py_proto
bazel build //cirq/api/google/v1:params_cc_proto

bazel build //cirq/api/google/v1:program_proto
bazel build //cirq/api/google/v1:program_py_proto
bazel build //cirq/api/google/v1:program_cc_proto

# V2 protos below.
bazel build //cirq/api/google/v2:device_proto
bazel build //cirq/api/google/v2:device_py_proto
bazel build //cirq/api/google/v2:device_cc_proto

bazel build //cirq/api/google/v2:metrics_proto
bazel build //cirq/api/google/v2:metrics_py_proto
bazel build //cirq/api/google/v2:metrics_cc_proto

bazel build //cirq/api/google/v2:program_proto
bazel build //cirq/api/google/v2:program_py_proto
bazel build //cirq/api/google/v2:program_cc_proto

bazel build //cirq/api/google/v2:result_proto
bazel build //cirq/api/google/v2:result_py_proto
bazel build //cirq/api/google/v2:result_cc_proto

bazel build //cirq/api/google/v2:run_context_proto
bazel build //cirq/api/google/v2:run_context_py_proto
bazel build //cirq/api/google/v2:run_context_cc_proto
48 changes: 46 additions & 2 deletions cirq/api/google/v1/BUILD
@@ -1,18 +1,62 @@
package(default_visibility = ["//visibility:public"])

load("@com_google_protobuf//:protobuf.bzl", "py_proto_library")

proto_library(
name = "operations_proto",
srcs = ["operations.proto"],
)

py_proto_library(
name = "operations_py_proto",
srcs = ["operations.proto"],
)

cc_proto_library(
name = "operations_cc_proto",
deps = [
":operations_proto"
],
)

proto_library(
name = "params_proto",
srcs = ["params.proto"],
)

py_proto_library(
name = "params_py_proto",
srcs = ["params.proto"],
)

cc_proto_library(
name = "params_cc_proto",
deps = [
":params_proto"
],
)

proto_library(
name = "program_proto",
srcs = ["program.proto"],
deps = [
"operations_proto",
"params_proto",
":operations_proto",
":params_proto",
],
)

py_proto_library(
name = "program_py_proto",
srcs = ["program.proto"],
deps = [
":operations_py_proto",
":params_py_proto",
],
)

cc_proto_library(
name = "program_cc_proto",
deps = [
":program_proto",
],
)
77 changes: 75 additions & 2 deletions cirq/api/google/v2/BUILD
@@ -1,27 +1,100 @@
package(default_visibility = ["//visibility:public"])

load("@com_google_protobuf//:protobuf.bzl", "py_proto_library")

proto_library(
name = "device_proto",
srcs = ["device.proto"],
)

py_proto_library(
name = "device_py_proto",
srcs = ["device.proto"],
)

cc_proto_library(
name = "device_cc_proto",
deps = [
":device_proto"
],
)

proto_library(
name = "metrics_proto",
srcs = ["metrics.proto"],
)

py_proto_library(
name = "metrics_py_proto",
srcs = ["metrics.proto"],
)

cc_proto_library(
name = "metrics_cc_proto",
deps = [
":metrics_proto"
],
)

proto_library(
name = "program_proto",
srcs = ["program.proto"],
)

py_proto_library(
name = "program_py_proto",
srcs = ["program.proto"],
)

cc_proto_library(
name = "program_cc_proto",
deps = [
":program_proto"
],
)

proto_library(
name = "result_proto",
srcs = ["result.proto"],
deps = [
"program_proto",
":program_proto",
],
)

py_proto_library(
name = "result_py_proto",
srcs = ["result.proto"],
deps = [
":program_py_proto",
],
)

cc_proto_library(
name = "result_cc_proto",
deps = [
":result_proto",
],
)

proto_library(
name = "run_context_proto",
srcs = ["run_context.proto"],
deps = [
"program_proto",
":program_proto",
],
)

py_proto_library(
name = "run_context_py_proto",
srcs = ["run_context.proto"],
deps = [
":program_py_proto",
],
)

cc_proto_library(
name = "run_context_cc_proto",
deps = [
":run_context_proto",
],
)
1 change: 1 addition & 0 deletions cirq/api/google/v2/device_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.