Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.

Commit 11f65c8

Browse files
authored
Build fix: switch to new http_archive rule. (#251)
* Upgrade bazel to 0.20.0 where the old rule is gone. * `repo_mapping` is gone, join the diamond using a `local_repository` in `tools/zlib/`. * appveyor: remove the Windows temporary directory we stopped using in #198.
1 parent f08c1ea commit 11f65c8

File tree

6 files changed

+57
-11
lines changed

6 files changed

+57
-11
lines changed

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ before_install:
2929
fi;
3030
tools/format.sh;
3131
fi
32-
- wget https://github.com/bazelbuild/bazel/releases/download/0.19.2/bazel-0.19.2-installer-${BAZEL_OS}-x86_64.sh
33-
- chmod +x bazel-0.19.2-installer-${BAZEL_OS}-x86_64.sh
34-
- ./bazel-0.19.2-installer-${BAZEL_OS}-x86_64.sh --user
32+
- wget https://github.com/bazelbuild/bazel/releases/download/0.20.0/bazel-0.20.0-installer-${BAZEL_OS}-x86_64.sh
33+
- chmod +x bazel-0.20.0-installer-${BAZEL_OS}-x86_64.sh
34+
- ./bazel-0.20.0-installer-${BAZEL_OS}-x86_64.sh --user
3535
- echo "build --disk_cache=$HOME/bazel-cache" > ~/.bazelrc
3636
- echo "build --experimental_strict_action_env" >> ~/.bazelrc
3737

WORKSPACE

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
workspace(name = "io_opencensus_cpp")
1616

17+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
18+
1719
# We depend on Abseil.
1820
http_archive(
1921
name = "com_google_absl",
@@ -59,10 +61,15 @@ bind(
5961
actual = "@com_github_grpc_grpc//:grpc_cpp_plugin",
6062
)
6163

64+
# Used by prometheus-cpp.
65+
local_repository(
66+
name = "net_zlib_zlib",
67+
path = "tools/zlib"
68+
)
69+
6270
# Prometheus client library - used by Prometheus exporter.
6371
http_archive(
6472
name = "com_github_jupp0r_prometheus_cpp",
65-
repo_mapping = {"@net_zlib_zlib": "@com_github_madler_zlib"},
6673
strip_prefix = "prometheus-cpp-master",
6774
urls = ["https://github.com/jupp0r/prometheus-cpp/archive/master.zip"],
6875
)
@@ -73,7 +80,7 @@ load("@com_github_jupp0r_prometheus_cpp//:repositories.bzl", "load_civetweb")
7380
load_civetweb()
7481

7582
# Curl library - used by zipkin exporter.
76-
new_http_archive(
83+
http_archive(
7784
name = "com_github_curl",
7885
build_file_content =
7986
"""
@@ -114,7 +121,7 @@ cc_library(
114121
)
115122

116123
# Rapidjson library - used by zipkin exporter.
117-
new_http_archive(
124+
http_archive(
118125
name = "com_github_rapidjson",
119126
build_file_content =
120127
"""

tools/appveyor/install.bat

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,5 @@ IF NOT EXIST %INSTALL_CACHE% (MKDIR %INSTALL_CACHE%)
1919

2020
REM Download bazel into install cache, which is on the path.
2121
IF NOT EXIST %INSTALL_CACHE%\bazel.exe (
22-
appveyor DownloadFile https://github.com/bazelbuild/bazel/releases/download/0.19.2/bazel-0.19.2-windows-x86_64.exe -FileName %INSTALL_CACHE%\bazel.exe
22+
appveyor DownloadFile https://github.com/bazelbuild/bazel/releases/download/0.20.0/bazel-0.20.0-windows-x86_64.exe -FileName %INSTALL_CACHE%\bazel.exe
2323
)
24-
25-
REM Temporary directory for bazel.
26-
REM TODO: Remove this after https://github.com/bazelbuild/bazel/issues/4149 is fixed.
27-
IF NOT EXIST C:\T (MKDIR C:\T)

tools/zlib/BUILD

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright 2018, OpenCensus Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# @com_github_madler_zlib comes from grpc_deps in the outer workspace.
16+
17+
cc_library(
18+
name = "z",
19+
deps = ["@com_github_madler_zlib//:z"],
20+
visibility = ["//visibility:public"],
21+
)

tools/zlib/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
`prometheus-cpp` imports `zlib` as `@net_zlib_zlib`.
2+
3+
`grpc` imports `zlib` as `@com_github_madler_zlib`.
4+
5+
We use this directory to join the diamond by creating a
6+
`@net_zlib_zlib` external repository that just maps to
7+
`@com_github_madler_zlib`.

tools/zlib/WORKSPACE

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2018, OpenCensus Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
workspace(name = "net_zlib_zlib")

0 commit comments

Comments
 (0)