From 09d30d36f46135554aa0c9666bc28e336cd8c74c Mon Sep 17 00:00:00 2001 From: Matthieu MOREL Date: Sat, 13 Apr 2024 11:01:40 +0200 Subject: [PATCH] chore(bazel): add MODULE.bazel files for bzlmod Signed-off-by: Matthieu MOREL --- .bazelrc | 2 ++ .gitignore | 1 + BUILD.bazel | 15 ++++++++------- MODULE.bazel | 23 +++++++++++++++++++++++ WORKSPACE.bzlmod | 0 5 files changed, 34 insertions(+), 7 deletions(-) create mode 100644 MODULE.bazel create mode 100644 WORKSPACE.bzlmod diff --git a/.bazelrc b/.bazelrc index 3843446..673b332 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,2 +1,4 @@ # googletest requires C++14 or above build --cxxopt='-std=c++17' +# Enable Bzlmod for every Bazel command +common --enable_bzlmod diff --git a/.gitignore b/.gitignore index 826af25..0c8cf0e 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ # Build directory. build/ /bazel-* +MODULE.bazel.lock out/ diff --git a/BUILD.bazel b/BUILD.bazel index 97c9f3a..04d16b7 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -40,7 +40,7 @@ config_setting( cc_library( name = "config", hdrs = ["config.h"], - defines = ["HAVE_CONFIG_H"] + defines = ["HAVE_CONFIG_H"], ) cc_library( @@ -70,10 +70,11 @@ cc_library( "snappy-sinksource.h", ], copts = select({ - ":windows": [], - "//conditions:default": [ - "-Wno-sign-compare", - ]}), + ":windows": [], + "//conditions:default": [ + "-Wno-sign-compare", + ], + }), deps = [ ":config", ":snappy-stubs-internal", @@ -114,7 +115,7 @@ cc_test( deps = [ ":snappy", ":snappy-test", - "//third_party/benchmark:benchmark_main", + "@com_google_benchmark//:benchmark_main", ], ) @@ -127,7 +128,7 @@ cc_test( deps = [ ":snappy", ":snappy-test", - "//third_party/googletest:gtest_main", + "@com_google_googletest//:gtest_main", ], ) diff --git a/MODULE.bazel b/MODULE.bazel new file mode 100644 index 0000000..4dd3d57 --- /dev/null +++ b/MODULE.bazel @@ -0,0 +1,23 @@ +module( + name = "snappy", + version = "1.2.0", + compatibility_level = 1, +) + +bazel_dep( + name = "googletest", + version = "1.14.0.bcr.1", + dev_dependency = True, + repo_name = "com_google_googletest", +) +bazel_dep( + name = "google_benchmark", + version = "1.8.3", + dev_dependency = True, + repo_name = "com_google_benchmark", +) + +bazel_dep( + name = "platforms", + version = "0.0.9", +) diff --git a/WORKSPACE.bzlmod b/WORKSPACE.bzlmod new file mode 100644 index 0000000..e69de29