Skip to content

Commit d80cf86

Browse files
feat: Replace outcome with Boost's version of outcome to remove dependence on quickcpplib. (#62)
Co-authored-by: kirkrodrigues <[email protected]>
1 parent 98e1c54 commit d80cf86

File tree

5 files changed

+23
-50
lines changed

5 files changed

+23
-50
lines changed

CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,9 @@ if(BUILD_TESTING AND YSTDLIB_CPP_BUILD_TESTING)
5353
set(YSTDLIB_CPP_ENABLE_TESTS ON)
5454
endif()
5555

56-
find_package(outcome REQUIRED)
57-
if(outcome_FOUND)
58-
message(STATUS "Found outcome.")
59-
else()
60-
message(FATAL_ERROR "Could not find libraries for outcome.")
56+
find_package(Boost REQUIRED)
57+
if(Boost_FOUND)
58+
message(STATUS "Found Boost ${Boost_VERSION}.")
6159
endif()
6260

6361
if(YSTDLIB_CPP_ENABLE_TESTS)

src/.clang-format

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ IncludeCategories:
66
# NOTE: clang-format retains leading white-space on a line in violation of the YAML spec.
77
- Regex: "<(ystdlib)"
88
Priority: 3
9-
- Regex: "<(catch2|outcome)"
9+
- Regex: "<(boost|catch2)"
1010
Priority: 4
1111
# C system headers
1212
- Regex: "^<.+\\.h>"

