From 2e2a3083a21823aa04afa0f02c38b612ca4d1045 Mon Sep 17 00:00:00 2001 From: Maksim Denisov Date: Tue, 9 Jul 2024 12:13:04 +0200 Subject: Remove unused parameters in CreateDirectoryDigestFromTree --- .../execution_api/bazel_msg/bazel_msg_factory.cpp | 36 ++++++++-------------- .../execution_api/bazel_msg/bazel_msg_factory.hpp | 6 +--- 2 files changed, 13 insertions(+), 29 deletions(-) (limited to 'src/buildtool/execution_api') diff --git a/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp b/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp index 9ced1375..1ce53021 100644 --- a/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp +++ b/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp @@ -398,8 +398,7 @@ template std::string const& root_name, DirectoryTreePtr const& tree, BazelMsgFactory::LinkDigestResolveFunc const& resolve_links, - std::optional const& process_blob, - std::optional const& store_info, + BazelMsgFactory::BlobProcessFunc const& process_blob, std::filesystem::path const& parent = "") noexcept -> DirectoryNodeBundle::Ptr { std::vector file_nodes{}; @@ -410,18 +409,14 @@ template for (auto const& [name, node] : *tree) { if (std::holds_alternative(node)) { auto const& dir = std::get(node); - auto const dir_bundle = DirectoryTreeToBundle(name, - dir, - resolve_links, - process_blob, - store_info, - parent / name); + auto const dir_bundle = DirectoryTreeToBundle( + name, dir, resolve_links, process_blob, parent / name); if (not dir_bundle) { return nullptr; } dir_nodes.emplace_back(dir_bundle->Message()); - if (process_blob and not(*process_blob)(dir_bundle->MakeBlob( - /*is_exec=*/false))) { + if (not process_blob(dir_bundle->MakeBlob( + /*is_exec=*/false))) { return nullptr; } } @@ -445,10 +440,6 @@ template file_nodes.emplace_back( CreateFileNodeFromObjectInfo(name, *object_info)); } - if (store_info and - not(*store_info)(parent / name, *object_info)) { - return nullptr; - } } } return CreateDirectoryNodeBundle( @@ -469,19 +460,16 @@ template auto BazelMsgFactory::CreateDirectoryDigestFromTree( DirectoryTreePtr const& tree, LinkDigestResolveFunc const& resolve_links, - std::optional const& process_blob, - std::optional const& store_info) noexcept + BlobProcessFunc const& process_blob) noexcept -> std::optional { - if (auto bundle = DirectoryTreeToBundle( - "", tree, resolve_links, process_blob, store_info)) { - if (process_blob) { - try { - if (not(*process_blob)(bundle->MakeBlob(/*is_exec=*/false))) { - return std::nullopt; - } - } catch (...) { + if (auto bundle = + DirectoryTreeToBundle("", tree, resolve_links, process_blob)) { + try { + if (not process_blob(bundle->MakeBlob(/*is_exec=*/false))) { return std::nullopt; } + } catch (...) { + return std::nullopt; } return bundle->Digest(); } diff --git a/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.hpp b/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.hpp index 817925f9..0a07806d 100644 --- a/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.hpp +++ b/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.hpp @@ -42,8 +42,6 @@ class BazelMsgFactory { using BlobProcessFunc = std::function; /// \brief Store blob. using BlobStoreFunc = std::function; - using InfoStoreFunc = std::function; using LinkDigestResolveFunc = std::function const&, std::vector*)>; @@ -59,13 +57,11 @@ class BazelMsgFactory { /// \param tree Directory tree of artifacts. /// \param resolve_links Function for resolving symlinks. /// \param process_blob Function for processing Directory blobs. - /// \param store_info Function for storing object infos. /// \returns Digest representing the entire tree. [[nodiscard]] static auto CreateDirectoryDigestFromTree( DirectoryTreePtr const& tree, LinkDigestResolveFunc const& resolve_links, - std::optional const& process_blob = std::nullopt, - std::optional const& store_info = std::nullopt) noexcept + BlobProcessFunc const& process_blob) noexcept -> std::optional; /// \brief Create Directory digest from local file root. -- cgit v1.2.3