summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/buildtool/build_engine/target_map/utils.cpp1
-rw-r--r--src/buildtool/common/TARGETS1
-rw-r--r--src/buildtool/common/tree.hpp5
-rw-r--r--src/buildtool/common/tree_overlay.hpp3
4 files changed, 8 insertions, 2 deletions
diff --git a/src/buildtool/build_engine/target_map/utils.cpp b/src/buildtool/build_engine/target_map/utils.cpp
index 0ecda4ce..5bdeffe5 100644
--- a/src/buildtool/build_engine/target_map/utils.cpp
+++ b/src/buildtool/build_engine/target_map/utils.cpp
@@ -262,6 +262,7 @@ auto BuildMaps::Target::Utils::createAction(
HashFunction hash_function{HashFunction::Type::PlainSHA256};
auto hasher = hash_function.MakeHasher();
+ hasher.Update("ACTION:");
hasher.Update(hash_vector(hash_function, output_files));
hasher.Update(hash_vector(hash_function, output_dirs));
hasher.Update(hash_vector(hash_function, command));
diff --git a/src/buildtool/common/TARGETS b/src/buildtool/common/TARGETS
index 19bad797..469f074f 100644
--- a/src/buildtool/common/TARGETS
+++ b/src/buildtool/common/TARGETS
@@ -153,6 +153,7 @@
[ "action_description"
, "artifact_description"
, "common"
+ , ["@", "fmt", "", "fmt"]
, ["@", "json", "", "json"]
, ["src/buildtool/crypto", "hash_function"]
]
diff --git a/src/buildtool/common/tree.hpp b/src/buildtool/common/tree.hpp
index c861b264..bf81d848 100644
--- a/src/buildtool/common/tree.hpp
+++ b/src/buildtool/common/tree.hpp
@@ -22,6 +22,7 @@
#include <unordered_map>
#include <utility>
+#include "fmt/core.h"
#include "nlohmann/json.hpp"
#include "src/buildtool/common/action.hpp"
#include "src/buildtool/common/action_description.hpp"
@@ -91,7 +92,9 @@ class Tree {
// The type of HashFunction is irrelevant here. It is used for
// identification of trees. SHA256 is used.
HashFunction const hash_function{HashFunction::Type::PlainSHA256};
- return hash_function.PlainHashData(ComputeDescription(inputs).dump())
+ return hash_function
+ .PlainHashData(
+ fmt::format("TREE:{}", ComputeDescription(inputs).dump()))
.HexString();
}
};
diff --git a/src/buildtool/common/tree_overlay.hpp b/src/buildtool/common/tree_overlay.hpp
index 1b7faaed..69b992a2 100644
--- a/src/buildtool/common/tree_overlay.hpp
+++ b/src/buildtool/common/tree_overlay.hpp
@@ -103,7 +103,8 @@ class TreeOverlay {
// identification of trees. SHA256 is used.
HashFunction const hash_function{HashFunction::Type::PlainSHA256};
return hash_function
- .PlainHashData(ComputeDescription(trees, disjoint).dump())
+ .PlainHashData(fmt::format(
+ "TREE_OVERLAY:{}", ComputeDescription(trees, disjoint).dump()))
.HexString();
}