diff --git a/check/build-changed-protos b/check/build-changed-protos index b48824abafa..0526c19a189 100755 --- a/check/build-changed-protos +++ b/check/build-changed-protos @@ -55,35 +55,17 @@ else fi # All the protos. -protos=$(find -type f -name "*.proto" -printf '%P\n' \ - | grep "google/api/.*\.proto$" \ - | sed -e "s/\.proto$//") +echo "Building protos in $(pwd)" -# Get the changed protos and strip them of ".proto" -changed=$(git diff --name-only ${rev} -- \ - | grep "google/api/.*\.proto$" \ - | sed -e "s/\.proto$//" -) -if [[ ! -z "$changed" ]]; then - for base in $changed - do - echo -e "Found changed proto: '${base}.proto'" - done -fi - -# We potentially will attempt to build a second time. -for base in $changed -do - python -m grpc_tools.protoc -I=cirq-google --python_out=cirq-google --mypy_out=cirq-google ${base}.proto -done +dev_tools/build-protos.sh # Filenames with spaces will be ugly (each part will be listed separately) # but the error logic will still work. -untracked=$(git status --porcelain 2>/dev/null | grep "^?? cirq/google" | cut -d " " -f 2) +uncommitted=$(git status --porcelain 2>/dev/null | grep -E "^?? cirq-google" | cut -d " " -f 3) -if [[ ! -z "$untracked" ]]; then - echo -e "\033[31mERROR: Uncommitted generated files found! Please generate and commit these files:\033[0m" - for generated in $untracked +if [[ ! -z "$uncommitted" ]]; then + echo -e "\033[31mERROR: Uncommitted generated files found! Please generate and commit these files using dev_tools/build-protos.sh:\033[0m" + for generated in $uncommitted do echo -e "\033[31m ${generated}\033[0m" done diff --git a/cirq-google/requirements.txt b/cirq-google/requirements.txt index dd848b8c2a1..d55938264b3 100644 --- a/cirq-google/requirements.txt +++ b/cirq-google/requirements.txt @@ -1,2 +1,2 @@ google-api-core[grpc] >= 1.14.0, < 2.0.0dev -protobuf~=3.13.0 \ No newline at end of file +protobuf>=3.13.0 \ No newline at end of file diff --git a/dev_tools/requirements/deps/protos.txt b/dev_tools/requirements/deps/protos.txt index 078de7efaa1..8c94c332c28 100644 --- a/dev_tools/requirements/deps/protos.txt +++ b/dev_tools/requirements/deps/protos.txt @@ -1,8 +1,6 @@ # dependencies for proto generation - used by cirq-google -# 1.26.0 is the min version that has python 3.8 wheels -# however, we can't really go much higher - the protoc version needs to be <= 3.9.2 -# otherwise it will generate pb2 files that are incompatible with tensorflow quantum -grpcio-tools~=1.26.0 +# This bundles protoc 3.13.0, which we use for generating proto code. +grpcio-tools~=1.34.1 mypy-protobuf==1.10 \ No newline at end of file