Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): swap certify dependency to a fork with fixed cmake configu… #449

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost 1.81 REQUIRED COMPONENTS json url coroutine)
message(STATUS "LaunchDarkly: using Boost v${Boost_VERSION}")

include(${CMAKE_FILES}/certify.cmake)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since certify is really a dependency of foxy, moving this into foxy.

add_subdirectory(vendor/foxy)

# Common, internal, and server-sent-events are built as "object" libraries.
Expand Down
23 changes: 0 additions & 23 deletions cmake/certify.cmake

This file was deleted.

8 changes: 0 additions & 8 deletions cmake/launchdarkly-cpp-clientConfig.cmake

This file was deleted.

20 changes: 16 additions & 4 deletions vendor/foxy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ endif ()

find_package(Threads REQUIRED)

set(CMAKE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake)


include(${CMAKE_FILES}/certify.cmake)

add_library(
foxy OBJECT
include/foxy.hpp
Expand Down Expand Up @@ -153,6 +158,13 @@ target_link_libraries(
certify::core
)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original djarek/certify adds CoreFoundation and Security on to the linker explicitly. This fork does not.

if (APPLE)
find_library(COREFOUNDATION_LIBRARY CoreFoundation)
find_library(SECURITY_LIBRARY Security)
target_link_libraries(foxy PRIVATE ${COREFOUNDATION_LIBRARY} ${SECURITY_LIBRARY})
endif ()


add_library(
test_utils

Expand All @@ -167,7 +179,8 @@ option(BUILD_TESTING "Build Foxy Testsuite" OFF)
if (BUILD_TESTING)
include(CTest)

find_package(Catch2 CONFIG REQUIRED)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given I'm swapping out the certify library, I figured it would be good to have foxy's tests enabled. This necessitates grabbing catch2 with FetchContent.

include(${CMAKE_FILES}/catch2.cmake)

find_package(Boost ${foxy_minimum_boost_version} REQUIRED coroutine thread container)

add_executable(
Expand All @@ -179,7 +192,6 @@ if (BUILD_TESTING)
test/export_connect_fields_test.cpp
test/iterator_test.cpp
test/listener_test.cpp
test/main.cpp
test/parse_uri_test.cpp
test/pct_decode_test.cpp
test/pct_encode_test.cpp
Expand All @@ -200,10 +212,11 @@ if (BUILD_TESTING)
foxy_tests
PRIVATE
test_utils
Catch2::Catch2
Catch2::Catch2WithMain
Boost::coroutine
Boost::thread
Boost::container
certify::core
)

file(COPY test/root-cas.pem DESTINATION ${CMAKE_BINARY_DIR})
Expand Down Expand Up @@ -247,4 +260,3 @@ if (FOXY_FUZZ)
target_compile_options(uri-parser PRIVATE "-fsanitize=fuzzer")
target_link_options(uri-parser PRIVATE "-fsanitize=fuzzer")
endif ()

9 changes: 9 additions & 0 deletions vendor/foxy/cmake/catch2.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.11)

FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG fa43b77429ba76c462b1898d6cd2f2d7a9416b14
)

FetchContent_MakeAvailable(Catch2)
28 changes: 28 additions & 0 deletions vendor/foxy/cmake/certify.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
cmake_minimum_required(VERSION 3.11)

include(FetchContent)

if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.24")
# Affects robustness of timestamp checking on FetchContent dependencies.
cmake_policy(SET CMP0135 NEW)
endif ()


FetchContent_Declare(certify
GIT_REPOSITORY https://github.com/jens-diewald/certify.git
GIT_TAG 9185a824e2085b5632be542c0377204a05a4fa40
)

# The tests in certify don't compile.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: add a todo here to see if I can get these compiling.

set(PREVIOUS_BUILD_TESTING ${BUILD_TESTING})
set(BUILD_TESTING OFF)

FetchContent_MakeAvailable(certify)

set(BUILD_TESTING ${PREVIOUS_BUILD_TESTING})

