diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2024-09-12 10:41:23 +0200 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2024-09-13 14:41:00 +0200 |
commit | 74498f0633d9039bbb7971efa33d4242cd724812 (patch) | |
tree | ce2263d515bbdac4ed021f1c9d85f2e75d3ae505 /src | |
parent | fea1ff32426656e89aea9fd36dc9031367c29184 (diff) | |
download | justbuild-74498f0633d9039bbb7971efa33d4242cd724812.tar.gz |
Check compatibility in add_to_cas based on the hash type
Diffstat (limited to 'src')
-rw-r--r-- | src/buildtool/main/TARGETS | 1 | ||||
-rw-r--r-- | src/buildtool/main/add_to_cas.cpp | 6 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/buildtool/main/TARGETS b/src/buildtool/main/TARGETS index d58ad86f..0a31325e 100644 --- a/src/buildtool/main/TARGETS +++ b/src/buildtool/main/TARGETS @@ -161,6 +161,7 @@ , ["src/buildtool/file_system", "file_system_manager"] , ["src/buildtool/logging", "log_level"] , ["src/buildtool/logging", "logging"] + , ["src/buildtool/crypto", "hash_function"] ] , "stage": ["src", "buildtool", "main"] } diff --git a/src/buildtool/main/add_to_cas.cpp b/src/buildtool/main/add_to_cas.cpp index 640c4621..819fa532 100644 --- a/src/buildtool/main/add_to_cas.cpp +++ b/src/buildtool/main/add_to_cas.cpp @@ -23,6 +23,7 @@ #include "src/buildtool/common/artifact_digest.hpp" #include "src/buildtool/common/protocol_traits.hpp" +#include "src/buildtool/crypto/hash_function.hpp" #include "src/buildtool/execution_api/bazel_msg/bazel_msg_factory.hpp" #include "src/buildtool/execution_api/common/execution_api.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" @@ -71,7 +72,8 @@ auto AddArtifactsToCas(ToAddArguments const& clargs, digest = cas.StoreBlob(*content, /*is_executable=*/false); } break; case ObjectType::Tree: { - if (ProtocolTraits::Instance().IsCompatible()) { + if (not ProtocolTraits::IsTreeAllowed( + cas.GetHashFunction().GetType())) { Logger::Log(LogLevel::Error, "Storing of trees only supported in native mode"); return false; @@ -115,4 +117,4 @@ auto AddArtifactsToCas(ToAddArguments const& clargs, return true; } -#endif +#endif // BOOTSTRAP_BUILD_TOOL |