diff --git a/.bazelrc b/.bazelrc index 63bcd97..b37e04e 100644 --- a/.bazelrc +++ b/.bazelrc @@ -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 \ No newline at end of file diff --git a/.bazelversion b/.bazelversion index 0c89fc9..f4965a3 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -4.0.0 \ No newline at end of file +6.0.0 \ No newline at end of file diff --git a/.gitignore b/.gitignore index 4f6c836..31d4872 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,5 @@ coverage_report/ /compile_commands.json # Ignore the directory in which `clangd` stores its local index. /.cache/ + +MODULE.bazel.lock diff --git a/MODULE.bazel b/MODULE.bazel new file mode 100644 index 0000000..cb6918f --- /dev/null +++ b/MODULE.bazel @@ -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", +) diff --git a/WORKSPACE.bzlmod b/WORKSPACE.bzlmod new file mode 100644 index 0000000..e69de29 diff --git a/demo/BUILD b/demo/BUILD index 899d3fa..3abbd57 100644 --- a/demo/BUILD +++ b/demo/BUILD @@ -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"]) diff --git a/demo/MODULE.bazel b/demo/MODULE.bazel new file mode 100644 index 0000000..2bf40ea --- /dev/null +++ b/demo/MODULE.bazel @@ -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 = "..", +) diff --git a/demo/WORKSPACE.bzlmod b/demo/WORKSPACE.bzlmod new file mode 100644 index 0000000..e69de29 diff --git a/example/BUILD b/example/BUILD index 0dbd652..a9f7bdd 100644 --- a/example/BUILD +++ b/example/BUILD @@ -1,4 +1,4 @@ -load("//:copts.bzl", "DEFAULT_COPTS", "TEST_COPTS") +load("//:copts.bzl", "DEFAULT_COPTS") package(default_visibility = ["//visibility:public"]) diff --git a/extensions.bzl b/extensions.bzl new file mode 100644 index 0000000..4e2cffc --- /dev/null +++ b/extensions.bzl @@ -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, +) diff --git a/hessian2/basic_codec/BUILD b/hessian2/basic_codec/BUILD index 65587d7..3eec077 100644 --- a/hessian2/basic_codec/BUILD +++ b/hessian2/basic_codec/BUILD @@ -24,7 +24,7 @@ cc_test( ":bool_codec_lib", "//hessian2/test_framework:decoder_test_framework_lib", "//hessian2/test_framework:encoder_test_framework_lib", - "@com_google_googletest//:gtest_main", + "@com_google_googletest//:gtest", ], ) @@ -50,7 +50,7 @@ cc_test( ":byte_codec_lib", "//hessian2/test_framework:decoder_test_framework_lib", "//hessian2/test_framework:encoder_test_framework_lib", - "@com_google_googletest//:gtest_main", + "@com_google_googletest//:gtest", ], ) @@ -76,7 +76,7 @@ cc_test( ":date_codec_lib", "//hessian2/test_framework:decoder_test_framework_lib", "//hessian2/test_framework:encoder_test_framework_lib", - "@com_google_googletest//:gtest_main", + "@com_google_googletest//:gtest", ], ) @@ -102,7 +102,7 @@ cc_test( ":number_codec_lib", "//hessian2/test_framework:decoder_test_framework_lib", "//hessian2/test_framework:encoder_test_framework_lib", - "@com_google_googletest//:gtest_main", + "@com_google_googletest//:gtest", ], ) @@ -128,7 +128,7 @@ cc_test( ":string_codec_lib", "//hessian2/test_framework:decoder_test_framework_lib", "//hessian2/test_framework:encoder_test_framework_lib", - "@com_google_googletest//:gtest_main", + "@com_google_googletest//:gtest", ], ) @@ -168,7 +168,7 @@ cc_test( copts = TEST_COPTS, deps = [ ":type_ref_lib", - "@com_google_googletest//:gtest_main", + "@com_google_googletest//:gtest", ], ) @@ -194,7 +194,7 @@ cc_test( copts = TEST_COPTS, deps = [ ":def_ref_codec_lib", - "@com_google_googletest//:gtest_main", + "@com_google_googletest//:gtest", ], ) @@ -250,7 +250,7 @@ cc_test( copts = TEST_COPTS, deps = [ ":object_codec_lib", - "@com_google_googletest//:gtest_main", + "@com_google_googletest//:gtest", ], ) @@ -265,7 +265,7 @@ cc_test( "//hessian2:object_lib", "//hessian2/test_framework:decoder_test_framework_lib", "//hessian2/test_framework:encoder_test_framework_lib", - "@com_google_googletest//:gtest_main", + "@com_google_googletest//:gtest", ], ) @@ -280,7 +280,7 @@ cc_test( "//hessian2:object_lib", "//hessian2/test_framework:decoder_test_framework_lib", "//hessian2/test_framework:encoder_test_framework_lib", - "@com_google_googletest//:gtest_main", + "@com_google_googletest//:gtest", ], ) @@ -295,6 +295,6 @@ cc_test( "//hessian2:object_lib", "//hessian2/test_framework:decoder_test_framework_lib", "//hessian2/test_framework:encoder_test_framework_lib", - "@com_google_googletest//:gtest_main", + "@com_google_googletest//:gtest", ], )