build(bazel): use Bazel modules

Issue: #225 #507 #513 #581
Closes: #616
This commit is contained in:
Gregor Jasny
2023-01-30 10:58:02 +01:00
parent e9ae295f0d
commit bb21a73ce8
6 changed files with 34 additions and 3 deletions
+3
View File
@@ -35,6 +35,9 @@ jobs:
- name: Test with SSL
run: bazel test --config=ssl ${{ matrix.bazel_args }} --test_output=all //...
- name: Build with SSL and bzlmod
run: bazel build --enable_bzlmod --config=ssl ${{ matrix.bazel_args }} //...
- name: Build
run: bazel build //...
+19
View File
@@ -0,0 +1,19 @@
module(
name = "prometheus-cpp",
version = "1.1.0",
repo_name = "com_github_jupp0r_prometheus_cpp",
)
data_deps_ext = use_extension("//bazel:repositories.bzl", "data_deps_ext")
use_repo(
data_deps_ext,
"civetweb",
"com_github_curl",
"com_github_google_benchmark",
)
bazel_dep(name = "boringssl", version = "0.0.0-20211025-d4f1ab9")
bazel_dep(name = "googletest", version = "1.12.1", dev_dependency = True, repo_name = "com_google_googletest")
bazel_dep(name = "platforms", version = "0.0.6", dev_dependency = True)
bazel_dep(name = "rules_cc", version = "0.0.4", dev_dependency = True)
bazel_dep(name = "zlib", version = "1.2.13")
+2
View File
@@ -0,0 +1,2 @@
# When Bzlmod is enabled, this file replaces the content of the original WORKSPACE
# and makes sure no WORKSPACE prefix or suffix are added when Bzlmod is enabled.
+8 -1
View File
@@ -47,7 +47,7 @@ def prometheus_cpp_repositories():
maybe(
http_archive,
name = "net_zlib_zlib",
name = "zlib",
sha256 = "b3a24de97a8fdbc835b9833169501030b8977031bcb54b3b3ac13740f846ab30",
strip_prefix = "zlib-1.2.13",
urls = [
@@ -70,3 +70,10 @@ def prometheus_cpp_repositories():
"https://github.com/google/boringssl/archive/b9232f9e27e5668bc0414879dcdedb2a59ea75f2.tar.gz",
],
)
def _data_deps_extension_impl(ctx):
prometheus_cpp_repositories()
data_deps_ext = module_extension(
implementation = _data_deps_extension_impl,
)
+1 -1
View File
@@ -3,7 +3,7 @@
licenses(["notice"]) # BSD/MIT-like license (for zlib)
cc_library(
name = "z",
name = "zlib",
srcs = glob(["*.c"]),
hdrs = glob(["*.h"]),
# Use -Dverbose=-1 to turn off zlib's trace logging. (bazelbuild/bazel#3280)
+1 -1
View File
@@ -23,7 +23,7 @@ cc_library(
deps = [
"//core",
"@civetweb",
"@net_zlib_zlib//:z",
"@zlib",
],
)