src/ystdlib/error_handling/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ cpp_library(
77
Result.hpp
88
utils.hpp
99
PUBLIC_LINK_LIBRARIES
10-
outcome::hl
10+
Boost::headers
1111
TESTS_SOURCES
1212
test/constants.hpp
1313
test/test_ErrorCode.cpp

src/ystdlib/error_handling/Result.hpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44
#include <system_error>
55

6-
#include <outcome/config.hpp>
7-
#include <outcome/std_result.hpp>
8-
#include <outcome/success_failure.hpp>
9-
#include <outcome/try.hpp>
6+
#include <boost/outcome/config.hpp>
7+
#include <boost/outcome/std_result.hpp>
8+
#include <boost/outcome/success_failure.hpp>
9+
#include <boost/outcome/try.hpp>
1010

1111
namespace ystdlib::error_handling {
1212
/**
@@ -20,14 +20,14 @@ namespace ystdlib::error_handling {
2020
* @tparam ErrorType The type used to represent errors.
2121
*/
2222
template <typename ReturnType, typename ErrorType = std::error_code>
23-
using Result = OUTCOME_V2_NAMESPACE::std_result<ReturnType, ErrorType>;
23+
using Result = BOOST_OUTCOME_V2_NAMESPACE::std_result<ReturnType, ErrorType>;
2424

2525
/**
2626
* @return A value indicating successful completion of a function that returns a void result (i.e.,
2727
* `Result<void, E>`).
2828
*/
29-
[[nodiscard]] inline auto success() -> OUTCOME_V2_NAMESPACE::success_type<void> {
30-
return OUTCOME_V2_NAMESPACE::success();
29+
[[nodiscard]] inline auto success() -> BOOST_OUTCOME_V2_NAMESPACE::success_type<void> {
30+
return BOOST_OUTCOME_V2_NAMESPACE::success();
3131
}
3232

3333
/**
@@ -43,9 +43,9 @@ using Result = OUTCOME_V2_NAMESPACE::std_result<ReturnType, ErrorType>;
4343
* NOTE: This macro is only supported on GCC and Clang due to reliance on compiler-specific
4444
* extensions.
4545
*/
46-
#ifdef OUTCOME_TRYX
46+
#ifdef BOOST_OUTCOME_TRYX
4747
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
48-
#define YSTDLIB_ERROR_HANDLING_TRYX(expr) OUTCOME_TRYX(expr)
48+
#define YSTDLIB_ERROR_HANDLING_TRYX(expr) BOOST_OUTCOME_TRYX(expr)
4949
#endif
5050

5151
/**
@@ -60,7 +60,7 @@ using Result = OUTCOME_V2_NAMESPACE::std_result<ReturnType, ErrorType>;
6060
* - Otherwise, execution continues normally.
6161
*/
6262
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
63-
#define YSTDLIB_ERROR_HANDLING_TRYV(expr) OUTCOME_TRYV(expr)
63+
#define YSTDLIB_ERROR_HANDLING_TRYV(expr) BOOST_OUTCOME_TRYV(expr)
6464
} // namespace ystdlib::error_handling
6565

6666
#endif // YSTDLIB_ERROR_HANDLING_RESULT_HPP

taskfiles/deps.yaml

Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ version: "3"
33
vars:
44
G_CATCH2_LIB_NAME: "Catch2"
55
G_CATCH2_WORK_DIR: "{{.G_DEPS_DIR}}/{{.G_CATCH2_LIB_NAME}}"
6-
G_OUTCOME_LIB_NAME: "outcome"
7-
G_OUTCOME_WORK_DIR: "{{.G_DEPS_DIR}}/{{.G_OUTCOME_LIB_NAME}}"
8-
G_QUICKCPPLIB_LIB_NAME: "quickcpplib"
9-
G_QUICKCPPLIB_WORK_DIR: "{{.G_DEPS_DIR}}/{{.G_QUICKCPPLIB_LIB_NAME}}"
106

117
tasks:
128
install-all:
@@ -24,8 +20,8 @@ tasks:
2420
install-all-parallel:
2521
internal: true
2622
deps:
23+
- "install-boost"
2724
- "install-Catch2"
28-
- "install-outcome"
2925

3026
install-Catch2:
3127
internal: true
@@ -39,36 +35,15 @@ tasks:
3935
TAR_URL: "https://github.com/catchorg/Catch2/archive/refs/tags/v3.8.0.tar.gz"
4036
WORK_DIR: "{{.G_CATCH2_WORK_DIR}}"
4137

42-
install-outcome:
38+
install-boost:
4339
internal: true
4440
run: "once"
45-
deps:
46-
- "install-quickcpplib"
4741
cmds:
48-
- task: ":utils:cmake:install-remote-tar"
49-
vars:
50-
CMAKE_GEN_ARGS:
51-
- "-C {{.G_DEPS_CMAKE_SETTINGS_DIR}}/{{.G_QUICKCPPLIB_LIB_NAME}}.cmake"
52-
- "-DBUILD_TESTING=OFF"
53-
- "-DCMAKE_BUILD_TYPE=Release"
54-
- "-DCMAKE_POLICY_DEFAULT_CMP0074=NEW"
55-
CMAKE_PACKAGE_NAME: "{{.G_OUTCOME_LIB_NAME}}"
56-
CMAKE_SETTINGS_DIR: "{{.G_DEPS_CMAKE_SETTINGS_DIR}}"
57-
TAR_SHA256: "0382248cbb00806ce4b5f3ce6939797dc3b597c85fd3531614959e31ef488b39"
58-
TAR_URL: "https://github.com/ned14/outcome/archive/refs/tags/v2.2.11.tar.gz"
59-
WORK_DIR: "{{.G_OUTCOME_WORK_DIR}}"
60-
61-
install-quickcpplib:
62-
internal: true
63-
run: "once"
64-
cmds:
65-
- task: ":utils:cmake:install-remote-tar"
42+
- task: ":utils:boost:download-and-install"
6643
vars:
67-
CMAKE_GEN_ARGS:
68-
- "-DBUILD_TESTING=OFF"
69-
- "-DCMAKE_BUILD_TYPE=Release"
70-
CMAKE_PACKAGE_NAME: "{{.G_QUICKCPPLIB_LIB_NAME}}"
7144
CMAKE_SETTINGS_DIR: "{{.G_DEPS_CMAKE_SETTINGS_DIR}}"
72-
TAR_SHA256: "5d4c9b2d6fa177d3fb14f3fe3086867e43b44f4a7a944eb10ee4616b2b0f3c05"
73-
TAR_URL: "https://github.com/ned14/quickcpplib/archive/f3e452e.tar.gz"
74-
WORK_DIR: "{{.G_QUICKCPPLIB_WORK_DIR}}"
45+
FILE_SHA256: "d6c69e4459eb5d6ec208250291221e7ff4a2affde9af6e49c9303b89c687461f"
46+
URL: "https://github.com/boostorg/boost/releases/download/boost-1.87.0\
47+
/boost-1.87.0-b2-nodocs.tar.gz"
48+
TARGETS: ["headers"]
49+
WORK_DIR: "{{.G_DEPS_DIR}}/boost"

0 commit comments

Comments
 (0)