Skip to content

Commit 3b8ad44

Browse files
authored
ci: upgrade builds to use Bazel 1.0 (#3248)
Also upgrade Bazel for this repository. Mostly this entails upgrading several dependencies (notably gRPC). There are a couple of new warnings in the Bazel build, I think those should be fixed in a separate PR.
1 parent 656ffeb commit 3b8ad44

File tree

5 files changed

+35
-28
lines changed

5 files changed

+35
-28
lines changed

.bazelignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
ci/
2+
cmake-out/
3+
cmake-build-debug/
4+
cmake-build-release/

WORKSPACE

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,19 @@ load("//bazel:google_cloud_cpp_deps.bzl", "google_cloud_cpp_deps")
1818

1919
google_cloud_cpp_deps()
2020

21-
load("@com_github_googleapis_google_cloud_cpp_common//bazel:google_cloud_cpp_common_deps.bzl", "google_cloud_cpp_common_deps")
22-
23-
google_cloud_cpp_common_deps()
24-
21+
# Configure @com_google_googleapis to only compile C++ and gRPC libraries.
2522
load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_language")
2623

27-
# Configure @com_google_googleapis to only compile C++ and gRPC:
2824
switched_rules_by_language(
2925
name = "com_google_googleapis_imports",
3026
cc = True, # C++ support is only "Partially implemented", roll our own.
3127
grpc = True,
3228
)
3329

34-
# Have to manually call the corresponding function for gRPC:
35-
# https://github.com/bazelbuild/bazel/issues/1550
30+
load("@com_github_googleapis_google_cloud_cpp_common//bazel:google_cloud_cpp_common_deps.bzl", "google_cloud_cpp_common_deps")
31+
32+
google_cloud_cpp_common_deps()
33+
3634
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
3735

3836
grpc_deps()

bazel/google_cloud_cpp_deps.bzl

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ def google_cloud_cpp_deps():
6464
http_archive(
6565
name = "com_google_googleapis",
6666
urls = [
67-
"https://github.com/googleapis/googleapis/archive/a8ee1416f4c588f2ab92da72e7c1f588c784d3e6.tar.gz",
67+
"https://github.com/googleapis/googleapis/archive/9c9f778aedde02f9826d2ae5d0f9c96409ba0f25.tar.gz",
6868
],
69-
strip_prefix = "googleapis-a8ee1416f4c588f2ab92da72e7c1f588c784d3e6",
70-
sha256 = "6b8a9b2bcb4476e9a5a9872869996f0d639c8d5df76dd8a893e79201f211b1cf",
69+
strip_prefix = "googleapis-9c9f778aedde02f9826d2ae5d0f9c96409ba0f25",
70+
sha256 = "13af135d8cc9b81b47d6fbfc258fe790a151956d06e01fd16671aa49fe536ab1",
7171
build_file = "@com_github_googleapis_google_cloud_cpp//bazel:googleapis.BUILD",
7272
)
7373

@@ -84,6 +84,18 @@ def google_cloud_cpp_deps():
8484
sha256 = "c84b3fa140fcd6cce79b3f9de6357c5733a0071e04ca4e65ba5f8d306f10f033",
8585
)
8686

87+
# We use the cc_proto_library() rule from @com_google_protobuf, which
88+
# assumes that grpc_cpp_plugin and grpc_lib are in the //external: module
89+
native.bind(
90+
name = "grpc_cpp_plugin",
91+
actual = "@com_github_grpc_grpc//src/compiler:grpc_cpp_plugin",
92+
)
93+
94+
native.bind(
95+
name = "grpc_lib",
96+
actual = "@com_github_grpc_grpc//:grpc++",
97+
)
98+
8799
# We need libcurl for the Google Cloud Storage client.
88100
if "com_github_curl_curl" not in native.existing_rules():
89101
http_archive(
@@ -117,15 +129,3 @@ def google_cloud_cpp_deps():
117129
sha256 = "6b3b1d861bb8307658b2407bc7a4c59e566855ef5368a60b35c893551e4788e9",
118130
build_file = "@com_github_googleapis_google_cloud_cpp//bazel:crc32c.BUILD",
119131
)
120-
121-
# We use the cc_proto_library() rule from @com_google_protobuf, which
122-
# assumes that grpc_cpp_plugin and grpc_lib are in the //external: module
123-
native.bind(
124-
name = "grpc_cpp_plugin",
125-
actual = "@com_github_grpc_grpc//:grpc_cpp_plugin",
126-
)
127-
128-
native.bind(
129-
name = "grpc_lib",
130-
actual = "@com_github_grpc_grpc//:grpc++",
131-
)

ci/install-bazel.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,16 @@
1616

1717
set -eu
1818

19+
if [[ -z "${PROJECT_ROOT+x}" ]]; then
20+
PROJECT_ROOT="$(cd "$(dirname "$0")/.."; pwd)"
21+
readonly PROJECT_ROOT
22+
fi
23+
source "${PROJECT_ROOT}/ci/etc/install-config.sh"
24+
1925
readonly PLATFORM=$(printf "%s-%s" "$(uname -s)" "$(uname -m)" \
2026
| tr '[:upper:]' '[:lower:]')
2127

22-
readonly BAZEL_VERSION="0.24.0"
28+
readonly BAZEL_VERSION="${GOOGLE_CLOUD_CPP_BAZEL_VERSION}"
2329
readonly GITHUB_DL="https://github.com/bazelbuild/bazel/releases/download"
2430
readonly SCRIPT_NAME="bazel-${BAZEL_VERSION}-installer-${PLATFORM}.sh"
2531
wget -q "${GITHUB_DL}/${BAZEL_VERSION}/${SCRIPT_NAME}"

ci/test-install/WORKSPACE

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@ load("@com_github_googleapis_google_cloud_cpp//bazel:google_cloud_cpp_deps.bzl",
3535

3636
google_cloud_cpp_deps()
3737

38-
load("@com_github_googleapis_google_cloud_cpp_common//bazel:google_cloud_cpp_common_deps.bzl", "google_cloud_cpp_common_deps")
39-
40-
google_cloud_cpp_common_deps()
41-
42-
# Configure @com_google_googleapis to only compile C++ and gRPC:
4338
load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_language")
4439

4540
switched_rules_by_language(
@@ -48,6 +43,10 @@ switched_rules_by_language(
4843
grpc = True,
4944
)
5045

46+
load("@com_github_googleapis_google_cloud_cpp_common//bazel:google_cloud_cpp_common_deps.bzl", "google_cloud_cpp_common_deps")
47+
48+
google_cloud_cpp_common_deps()
49+
5150
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
5251

5352
grpc_deps()

0 commit comments

Comments
 (0)