Skip to content

Commit

Permalink
Merge pull request #30 from mmorel-35/bzlmod
Browse files Browse the repository at this point in the history
chore(bazel): add MODULE.bazel files for bzlmod
  • Loading branch information
Lynskylate authored Jun 4, 2024
2 parents d5d1202 + 0664e59 commit 05e2938
Show file tree
Hide file tree
Showing 12 changed files with 80 additions and 27 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
15 changes: 0 additions & 15 deletions BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
load("@hedron_compile_commands//:refresh_compile_commands.bzl", "refresh_compile_commands")

licenses(["notice"]) # Apache 2.0

package(default_visibility = ["//visibility:public"])
Expand All @@ -17,16 +15,3 @@ config_setting(
"cpu": "x64_windows",
},
)

refresh_compile_commands(
name = "refresh_compile_commands",

# Specify the targets of interest.
# For example, specify a dict of targets and any flags required to build.
targets = {
"//common/...": "",
"//example/...": "",
"//hessian2/...": "",
"//test_hessian/...": "",
},
)
39 changes: 39 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
module(
name = "hessian2-codec",
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 = "fmt",
version = "8.1.1",
repo_name = "com_github_fmtlib_fmt",
)
bazel_dep(
name = "googletest",
version = "1.11.0",
repo_name = "com_google_googletest",
)
bazel_dep(
name = "hedron_compile_commands",
dev_dependency = True,
)
bazel_dep(
name = "platforms",
version = "0.0.8",
)
# -- bazel_dep definitions -- #

git_override(
module_name = "hedron_compile_commands",
commit = "5bcb0bd8a917b2b48fb5dc55818515f4be3b63ff",
remote = "https://github.com/hedronvision/bazel-compile-commands-extractor.git",
)
Empty file added WORKSPACE.bzlmod
Empty file.
2 changes: 1 addition & 1 deletion common/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ cc_library(
],
copts = DEFAULT_COPTS,
deps = [
"@com_github_fmtlib_fmt//:fmtlib",
"@com_github_fmtlib_fmt//:fmt",
"@com_google_absl//absl/strings",
],
)
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
20 changes: 20 additions & 0 deletions demo/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module(
name = "com_alibaba_hessian2_codec_demo",
)

bazel_dep(
name = "hessian2-codec",
version = "",
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
14 changes: 14 additions & 0 deletions tools/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
load("@hedron_compile_commands//:refresh_compile_commands.bzl", "refresh_compile_commands")

refresh_compile_commands(
name = "refresh_compile_commands",

# Specify the targets of interest.
# For example, specify a dict of targets and any flags required to build.
targets = {
"//common/...": "",
"//example/...": "",
"//hessian2/...": "",
"//test_hessian/...": "",
},
)

0 comments on commit 05e2938

Please sign in to comment.