Skip to content

Commit bb017ec

Browse files
authored
pull: Use internal base64 decoding function to avoid dependency (#417)
1 parent 27c3d67 commit bb017ec

File tree

16 files changed

+187
-60
lines changed

16 files changed

+187
-60
lines changed

.github/scripts/run-prepare

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ esac
3434

3535
case "${BUILDSYSTEM_ARG}" in
3636
cmake)
37-
"${VCPKG_INSTALLATION_ROOT}/vcpkg" install benchmark civetweb cppcodec curl gtest zlib
37+
"${VCPKG_INSTALLATION_ROOT}/vcpkg" install benchmark civetweb curl gtest zlib
3838
;;
3939
esac

.github/scripts/run-prepare.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
if [%1] == [cmake] (
2-
%VCPKG_INSTALLATION_ROOT%/vcpkg install benchmark civetweb cppcodec curl gtest zlib || EXIT /B 1
2+
%VCPKG_INSTALLATION_ROOT%/vcpkg install benchmark civetweb curl gtest zlib || EXIT /B 1
33
)
44

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,3 @@
44
[submodule "civetweb"]
55
path = 3rdparty/civetweb
66
url = https://github.com/civetweb/civetweb.git
7-
[submodule "3rdparty/cppcodec"]
8-
path = 3rdparty/cppcodec
9-
url = https://github.com/tplgy/cppcodec.git

3rdparty/cppcodec

Lines changed: 0 additions & 1 deletion
This file was deleted.

bazel/cppcodec.BUILD

Lines changed: 0 additions & 6 deletions
This file was deleted.

bazel/repositories.bzl

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,6 @@ def prometheus_cpp_repositories():
4545
],
4646
)
4747

48-
maybe(
49-
http_archive,
50-
name = "com_github_tplgy_cppcodec",
51-
sha256 = "0edaea2a9d9709d456aa99a1c3e17812ed130f9ef2b5c2d152c230a5cbc5c482",
52-
strip_prefix = "cppcodec-0.2",
53-
urls = [
54-
"https://github.com/tplgy/cppcodec/archive/v0.2.tar.gz",
55-
],
56-
build_file = "@com_github_jupp0r_prometheus_cpp//bazel:cppcodec.BUILD",
57-
)
58-
5948
maybe(
6049
http_archive,
6150
name = "net_zlib_zlib",

cmake/Findcppcodec.cmake

Lines changed: 0 additions & 8 deletions
This file was deleted.

cmake/cppcodec-3rdparty-config.cmake

Lines changed: 0 additions & 14 deletions
This file was deleted.

pull/BUILD.bazel

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,18 @@ cc_library(
2323
deps = [
2424
"//core",
2525
"@civetweb",
26-
"@com_github_tplgy_cppcodec//:cppcodec",
2726
"@net_zlib_zlib//:z",
2827
],
2928
)
29+
30+
cc_library(
31+
name = "pull_internal_headers",
32+
hdrs = glob(
33+
["src/detail/*.h"],
34+
),
35+
strip_include_prefix = "src",
36+
visibility = ["//pull/tests:__subpackages__"],
37+
deps = [
38+
"//core",
39+
],
40+
)

pull/CMakeLists.txt

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,8 @@ if(USE_THIRDPARTY_LIBRARIES)
55
TARGETS civetweb
66
EXPORT ${PROJECT_NAME}-targets
77
)
8-
find_package(cppcodec-3rdparty CONFIG REQUIRED)
9-
add_library(${PROJECT_NAME}::cppcodec ALIAS cppcodec)
10-
install(
11-
TARGETS cppcodec
12-
EXPORT ${PROJECT_NAME}-targets
13-
)
148
else()
159
find_package(civetweb CONFIG REQUIRED)
16-
find_package(cppcodec REQUIRED)
1710

1811
# work-around https://github.com/civetweb/civetweb/pull/918
1912
if(WIN32 AND NOT TARGET WINSOCK::WINSOCK)
@@ -36,6 +29,8 @@ add_library(pull
3629
src/handler.h
3730
src/metrics_collector.cc
3831
src/metrics_collector.h
32+
33+
src/detail/base64.h
3934
)
4035

4136
add_library(${PROJECT_NAME}::pull ALIAS pull)
@@ -46,7 +41,6 @@ target_link_libraries(pull
4641
PRIVATE
4742
Threads::Threads
4843
$<IF:$<BOOL:${USE_THIRDPARTY_LIBRARIES}>,${PROJECT_NAME}::civetweb,civetweb::civetweb-cpp>
49-
$<$<BOOL:${USE_THIRDPARTY_LIBRARIES}>:${PROJECT_NAME}::cppcodec>
5044
$<$<AND:$<BOOL:UNIX>,$<NOT:$<BOOL:APPLE>>>:rt>
5145
$<$<BOOL:${ENABLE_COMPRESSION}>:ZLIB::ZLIB>
5246
)
@@ -56,7 +50,6 @@ target_include_directories(pull
5650
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
5751
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
5852
PRIVATE
59-
${CPPCODEC_INCLUDE_DIRS} # needed as long as upstream cppcodec installs no config file with imported target
6053
${CIVETWEB_INCLUDE_DIRS}
6154
)
6255

@@ -93,5 +86,9 @@ install(
9386
)
9487

9588
if(ENABLE_TESTING)
89+
add_library(pull_internal_headers INTERFACE)
90+
add_library(${PROJECT_NAME}::pull_internal_headers ALIAS pull_internal_headers)
91+
target_include_directories(pull_internal_headers INTERFACE src)
92+
9693
add_subdirectory(tests)
9794
endif()

0 commit comments

Comments
 (0)