diff --git a/.bazelrc.absl b/.bazelrc.absl index 3fd91881..ca0b0c97 100644 --- a/.bazelrc.absl +++ b/.bazelrc.absl @@ -7,9 +7,12 @@ # This bazelrc defines the `DD_USE_ABSEIL_FOR_ENVOY` preprocessor macro, and so # the resulting library will use `absl::string_view` and `absl::optional` # instead of their standard (`std`) equivalents. +# +# Additionally, we configure Abseil to not use std library types by setting +# the appropriate ABSL_OPTION_* macros, replacing the need for patching. build --enable_platform_specific_config -build:linux --cxxopt='-std=c++17' --cxxopt='-Wall' --cxxopt='-Wextra' --cxxopt='-pedantic' --cxxopt='-DDD_USE_ABSEIL_FOR_ENVOY' -build:macos --cxxopt='-std=c++17' --cxxopt='-Wall' --cxxopt='-Wextra' --cxxopt='-pedantic' --cxxopt='-DDD_USE_ABSEIL_FOR_ENVOY' -build:windows --cxxopt='/std:c++17' --cxxopt='/DDD_USE_ABSEIL_FOR_ENVOY' --linkopt='ws2_32.lib' +build:linux --cxxopt='-std=c++17' --cxxopt='-Wall' --cxxopt='-Wextra' --cxxopt='-pedantic' --cxxopt='-DDD_USE_ABSEIL_FOR_ENVOY' --cxxopt='-DABSL_OPTION_USE_STD_OPTIONAL=0' --cxxopt='-DABSL_OPTION_USE_STD_STRING_VIEW=0' --cxxopt='-DABSL_OPTION_USE_STD_VARIANT=0' +build:macos --cxxopt='-std=c++17' --cxxopt='-Wall' --cxxopt='-Wextra' --cxxopt='-pedantic' --cxxopt='-DDD_USE_ABSEIL_FOR_ENVOY' --cxxopt='-DABSL_OPTION_USE_STD_OPTIONAL=0' --cxxopt='-DABSL_OPTION_USE_STD_STRING_VIEW=0' --cxxopt='-DABSL_OPTION_USE_STD_VARIANT=0' +build:windows --cxxopt='/std:c++17' --cxxopt='/DDD_USE_ABSEIL_FOR_ENVOY' --cxxopt='/DABSL_OPTION_USE_STD_OPTIONAL=0' --cxxopt='/DABSL_OPTION_USE_STD_STRING_VIEW=0' --cxxopt='/DABSL_OPTION_USE_STD_VARIANT=0' --linkopt='ws2_32.lib' diff --git a/.gitignore b/.gitignore index f439dfd9..b67dd7c3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ /bazel-* /.build/ /.coverage/ +build/ dist/ out/ diff --git a/MODULE.bazel b/MODULE.bazel index ebdca538..809aa0b9 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -11,10 +11,8 @@ bazel_dep( name = "rules_cc", version = "0.0.9", ) -# -- bazel_dep definitions -- # - -non_module_dependencies = use_extension("//:extensions.bzl", "non_module_dependencies") -use_repo( - non_module_dependencies, - "com_google_absl", +bazel_dep( + name = "abseil-cpp", + version = "20230125.1", + repo_name = "com_google_absl", ) diff --git a/WORKSPACE b/WORKSPACE index 76b434ca..c14e2091 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -19,8 +19,6 @@ http_archive( urls = ["https://github.com/abseil/abseil-cpp/archive/98eb410c93ad059f9bba1bf43f5bb916fc92a5ea.zip"], sha256 = "aabf6c57e3834f8dc3873a927f37eaf69975d4b28117fc7427dfb1c661542a87", strip_prefix = "abseil-cpp-98eb410c93ad059f9bba1bf43f5bb916fc92a5ea", - patches = ["//:abseil.patch"], - patch_args = ["-p1"], ) http_archive( diff --git a/abseil.patch b/abseil.patch deleted file mode 100644 index 27deda37..00000000 --- a/abseil.patch +++ /dev/null @@ -1,31 +0,0 @@ -diff --git a/absl/base/options.h b/absl/base/options.h -index 6868c77b..e544fe6c 100644 ---- a/absl/base/options.h -+++ b/absl/base/options.h -@@ -135,7 +135,7 @@ - // absl::optional is a typedef of std::optional, use the feature macro - // ABSL_USES_STD_OPTIONAL. - --#define ABSL_OPTION_USE_STD_OPTIONAL 2 -+#define ABSL_OPTION_USE_STD_OPTIONAL 0 - - - // ABSL_OPTION_USE_STD_STRING_VIEW -@@ -162,7 +162,7 @@ - // absl::string_view is a typedef of std::string_view, use the feature macro - // ABSL_USES_STD_STRING_VIEW. - --#define ABSL_OPTION_USE_STD_STRING_VIEW 2 -+#define ABSL_OPTION_USE_STD_STRING_VIEW 0 - - // ABSL_OPTION_USE_STD_VARIANT - // -@@ -188,7 +188,7 @@ - // absl::variant is a typedef of std::variant, use the feature macro - // ABSL_USES_STD_VARIANT. - --#define ABSL_OPTION_USE_STD_VARIANT 2 -+#define ABSL_OPTION_USE_STD_VARIANT 0 - - - // ABSL_OPTION_USE_INLINE_NAMESPACE diff --git a/extensions.bzl b/extensions.bzl deleted file mode 100644 index c566b0d9..00000000 --- a/extensions.bzl +++ /dev/null @@ -1,15 +0,0 @@ -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -def _non_module_dependencies_impl(_ctx): - http_archive( - name = "com_google_absl", - patch_args = ["-p1"], - patches = ["//:abseil.patch"], - sha256 = "aabf6c57e3834f8dc3873a927f37eaf69975d4b28117fc7427dfb1c661542a87", - strip_prefix = "abseil-cpp-98eb410c93ad059f9bba1bf43f5bb916fc92a5ea", - urls = ["https://github.com/abseil/abseil-cpp/archive/98eb410c93ad059f9bba1bf43f5bb916fc92a5ea.zip"], - ) - -non_module_dependencies = module_extension( - implementation = _non_module_dependencies_impl, -)