feat(bazel): port to bzlmod (#1097)

This commit is contained in:
Vertexwahn 2024-06-08 16:02:59 +02:00 committed by GitHub
parent cd4ef77d58
commit d76999015c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 7 additions and 23 deletions

View File

@ -3,4 +3,5 @@ module(
compatibility_level = 1, compatibility_level = 1,
) )
bazel_dep(name = "gflags", version = "2.2.2", repo_name = "com_github_gflags_gflags") bazel_dep(name = "gflags", version = "2.2.2")
bazel_dep(name = "googletest", version = "1.14.0", dev_dependency = True)

View File

@ -95,7 +95,7 @@ your ``WORKSPACE`` file:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive( http_archive(
name = "com_github_gflags_gflags", name = "gflags",
sha256 = "34af2f15cf7367513b352bdcd2493ab14ce43692d2dcd9dfc499492966c64dcf", sha256 = "34af2f15cf7367513b352bdcd2493ab14ce43692d2dcd9dfc499492966c64dcf",
strip_prefix = "gflags-2.2.2", strip_prefix = "gflags-2.2.2",
urls = ["https://github.com/gflags/gflags/archive/v2.2.2.tar.gz"], urls = ["https://github.com/gflags/gflags/archive/v2.2.2.tar.gz"],

View File

@ -1,18 +0,0 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "com_github_gflags_gflags",
sha256 = "34af2f15cf7367513b352bdcd2493ab14ce43692d2dcd9dfc499492966c64dcf",
strip_prefix = "gflags-2.2.2",
urls = [
"https://mirror.bazel.build/github.com/gflags/gflags/archive/v2.2.2.tar.gz",
"https://github.com/gflags/gflags/archive/v2.2.2.tar.gz",
],
)
http_archive(
name = "com_github_google_googletest",
sha256 = "258f33ab1a8ee17adf48ec65e821d0ea9eafcbedeff6110f9eaed78472e73dde",
strip_prefix = "googletest-15460959cbbfa20e66ef0b5ab497367e47fc0a04",
urls = ["https://github.com/google/googletest/archive/15460959cbbfa20e66ef0b5ab497367e47fc0a04.tar.gz"],
)

1
WORKSPACE.bazel Normal file
View File

@ -0,0 +1 @@
# WORKSPACE marker file needed by Bazel

View File

@ -4,6 +4,6 @@ cc_test(
srcs = ["main.cc"], srcs = ["main.cc"],
deps = [ deps = [
"//:glog", "//:glog",
"@com_github_gflags_gflags//:gflags", "@gflags//:gflags",
], ],
) )

View File

@ -126,7 +126,7 @@ def glog_library(with_gflags = 1, **kwargs):
"src/windows/port.h", "src/windows/port.h",
] ]
gflags_deps = ["@com_github_gflags_gflags//:gflags"] if with_gflags else [] gflags_deps = ["@gflags//:gflags"] if with_gflags else []
final_lib_defines = select({ final_lib_defines = select({
# GLOG_EXPORT is normally set by export.h, but that's not # GLOG_EXPORT is normally set by export.h, but that's not
@ -259,7 +259,7 @@ def glog_library(with_gflags = 1, **kwargs):
copts = final_lib_copts + test_only_copts, copts = final_lib_copts + test_only_copts,
deps = gflags_deps + [ deps = gflags_deps + [
":glog", ":glog",
"@com_github_google_googletest//:gtest", "@googletest//:gtest",
], ],
**kwargs **kwargs
) )