summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-08-28 16:34:39 +0200
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-08-29 09:09:26 +0200
commitded2fe967269c892d8691e0e405a4adc4c4358f4 (patch)
treeefb8509b9d38e172c9ec486753a6594369597b00 /src
parentc9a417ac60366ac58895148ca26d8ee54c376aa1 (diff)
downloadjustbuild-ded2fe967269c892d8691e0e405a4adc4c4358f4.tar.gz
just-mr maps: Add utility key-printing functions
...to be used when reporting pending keys on failure to post value.
Diffstat (limited to 'src')
-rw-r--r--src/other_tools/ops_maps/archive_fetch_map.hpp7
-rw-r--r--src/other_tools/ops_maps/git_tree_fetch_map.hpp6
-rw-r--r--src/other_tools/ops_maps/git_update_map.hpp8
-rw-r--r--src/other_tools/repo_map/repos_to_setup_map.hpp6
4 files changed, 27 insertions, 0 deletions
diff --git a/src/other_tools/ops_maps/archive_fetch_map.hpp b/src/other_tools/ops_maps/archive_fetch_map.hpp
index fccc4bd4..3c4ed82c 100644
--- a/src/other_tools/ops_maps/archive_fetch_map.hpp
+++ b/src/other_tools/ops_maps/archive_fetch_map.hpp
@@ -17,7 +17,9 @@
#include <cstddef>
#include <filesystem>
+#include <functional>
#include <optional>
+#include <string>
#include "gsl/gsl"
#include "src/buildtool/execution_api/common/execution_api.hpp"
@@ -37,4 +39,9 @@ using ArchiveFetchMap = AsyncMapConsumer<ArchiveContent, bool>;
gsl::not_null<JustMRStatistics*> const& stats,
std::size_t jobs) -> ArchiveFetchMap;
+// use explicit cast to std::function to allow template deduction when used
+static const std::function<std::string(ArchiveContent const&)>
+ kArchiveContentPrinter =
+ [](ArchiveContent const& x) -> std::string { return x.content; };
+
#endif // INCLUDED_SRC_OTHER_TOOLS_OPS_MAPS_ARCHIVE_FETCH_MAP_HPP
diff --git a/src/other_tools/ops_maps/git_tree_fetch_map.hpp b/src/other_tools/ops_maps/git_tree_fetch_map.hpp
index 6a2c101c..b7400ae2 100644
--- a/src/other_tools/ops_maps/git_tree_fetch_map.hpp
+++ b/src/other_tools/ops_maps/git_tree_fetch_map.hpp
@@ -16,6 +16,7 @@
#define INCLUDED_SRC_OTHER_TOOLS_OPS_MAPS_GIT_TREE_FETCH_MAP_HPP
#include <cstddef>
+#include <functional>
#include <map>
#include <optional>
#include <string>
@@ -70,4 +71,9 @@ using GitTreeFetchMap = AsyncMapConsumer<GitTreeInfo, bool>;
gsl::not_null<JustMRProgress*> const& progress,
std::size_t jobs) -> GitTreeFetchMap;
+// use explicit cast to std::function to allow template deduction when used
+static const std::function<std::string(GitTreeInfo const&)>
+ kGitTreeInfoPrinter =
+ [](GitTreeInfo const& x) -> std::string { return x.hash; };
+
#endif // INCLUDED_SRC_OTHER_TOOLS_OPS_MAPS_GIT_TREE_FETCH_MAP_HPP
diff --git a/src/other_tools/ops_maps/git_update_map.hpp b/src/other_tools/ops_maps/git_update_map.hpp
index cdb9e55a..d30ebe07 100644
--- a/src/other_tools/ops_maps/git_update_map.hpp
+++ b/src/other_tools/ops_maps/git_update_map.hpp
@@ -16,6 +16,7 @@
#define INCLUDED_SRC_OTHER_TOOLS_OPS_MAPS_GIT_UPDATE_MAP_HPP
#include <cstddef>
+#include <functional>
#include <string>
#include <utility>
#include <vector>
@@ -64,4 +65,11 @@ struct hash<RepoDescriptionForUpdating> {
gsl::not_null<JustMRProgress*> const& progress,
std::size_t jobs) -> GitUpdateMap;
+// use explicit cast to std::function to allow template deduction when used
+static const std::function<std::string(RepoDescriptionForUpdating const&)>
+ kRepoDescriptionPrinter =
+ [](RepoDescriptionForUpdating const& x) -> std::string {
+ return x.repo;
+};
+
#endif // INCLUDED_SRC_OTHER_TOOLS_OPS_MAPS_GIT_UPDATE_MAP_HPP
diff --git a/src/other_tools/repo_map/repos_to_setup_map.hpp b/src/other_tools/repo_map/repos_to_setup_map.hpp
index 257e4251..0f7f6473 100644
--- a/src/other_tools/repo_map/repos_to_setup_map.hpp
+++ b/src/other_tools/repo_map/repos_to_setup_map.hpp
@@ -16,6 +16,7 @@
#define INCLUDED_SRC_OTHER_TOOLS_REPO_MAP_REPOS_TO_SETUP_MAP_HPP
#include <cstddef>
+#include <functional>
#include <memory>
#include <optional>
#include <string>
@@ -48,4 +49,9 @@ auto CreateReposToSetupMap(
gsl::not_null<JustMRStatistics*> const& stats,
std::size_t jobs) -> ReposToSetupMap;
+// use explicit cast to std::function to allow template deduction when used
+static const std::function<std::string(std::string const&)>
+ kReposToSetupPrinter =
+ [](std::string const& x) -> std::string { return x; };
+
#endif // INCLUDED_SRC_OTHER_TOOLS_REPO_MAP_REPOS_TO_SETUP_MAP_HPP