From 2bc6d309c00161b2315b9f98645810699fff3126 Mon Sep 17 00:00:00 2001 From: Maksim Denisov Date: Thu, 1 Aug 2024 17:44:23 +0200 Subject: Use HashFunction::Type to deserialize ArtifactDescription --- src/buildtool/graph_traverser/graph_traverser.hpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/buildtool/graph_traverser/graph_traverser.hpp') diff --git a/src/buildtool/graph_traverser/graph_traverser.hpp b/src/buildtool/graph_traverser/graph_traverser.hpp index 51a1976d..b62bd08a 100644 --- a/src/buildtool/graph_traverser/graph_traverser.hpp +++ b/src/buildtool/graph_traverser/graph_traverser.hpp @@ -35,6 +35,7 @@ #include "src/buildtool/common/artifact_digest_factory.hpp" #include "src/buildtool/common/cli.hpp" #include "src/buildtool/common/tree.hpp" +#include "src/buildtool/crypto/hash_function.hpp" #include "src/buildtool/execution_api/common/artifact_blob_container.hpp" #include "src/buildtool/execution_api/common/common_api.hpp" #include "src/buildtool/execution_api/common/execution_api.hpp" @@ -179,10 +180,13 @@ class GraphTraverser { } auto const [blobs, tree_descs, actions] = *desc; + HashFunction::Type const hash_type = + context_.apis->hash_function.GetType(); std::vector action_descriptions{}; action_descriptions.reserve(actions.size()); for (auto const& [id, description] : actions.items()) { - auto action = ActionDescription::FromJson(id, description); + auto action = + ActionDescription::FromJson(hash_type, id, description); if (not action) { return std::nullopt; // Error already logged } @@ -191,7 +195,7 @@ class GraphTraverser { std::vector trees{}; for (auto const& [id, description] : tree_descs.items()) { - auto tree = Tree::FromJson(id, description); + auto tree = Tree::FromJson(hash_type, id, description); if (not tree) { return std::nullopt; } @@ -200,7 +204,8 @@ class GraphTraverser { std::map artifact_descriptions{}; for (auto const& [rel_path, description] : artifacts.items()) { - auto artifact = ArtifactDescription::FromJson(description); + auto artifact = + ArtifactDescription::FromJson(hash_type, description); if (not artifact) { return std::nullopt; // Error already logged } -- cgit v1.2.3