From 37ce34cd49d6d864a08ec3036fc5644afb1ce248 Mon Sep 17 00:00:00 2001 From: Matthew Young Date: Fri, 12 Jan 2024 16:39:52 -0800 Subject: [PATCH 1/4] Removing references to OpenSSL because OpenSSL references break `bazel query` for targets that rely on `boost.asio` due to the fact that OpenSSL is not in BCR yet. --- BUILD.bazel | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index f585cc2ac3..61dec16428 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -5,12 +5,11 @@ load("@bazel_skylib//rules:write_file.bzl", "write_file") string_flag( name = "ssl", visibility = ["//visibility:public"], - values = ["no_ssl", "openssl", "boringssl"], + values = ["no_ssl", "boringssl"], # OpenSSL not in BCR yet. build_setting_default = "no_ssl", ) config_setting(name = "no_ssl", flag_values = {":ssl": "no_ssl"}) -config_setting(name = "openssl", flag_values = {":ssl": "openssl"}) config_setting(name = "boringssl", flag_values = {":ssl": "boringssl"}) write_file( @@ -78,7 +77,6 @@ cc_library( "@boost.type_traits", "@boost.utility", ] + select({ - ":openssl": ["@openssl//:ssl"], ":boringssl": ["@boringssl//:ssl"], ":no_ssl": [], }), From 305b154ed6962b1e43aa42bae08a80c97063da04 Mon Sep 17 00:00:00 2001 From: Ezekiel Warren Date: Mon, 9 Dec 2024 16:46:12 -0800 Subject: [PATCH 2/4] feat: support openssl from bcr --- .bazelversion | 1 + .github/workflows/bazel.yml | 2 ++ BUILD.bazel | 68 ++++++++++++++++++++++++------------- MODULE.bazel | 1 + test/.bazelversion | 1 + 5 files changed, 49 insertions(+), 24 deletions(-) create mode 100644 .bazelversion create mode 100644 test/.bazelversion diff --git a/.bazelversion b/.bazelversion new file mode 100644 index 0000000000..815da58b7a --- /dev/null +++ b/.bazelversion @@ -0,0 +1 @@ +7.4.1 diff --git a/.github/workflows/bazel.yml b/.github/workflows/bazel.yml index 1049b50444..4d68093c54 100644 --- a/.github/workflows/bazel.yml +++ b/.github/workflows/bazel.yml @@ -17,3 +17,5 @@ jobs: working-directory: test - run: bazelisk test ... --@boost.asio//:ssl=boringssl working-directory: test + - run: bazelisk test ... --@boost.asio//:ssl=openssl + working-directory: test diff --git a/BUILD.bazel b/BUILD.bazel index 61dec16428..d1bef22035 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,16 +1,32 @@ -load("@rules_cc//cc:defs.bzl", "cc_library") load("@bazel_skylib//rules:common_settings.bzl", "string_flag") load("@bazel_skylib//rules:write_file.bzl", "write_file") +load("@rules_cc//cc:defs.bzl", "cc_library") string_flag( name = "ssl", - visibility = ["//visibility:public"], - values = ["no_ssl", "boringssl"], # OpenSSL not in BCR yet. build_setting_default = "no_ssl", + values = [ + "no_ssl", + "boringssl", + "openssl", + ], + visibility = ["//visibility:public"], ) -config_setting(name = "no_ssl", flag_values = {":ssl": "no_ssl"}) -config_setting(name = "boringssl", flag_values = {":ssl": "boringssl"}) +config_setting( + name = "no_ssl", + flag_values = {":ssl": "no_ssl"}, +) + +config_setting( + name = "boringssl", + flag_values = {":ssl": "boringssl"}, +) + +config_setting( + name = "openssl", + flag_values = {":ssl": "openssl"}, +) write_file( name = "src", @@ -28,25 +44,6 @@ write_file( cc_library( name = "boost.asio", - visibility = ["//visibility:public"], - defines = ["BOOST_ASIO_SEPARATE_COMPILATION"], - linkopts = select({ - "@platforms//os:windows": [ - "-DEFAULTLIB:ws2_32", - "-DEFAULTLIB:mswsock", - ], - "//conditions:default": [ - "-lpthread", - ], - }), - hdrs = glob([ - "include/**/*.hpp", - "include/**/*.h", - "include/**/*.ipp", - ], exclude = [ - "include/boost/asio/impl/src.hpp", - "include/boost/asio/ssl/impl/src.hpp", - ]), srcs = [":src"] + select({ ":no_ssl": [ "include/boost/asio/impl/src.hpp", @@ -56,7 +53,29 @@ cc_library( "include/boost/asio/ssl/impl/src.hpp", ], }), + hdrs = glob( + [ + "include/**/*.hpp", + "include/**/*.h", + "include/**/*.ipp", + ], + exclude = [ + "include/boost/asio/impl/src.hpp", + "include/boost/asio/ssl/impl/src.hpp", + ], + ), + defines = ["BOOST_ASIO_SEPARATE_COMPILATION"], includes = ["include"], + linkopts = select({ + "@platforms//os:windows": [ + "-DEFAULTLIB:ws2_32", + "-DEFAULTLIB:mswsock", + ], + "//conditions:default": [ + "-lpthread", + ], + }), + visibility = ["//visibility:public"], deps = [ "@boost.align", "@boost.array", @@ -78,6 +97,7 @@ cc_library( "@boost.utility", ] + select({ ":boringssl": ["@boringssl//:ssl"], + ":openssl": ["@openssl//:ssl"], ":no_ssl": [], }), ) diff --git a/MODULE.bazel b/MODULE.bazel index 05e50c172c..0076332996 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -26,3 +26,4 @@ bazel_dep(name = "boost.system", version = "1.83.0.bzl.2") bazel_dep(name = "boost.throw_exception", version = "1.83.0.bzl.1") bazel_dep(name = "boost.type_traits", version = "1.83.0.bzl.1") bazel_dep(name = "boost.utility", version = "1.83.0.bzl.1") +bazel_dep(name = "openssl", version = "3.3.1.bcr.0") diff --git a/test/.bazelversion b/test/.bazelversion new file mode 100644 index 0000000000..815da58b7a --- /dev/null +++ b/test/.bazelversion @@ -0,0 +1 @@ +7.4.1 From ab93e6e9c0d6fc17978d9d684073a5468060ccdc Mon Sep 17 00:00:00 2001 From: Ezekiel Warren Date: Tue, 17 Dec 2024 13:28:36 -0800 Subject: [PATCH 3/4] chore: dont fail fast --- .github/workflows/bazel.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/bazel.yml b/.github/workflows/bazel.yml index 4d68093c54..31cc264b01 100644 --- a/.github/workflows/bazel.yml +++ b/.github/workflows/bazel.yml @@ -5,6 +5,7 @@ on: [pull_request] jobs: test: strategy: + fail-fast: false matrix: os: - ubuntu-latest From f4267038543cabbfada24186451218d02075e294 Mon Sep 17 00:00:00 2001 From: Ezekiel Warren Date: Tue, 17 Dec 2024 15:03:46 -0800 Subject: [PATCH 4/4] chore: update openssl --- MODULE.bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MODULE.bazel b/MODULE.bazel index 0076332996..72c1daf353 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -26,4 +26,4 @@ bazel_dep(name = "boost.system", version = "1.83.0.bzl.2") bazel_dep(name = "boost.throw_exception", version = "1.83.0.bzl.1") bazel_dep(name = "boost.type_traits", version = "1.83.0.bzl.1") bazel_dep(name = "boost.utility", version = "1.83.0.bzl.1") -bazel_dep(name = "openssl", version = "3.3.1.bcr.0") +bazel_dep(name = "openssl", version = "3.3.1.bcr.1")