summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/buildtool/computed_roots/TARGETS1
-rw-r--r--src/buildtool/computed_roots/artifacts_root.cpp2
-rw-r--r--src/buildtool/computed_roots/lookup_cache.cpp11
3 files changed, 12 insertions, 2 deletions
diff --git a/src/buildtool/computed_roots/TARGETS b/src/buildtool/computed_roots/TARGETS
index 208711df..a714cfc1 100644
--- a/src/buildtool/computed_roots/TARGETS
+++ b/src/buildtool/computed_roots/TARGETS
@@ -70,6 +70,7 @@
, ["src/buildtool/build_engine/target_map", "configured_target"]
, ["src/buildtool/common", "cli"]
, ["src/buildtool/common", "common"]
+ , ["src/buildtool/crypto", "hash_function"]
, ["src/buildtool/file_system", "file_root"]
, ["src/buildtool/file_system", "file_system_manager"]
, ["src/buildtool/file_system", "git_cas"]
diff --git a/src/buildtool/computed_roots/artifacts_root.cpp b/src/buildtool/computed_roots/artifacts_root.cpp
index dde240a6..8124461b 100644
--- a/src/buildtool/computed_roots/artifacts_root.cpp
+++ b/src/buildtool/computed_roots/artifacts_root.cpp
@@ -146,8 +146,6 @@ auto ArtifactsRoot(ExpressionPtr const& stage,
true);
return std::nullopt;
}
- // TODO(aehlig): Do re-hashing in case of compatible mode
-
// We obtain the entries odered by key; in particular, the entries of all
// subtrees will be next to each other. So, we compute the final tree
// keeping a stack of partially set up tree while walking.
diff --git a/src/buildtool/computed_roots/lookup_cache.cpp b/src/buildtool/computed_roots/lookup_cache.cpp
index 9021463c..000cdbee 100644
--- a/src/buildtool/computed_roots/lookup_cache.cpp
+++ b/src/buildtool/computed_roots/lookup_cache.cpp
@@ -27,6 +27,7 @@
#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"
@@ -101,6 +102,16 @@ 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);