diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/buildtool/common/TARGETS | 1 | ||||
-rw-r--r-- | src/buildtool/common/artifact.hpp | 9 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/buildtool/common/TARGETS b/src/buildtool/common/TARGETS index 73a6a5b6..17f4062d 100644 --- a/src/buildtool/common/TARGETS +++ b/src/buildtool/common/TARGETS @@ -87,6 +87,7 @@ ] , "deps": [ "bazel_types" + , "protocol_traits" , ["@", "json", "", "json"] , ["src/buildtool/crypto", "hash_function"] , ["src/buildtool/crypto", "hash_info"] diff --git a/src/buildtool/common/artifact.hpp b/src/buildtool/common/artifact.hpp index 6fcde282..403071a2 100644 --- a/src/buildtool/common/artifact.hpp +++ b/src/buildtool/common/artifact.hpp @@ -25,6 +25,7 @@ #include "nlohmann/json.hpp" #include "src/buildtool/common/artifact_digest.hpp" #include "src/buildtool/common/identifier.hpp" +#include "src/buildtool/common/protocol_traits.hpp" #include "src/buildtool/crypto/hash_function.hpp" #include "src/buildtool/crypto/hash_info.hpp" #include "src/buildtool/file_system/object_type.hpp" @@ -99,8 +100,14 @@ class Artifact { } auto const object_type = FromChar(*type.c_str()); + // TODO(design): The logic of ArtifactDigestFactory::Create is + // duplicated here to avoid a cyclic dependency. A better solution + // is advisable. auto hash_info = - HashInfo::Create(hash_type, id, IsTreeObject(object_type)); + HashInfo::Create(hash_type, + id, + ProtocolTraits::IsTreeAllowed(hash_type) and + IsTreeObject(object_type)); if (not hash_info) { Logger::Log( LogLevel::Debug, "{}", std::move(hash_info).error()); |