Skip to content

Commit

Permalink
feat(pull): Add SSL support to Bazel build
Browse files Browse the repository at this point in the history
Issue: #592
  • Loading branch information
gjasny committed Jun 3, 2022
1 parent 1181640 commit d7b335a
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 18 deletions.
2 changes: 2 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ build:asan --copt -fno-omit-frame-pointer
build:asan --copt -g
build:asan --linkopt -fsanitize=address
build:asan --cc_output_directory_tag=asan

build:ssl --define=with_civetweb_ssl=true
8 changes: 7 additions & 1 deletion .github/workflows/bazel-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,17 @@ jobs:
if: runner.os == 'macOS'
run: brew install telegraf

- name: Build with SSL
run: bazel build --config=ssl ${{ matrix.bazel_args }} //...

- name: Test with SSL
run: bazel test --config=ssl ${{ matrix.bazel_args }} --test_output=all //...

- name: Build
run: bazel build ${{ matrix.bazel_args }} //...

- name: Test
run: bazel test ${{ matrix.bazel_args }} --test_output=all //core/... //pull/...
run: bazel test ${{ matrix.bazel_args }} --test_output=all //...

- name: Scraping Test
if: runner.os != 'Windows'
Expand Down
53 changes: 36 additions & 17 deletions bazel/civetweb.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,39 @@ config_setting(
],
)

config_setting(
name = "with_ssl",
define_values = {
"with_civetweb_ssl": "true",
},
visibility = ["//visibility:public"],
)

COPTS = [
"-DUSE_IPV6",
"-DNDEBUG",
"-DNO_CGI",
"-DNO_CACHING",
"-DNO_FILES",
"-UDEBUG",
] + select({
":with_ssl": [
"-DOPENSSL_API_1_1",
"-DNO_SSL_DL",
],
"@//conditions:default": [
"-DNO_SSL",
],
})

DEPS = select({
":with_ssl": [
"@boringssl//:crypto",
"@boringssl//:ssl",
],
"@//conditions:default": [],
})

cc_library(
name = "libcivetweb",
srcs = [
Expand All @@ -23,15 +56,7 @@ cc_library(
hdrs = [
"include/civetweb.h",
],
copts = [
"-DUSE_IPV6",
"-DNDEBUG",
"-DNO_CGI",
"-DNO_CACHING",
"-DNO_SSL",
"-DNO_FILES",
"-UDEBUG",
],
copts = COPTS,
includes = [
"include",
],
Expand All @@ -48,6 +73,7 @@ cc_library(
"src/handle_form.inl",
],
visibility = ["//visibility:public"],
deps = DEPS,
)

cc_library(
Expand All @@ -58,14 +84,7 @@ cc_library(
hdrs = [
"include/CivetServer.h",
],
copts = [
"-DUSE_IPV6",
"-DNDEBUG",
"-DNO_CGI",
"-DNO_CACHING",
"-DNO_SSL",
"-DNO_FILES",
],
copts = COPTS,
includes = [
"include",
],
Expand Down
13 changes: 13 additions & 0 deletions bazel/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,16 @@ def prometheus_cpp_repositories():
],
build_file = "@com_github_jupp0r_prometheus_cpp//bazel:zlib.BUILD",
)

maybe(
http_archive,
name = "boringssl",
# Use github mirror instead of https://boringssl.googlesource.com/boringssl
# to obtain a boringssl archive with consistent sha256
sha256 = "534fa658bd845fd974b50b10f444d392dfd0d93768c4a51b61263fd37d851c40",
strip_prefix = "boringssl-b9232f9e27e5668bc0414879dcdedb2a59ea75f2",
urls = [
"https://storage.googleapis.com/grpc-bazel-mirror/github.com/google/boringssl/archive/b9232f9e27e5668bc0414879dcdedb2a59ea75f2.tar.gz",
"https://github.com/google/boringssl/archive/b9232f9e27e5668bc0414879dcdedb2a59ea75f2.tar.gz",
],
)

0 comments on commit d7b335a

Please sign in to comment.