diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2024-09-10 12:25:11 +0200 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2024-09-11 14:52:07 +0200 |
commit | 6e2284eeea2baf3b0c7683749afdea2b37785f46 (patch) | |
tree | 8fa2f0802c5e811b98cb8a3c0cd35cdd1dff1991 /src | |
parent | 2bc6d309c00161b2315b9f98645810699fff3126 (diff) | |
download | justbuild-6e2284eeea2baf3b0c7683749afdea2b37785f46.tar.gz |
Use ArtifactDigestFactory in TargetCacheEntry
...to create ArtifactDigests.
Diffstat (limited to 'src')
-rw-r--r-- | src/buildtool/storage/target_cache_entry.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/buildtool/storage/target_cache_entry.cpp b/src/buildtool/storage/target_cache_entry.cpp index f6659256..263993c8 100644 --- a/src/buildtool/storage/target_cache_entry.cpp +++ b/src/buildtool/storage/target_cache_entry.cpp @@ -20,8 +20,11 @@ #include <string> #include <vector> +#include "src/buildtool/common/artifact_digest.hpp" +#include "src/buildtool/common/artifact_digest_factory.hpp" #include "src/buildtool/logging/log_level.hpp" #include "src/buildtool/logging/logger.hpp" +#include "src/utils/cpp/expected.hpp" #include "src/utils/cpp/gsl.hpp" auto TargetCacheEntry::FromTarget( @@ -80,9 +83,16 @@ auto TargetCacheEntry::ToImpliedIds(std::string const& entry_key_hash) try { for (auto const& x : desc_["implied export targets"]) { if (x != entry_key_hash) { - result.emplace_back(Artifact::ObjectInfo{ - .digest = ArtifactDigest{x, 0, /*is_tree=*/false}, - .type = ObjectType::File}); + auto digest = ArtifactDigestFactory::Create( + hash_type_, x, 0, /*is_tree=*/false); + if (not digest) { + Logger::Log( + LogLevel::Debug, "{}", std::move(digest).error()); + return std::nullopt; + } + result.emplace_back( + Artifact::ObjectInfo{.digest = *std::move(digest), + .type = ObjectType::File}); } } } catch (std::exception const& ex) { |