Skip to content

Commit

Permalink
chore(bazel): add MODULE.bazel files for bzlmod
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu MOREL <[email protected]>
  • Loading branch information
mmorel-35 committed Mar 13, 2024
1 parent d5d1202 commit 577018a
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,5 @@ build:coverage --strategy=CoverageReport=local
build:coverage --experimental_use_llvm_covmap
build:coverage --collect_code_coverage
build:coverage --test_tag_filters=-nocoverage

common --enable_bzlmod
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0.0
6.0.0
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ coverage_report/
/compile_commands.json
# Ignore the directory in which `clangd` stores its local index.
/.cache/

MODULE.bazel.lock
32 changes: 32 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module(
name = "hessian2-codec",
version = "0.0.0",
repo_name = "com_alibaba_hessian2_codec",
)

bazel_dep(
name = "bazel_skylib",
version = "1.4.1",
)
bazel_dep(
name = "abseil-cpp",
version = "20220623.1",
repo_name = "com_google_absl",
)
bazel_dep(
name = "googletest",
version = "1.11.0",
repo_name = "com_google_googletest",
)
bazel_dep(
name = "platforms",
version = "0.0.8",
)
# -- bazel_dep definitions -- #

non_module_dependencies = use_extension("//:extensions.bzl", "non_module_dependencies")
use_repo(
non_module_dependencies,
"com_github_fmtlib_fmt",
"hedron_compile_commands",
)
Empty file added WORKSPACE.bzlmod
Empty file.
9 changes: 0 additions & 9 deletions demo/BUILD
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
load(
"@com_google_absl//absl:copts/GENERATED_copts.bzl",
"ABSL_GCC_EXCEPTIONS_FLAGS",
"ABSL_GCC_FLAGS",
"ABSL_GCC_TEST_FLAGS",
"ABSL_LLVM_EXCEPTIONS_FLAGS",
"ABSL_LLVM_FLAGS",
"ABSL_LLVM_TEST_FLAGS",
"ABSL_MSVC_EXCEPTIONS_FLAGS",
"ABSL_MSVC_FLAGS",
"ABSL_MSVC_LINKOPTS",
"ABSL_MSVC_TEST_FLAGS",
)

package(default_visibility = ["//visibility:public"])
Expand Down
21 changes: 21 additions & 0 deletions demo/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module(
name = "com_alibaba_hessian2_codec_demo",
version = "0.0.0",
)

bazel_dep(
name = "hessian2-codec",
version = "0.0.0",
repo_name = "com_alibaba_hessian2_codec",
)
bazel_dep(
name = "abseil-cpp",
version = "20220623.1",
repo_name = "com_google_absl",
)
# -- bazel_dep definitions -- #

local_path_override(
module_name = "hessian2-codec",
path = "..",
)
Empty file added demo/WORKSPACE.bzlmod
Empty file.
2 changes: 1 addition & 1 deletion example/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//:copts.bzl", "DEFAULT_COPTS", "TEST_COPTS")
load("//:copts.bzl", "DEFAULT_COPTS")

package(default_visibility = ["//visibility:public"])

Expand Down
8 changes: 8 additions & 0 deletions extensions.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
load("//bazel:third_party_repositories.bzl", "load_third_party_repositories")

def _non_module_dependencies_impl(_ctx):
load_third_party_repositories()

non_module_dependencies = module_extension(
implementation = _non_module_dependencies_impl,
)

0 comments on commit 577018a

Please sign in to comment.