From ee2da2be9d32426b7ab113005e417837b0ae5a1c Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Thu, 22 Jun 2023 17:10:04 +0200 Subject: Add serialisation of ServerAddress ... in a way consistent with what we're using at other places already. --- src/buildtool/execution_api/remote/TARGETS | 2 ++ src/buildtool/execution_api/remote/config.hpp | 7 +++++++ 2 files changed, 9 insertions(+) (limited to 'src/buildtool/execution_api/remote') diff --git a/src/buildtool/execution_api/remote/TARGETS b/src/buildtool/execution_api/remote/TARGETS index 5a462481..2d08ff8e 100644 --- a/src/buildtool/execution_api/remote/TARGETS +++ b/src/buildtool/execution_api/remote/TARGETS @@ -70,7 +70,9 @@ , "deps": [ ["src/buildtool/logging", "logging"] , ["src/utils/cpp", "type_safe_arithmetic"] + , ["@", "fmt", "", "fmt"] , ["@", "gsl", "", "gsl"] + , ["@", "json", "", "json"] ] , "stage": ["src", "buildtool", "execution_api", "remote"] } diff --git a/src/buildtool/execution_api/remote/config.hpp b/src/buildtool/execution_api/remote/config.hpp index b10c3b23..0b028035 100644 --- a/src/buildtool/execution_api/remote/config.hpp +++ b/src/buildtool/execution_api/remote/config.hpp @@ -23,6 +23,9 @@ #include #include +#include +#include + #include "gsl/gsl" #include "src/buildtool/logging/logger.hpp" #include "src/utils/cpp/type_safe_arithmetic.hpp" @@ -61,6 +64,10 @@ class RemoteExecutionConfig { struct ServerAddress { std::string host{}; Port port{}; + + [[nodiscard]] auto ToJson() const noexcept -> nlohmann::json { + return nlohmann::json{fmt::format("{}:{}", host, port)}; + } }; // Obtain global instance -- cgit v1.2.3