Skip to content

Remove bazel from repo #4297

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

Merged
merged 5 commits into from
Jul 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,6 @@ jobs:
- name: Install requirements
run: |
pip install -r dev_tools/requirements/deps/protos.txt
sudo apt install curl gnupg
curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor > bazel.gpg
sudo mv bazel.gpg /etc/apt/trusted.gpg.d/
echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
sudo apt update && sudo apt install bazel
- name: Build protos
run: check/build-changed-protos
coverage:
Expand Down Expand Up @@ -335,4 +330,4 @@ jobs:
- name: Install npm dependencies
run: check/npm ci
- name: Test
run: check/ts-coverage
run: check/ts-coverage
62 changes: 0 additions & 62 deletions WORKSPACE

This file was deleted.

25 changes: 2 additions & 23 deletions check/build-changed-protos
Original file line number Diff line number Diff line change
Expand Up @@ -71,30 +71,9 @@ if [[ ! -z "$changed" ]]; then
done
fi

# Check if any of the build files have changed.
build_changed=$(git diff --name-only ${rev} -- \
| grep "google/api/.*BUILD$" \
| sed -e "s/BUILD//")

if [[ -z "$build_changed" ]]; then
echo -e "No BUILD files changed."
else
# Build all the targets for the changed BUILD rule.
echo -e "BUILD file changed in directories: '${build_changed[@]}'"
for build_prefix in $build_changed
do
(set -x; bazel build "${build_prefix}...:*")
done
fi

# We potentially will attempt to build a second time, but this is not
# a problem as bazel returns immediately.
# We potentially will attempt to build a second time.
for base in $changed
do
(set -x; bazel build "${base}_proto"; \
bazel build "${base}_py_proto"; \
bazel build "${base}_cc_proto")

python -m grpc_tools.protoc -I=cirq-google --python_out=cirq-google --mypy_out=cirq-google ${base}.proto
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is useful to have a job that checks for whether the checked-in pb2 files are up to date with the protos or not. Thus, we should keep the grpc_tools generation part. Also, this might be a good point to clean up the duplication between this job and dev_tools/build-protos.sh.

done

Expand All @@ -109,4 +88,4 @@ if [[ ! -z "$untracked" ]]; then
echo -e "\033[31m ${generated}\033[0m"
done
exit 1
fi
fi
30 changes: 0 additions & 30 deletions check/build-protos

This file was deleted.

62 changes: 0 additions & 62 deletions cirq-google/cirq_google/api/v1/BUILD

This file was deleted.

153 changes: 0 additions & 153 deletions cirq-google/cirq_google/api/v2/BUILD

This file was deleted.

4 changes: 0 additions & 4 deletions docs/dev/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,6 @@ Cirq's protobufs live at [cirq/api/google](https://github.com/quantumlib/Cirq/tr
If any protos are updated, their dependents can be rebuilt by calling the script [dev_tools/build-protos.sh](https://github.com/quantumlib/Cirq/tree/master/dev_tools).
This script uses grpcio-tools and protobuf version 3.8.0 to generate the python proto api.

Additionally, for workflows that use bazel (relevant for C/C++ code depending on Cirq), we have made available bazel rulesets for generating both python and C/C++ proto apis.
These rules live in the BUILD files [here](https://github.com/quantumlib/Cirq/tree/master/cirq/api/google/v1) and [here](https://github.com/quantumlib/Cirq/tree/master/cirq/api/google/v2).
Downstream projects should load Cirq as an [external dependency](https://docs.bazel.build/versions/master/external.html), allowing rules from those BUILD files to be used directly.

## Continuous integration and local testing

There are a few options for running continuous integration checks, varying from easy and fast to slow and reliable.
Expand Down