diff options
Diffstat (limited to 'src/buildtool/computed_roots/lookup_cache.cpp')
-rw-r--r-- | src/buildtool/computed_roots/lookup_cache.cpp | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/src/buildtool/computed_roots/lookup_cache.cpp b/src/buildtool/computed_roots/lookup_cache.cpp index 000cdbee..0555c74b 100644 --- a/src/buildtool/computed_roots/lookup_cache.cpp +++ b/src/buildtool/computed_roots/lookup_cache.cpp @@ -27,7 +27,6 @@ #include "src/buildtool/build_engine/expression/configuration.hpp" #include "src/buildtool/build_engine/expression/target_result.hpp" #include "src/buildtool/computed_roots/artifacts_root.hpp" -#include "src/buildtool/crypto/hash_function.hpp" #include "src/buildtool/file_system/file_root.hpp" #include "src/buildtool/multithreading/task_system.hpp" #include "src/buildtool/storage/target_cache_entry.hpp" @@ -36,7 +35,8 @@ auto LookupCache(BuildMaps::Target::ConfiguredTarget const& ctarget, gsl::not_null<RepositoryConfig*> const& repository_config, Storage const& storage, - AsyncMapConsumerLoggerPtr const& logger) + AsyncMapConsumerLoggerPtr const& logger, + std::optional<RehashUtils::Rehasher> const& rehash) -> expected<std::optional<std::string>, std::monostate> { auto const* target_root = repository_config->TargetRoot(ctarget.target.ToModule().repository); @@ -102,16 +102,6 @@ auto LookupCache(BuildMaps::Target::ConfiguredTarget const& ctarget, if (not flexible_vars) { return unexpected(std::monostate{}); } - // TODO(aehlig): Support re-hashing in case of compatible mode, so that - // cache lookups can be used in this case as well. - if (storage.GetHashFunction().GetType() != HashFunction::Type::GitSHA1) { - // So far, transforming the result of a cache hit in memory into - // a git root is only implemented for GitSHA1. Therefore, do not - // try to look up cache hits, and simply pretend a non hit. - return expected<std::optional<std::string>, std::monostate>( - std::nullopt); - } - auto effective_config = ctarget.config.Prune(*flexible_vars); auto cache_key = storage.TargetCache().ComputeKey( *repo_key, ctarget.target.GetNamedTarget(), effective_config); @@ -141,7 +131,7 @@ auto LookupCache(BuildMaps::Target::ConfiguredTarget const& ctarget, msg), fatal); }); - auto root = ArtifactsRoot(result->artifact_stage, wrapped_logger); + auto root = ArtifactsRoot(result->artifact_stage, wrapped_logger, rehash); if (not root) { return unexpected(std::monostate{}); } |