summaryrefslogtreecommitdiff
path: root/src/buildtool/storage/target_cache_entry.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildtool/storage/target_cache_entry.hpp')
-rw-r--r--src/buildtool/storage/target_cache_entry.hpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/buildtool/storage/target_cache_entry.hpp b/src/buildtool/storage/target_cache_entry.hpp
index b0bd1020..a1cddf62 100644
--- a/src/buildtool/storage/target_cache_entry.hpp
+++ b/src/buildtool/storage/target_cache_entry.hpp
@@ -27,21 +27,25 @@
#include "src/buildtool/build_engine/expression/target_result.hpp"
#include "src/buildtool/common/artifact.hpp"
#include "src/buildtool/common/artifact_description.hpp"
+#include "src/buildtool/crypto/hash_function.hpp"
// Entry for target cache. Created from target, contains TargetResult.
class TargetCacheEntry {
public:
- explicit TargetCacheEntry(nlohmann::json desc) : desc_(std::move(desc)) {}
+ explicit TargetCacheEntry(HashFunction::Type hash_type, nlohmann::json desc)
+ : hash_type_{hash_type}, desc_(std::move(desc)) {}
// Create the entry from target with replacement artifacts/infos.
// Replacement artifacts must replace all non-known artifacts by known.
[[nodiscard]] static auto FromTarget(
+ HashFunction::Type hash_type,
AnalysedTargetPtr const& target,
std::unordered_map<ArtifactDescription, Artifact::ObjectInfo> const&
replacements) noexcept -> std::optional<TargetCacheEntry>;
// Create a target-cache entry from a json description.
- [[nodiscard]] static auto FromJson(nlohmann::json desc) noexcept
+ [[nodiscard]] static auto FromJson(HashFunction::Type hash_type,
+ nlohmann::json desc) noexcept
-> TargetCacheEntry;
// Obtain TargetResult from cache entry.
@@ -70,6 +74,7 @@ class TargetCacheEntry {
}
private:
+ HashFunction::Type hash_type_;
nlohmann::json desc_;
};