# Override the include directories for certify::core
target_include_directories(core INTERFACE
$<BUILD_INTERFACE:${certify_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
2 changes: 1 addition & 1 deletion vendor/foxy/test/allocator_client_test.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//

Check notice on line 1 in vendor/foxy/test/allocator_client_test.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter

Run clang-format on vendor/foxy/test/allocator_client_test.cpp

File vendor/foxy/test/allocator_client_test.cpp does not conform to Custom style guidelines. (lines 2, 4, 5, 12, 15, 24, 25, 29, 31, 32, 33, 34, 37, 39, 42, 43, 44, 46, 47, 48, 49, 51, 53, 54, 55, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 70, 71, 72, 73, 74, 76, 77, 78, 79, 80, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92, 93, 94, 95, 96, 98, 100, 101, 102, 103, 104, 105, 109, 111, 112, 113, 114, 115, 117, 119, 121, 123, 125, 127, 128, 129, 130, 131, 133, 135, 136, 138, 140, 142, 143, 144)
// Copyright (c) 2018-2019 Christian Mazakas (christian dot mazakas at gmail dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt
Expand All @@ -17,7 +17,7 @@

#include <memory>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new Catch2 has changed their headers around.

#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

#include <iostream>

Expand All @@ -39,7 +39,7 @@
namespace
{
#include <boost/asio/yield.hpp>
struct client_op : asio::coroutine

Check warning on line 42 in vendor/foxy/test/allocator_client_test.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter

/vendor/foxy/test/allocator_client_test.cpp:42:8 [cppcoreguidelines-special-member-functions]

class 'client_op' defines a copy constructor and a move constructor but does not define a destructor, a copy assignment operator or a move assignment operator
{
using allocator_type = pmr::polymorphic_allocator<char>;

Expand All @@ -58,28 +58,28 @@
request_type& request_,
parser_type& parser_,
bool& was_valid_,
allocator_type alloc_)

Check warning on line 61 in vendor/foxy/test/allocator_client_test.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter

/vendor/foxy/test/allocator_client_test.cpp:61:28 [performance-unnecessary-value-param]

the parameter 'alloc_' is copied for each invocation but only used as a const reference; consider making it a const reference
: client(client_)
, request(request_)
, parser(parser_)
, was_valid(was_valid_)
, alloc(std::move(alloc_))

Check warning on line 66 in vendor/foxy/test/allocator_client_test.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter

/vendor/foxy/test/allocator_client_test.cpp:66:13 [performance-move-const-arg]

passing result of std::move() as a const reference argument; no move will actually happen
{
}

auto

Check warning on line 70 in vendor/foxy/test/allocator_client_test.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter

/vendor/foxy/test/allocator_client_test.cpp:70:3 [modernize-use-nodiscard]

function 'get_allocator' should be marked [[nodiscard]]
get_allocator() const noexcept -> allocator_type
{
return alloc;
}

auto
operator()(error_code ec, tcp::endpoint) -> void

Check warning on line 77 in vendor/foxy/test/allocator_client_test.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter

/vendor/foxy/test/allocator_client_test.cpp:77:42 [performance-unnecessary-value-param]

the parameter #2 is copied for each invocation but only used as a const reference; consider making it a const reference

Check warning on line 77 in vendor/foxy/test/allocator_client_test.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter

/vendor/foxy/test/allocator_client_test.cpp:77:42 [readability-named-parameter]

all parameters should be named in a function
{
(*this)(ec);
}

auto operator()(error_code ec = {}) -> void

Check warning on line 82 in vendor/foxy/test/allocator_client_test.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter

/vendor/foxy/test/allocator_client_test.cpp:82:8 [readability-function-cognitive-complexity]

function 'operator()' has cognitive complexity of 190 (threshold 25)
{
reenter(this)
{
Expand All @@ -99,7 +99,7 @@

{
auto& response = parser.get();
was_valid = (response.result_int() == 200 && response.body().size() > 0 &&

Check warning on line 102 in vendor/foxy/test/allocator_client_test.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter

/vendor/foxy/test/allocator_client_test.cpp:102:52 [cppcoreguidelines-avoid-magic-numbers

200 is a magic number; consider replacing it with a named constant

Check warning on line 102 in vendor/foxy/test/allocator_client_test.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter

/vendor/foxy/test/allocator_client_test.cpp:102:59 [readability-container-size-empty]

the 'empty' method should be used to check for emptiness instead of 'size'
boost::string_view(response.body()).ends_with("</html>"));
}
}
Expand All @@ -114,7 +114,7 @@
{
bool was_valid = false;

asio::io_context io(1);

Check warning on line 117 in vendor/foxy/test/allocator_client_test.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter

/vendor/foxy/test/allocator_client_test.cpp:117:22 [readability-identifier-length]

variable name 'io' is too short, expected at least 3 characters

auto const page_size = std::size_t{1024 * 512};

Expand Down
2 changes: 1 addition & 1 deletion vendor/foxy/test/client_session_test.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//

Check notice on line 1 in vendor/foxy/test/client_session_test.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter

Run clang-format on vendor/foxy/test/client_session_test.cpp

File vendor/foxy/test/client_session_test.cpp does not conform to Custom style guidelines. (lines 2, 19, 20, 26, 27, 28, 29, 30, 32, 33, 35, 37, 39, 40, 41, 42, 43, 44, 45, 47, 48, 49, 51, 52, 54, 55, 56, 57, 58, 60, 61, 62, 64, 66, 67, 68, 69, 71, 72, 73, 75, 76, 77, 79, 80, 82, 83, 85, 87, 89, 90, 91, 92, 93, 95, 96)
// Copyright (c) 2018-2019 Christian Mazakas (christian dot mazakas at gmail dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
Expand All @@ -14,7 +14,7 @@

#include <memory>

#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

using boost::system::error_code;
using boost::asio::ip::tcp;
Expand Down
2 changes: 1 addition & 1 deletion vendor/foxy/test/code_point_view_test.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//

Check notice on line 1 in vendor/foxy/test/code_point_view_test.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter

Run clang-format on vendor/foxy/test/code_point_view_test.cpp

File vendor/foxy/test/code_point_view_test.cpp does not conform to Custom style guidelines. (lines 2, 4, 5, 10, 16, 24, 25, 26, 27, 28, 29, 31, 33, 34, 36, 38, 39, 40, 41, 42, 43, 44, 46, 47, 48, 49, 50, 52, 54, 55, 56, 57, 59, 60, 61, 62, 63, 65, 67, 68, 69, 70, 72, 73, 74, 75, 76, 78, 80, 81, 82, 83, 85, 86, 87, 88, 89, 91, 93, 94, 95)
// Copyright (c) 2018-2019 Christian Mazakas (christian dot mazakas at gmail dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt
Expand All @@ -19,7 +19,7 @@
#include <array>
#include <cstring>

#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

TEST_CASE("code_point_view_test")
{
Expand Down
2 changes: 1 addition & 1 deletion vendor/foxy/test/export_connect_fields_test.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//

Check notice on line 1 in vendor/foxy/test/export_connect_fields_test.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter

Run clang-format on vendor/foxy/test/export_connect_fields_test.cpp

File vendor/foxy/test/export_connect_fields_test.cpp does not conform to Custom style guidelines. (lines 22, 25, 26, 27, 28, 29, 31, 32, 34, 35, 37, 38, 40, 41, 42, 44, 45, 46, 48, 50, 51, 53, 55, 56, 57, 59, 61, 62, 63, 64, 65, 67, 68, 70, 71)
// Copyright (c) 2018-2019 Christian Mazakas (christian dot mazakas at gmail dot
// com)
//
Expand All @@ -17,7 +17,7 @@

#include <algorithm>

#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

namespace http = boost::beast::http;
namespace range = boost::range;
Expand Down
2 changes: 1 addition & 1 deletion vendor/foxy/test/iterator_test.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//

Check notice on line 1 in vendor/foxy/test/iterator_test.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter

Run clang-format on vendor/foxy/test/iterator_test.cpp

File vendor/foxy/test/iterator_test.cpp does not conform to Custom style guidelines. (lines 2, 4, 5, 10, 14, 17, 27, 28, 29, 30, 31, 33, 34, 36, 37, 38, 40, 41, 43, 44, 45, 47, 48, 50, 51, 52, 54, 55, 57, 58, 59, 60, 62, 64, 65, 67, 68, 69, 70, 71, 73, 74, 75, 77, 78, 80, 81, 82, 84, 85, 86, 88, 90, 91, 93, 94, 95, 97, 98, 99, 100, 101, 103, 104, 106, 107, 108, 110, 111, 112, 114, 115, 116, 117, 119, 120, 122, 123, 124, 125, 127, 128, 130, 132, 133, 134, 135, 136, 137, 138, 142, 143, 145, 146, 148, 149, 151, 152, 154, 156, 157, 158, 160, 162, 163, 165, 166, 167, 168, 169, 171, 172, 173, 174, 176, 178, 179, 181, 183, 184, 185, 186, 188, 189, 190, 191, 192, 193, 194, 195, 197, 198, 199, 200, 201, 203, 204, 205, 206, 207, 209, 210, 211, 212, 214, 215, 216, 217, 218, 219)
// Copyright (c) 2018-2019 Christian Mazakas (christian dot mazakas at gmail dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt
Expand All @@ -20,7 +20,7 @@
#include <array>
#include <cstring>

#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>

namespace utf = boost::locale::utf;

Expand Down
Loading
Loading