diff options
39 files changed, 161 insertions, 168 deletions
diff --git a/src/buildtool/build_engine/expression/expression.cpp b/src/buildtool/build_engine/expression/expression.cpp index 9f901708..7d0f55b5 100644 --- a/src/buildtool/build_engine/expression/expression.cpp +++ b/src/buildtool/build_engine/expression/expression.cpp @@ -241,7 +241,7 @@ auto Expression::ComputeHash() const noexcept -> std::string { // The type of HashFunction is irrelevant here. It is used for // identification and quick comparison of expressions. SHA256 is used. - HashFunction const hash_function{HashFunction::JustHash::Compatible}; + HashFunction const hash_function{HashFunction::Type::PlainSHA256}; if (IsNone() or IsBool() or IsNumber() or IsString() or IsArtifact() or IsResult() or IsNode() or IsName()) { // just hash the JSON representation, but prepend "@" for artifact, @@ -251,7 +251,7 @@ auto Expression::ComputeHash() const noexcept -> std::string { : IsNode() ? "#" : IsName() ? "$" : ""}; - hash = hash_function.ComputeHash(prefix + ToString()).Bytes(); + hash = hash_function.PlainHashData(prefix + ToString()).Bytes(); } else { auto hasher = hash_function.MakeHasher(); @@ -266,7 +266,7 @@ auto Expression::ComputeHash() const noexcept -> std::string { auto map = Value<Expression::map_t>(); hasher.Update("{"); for (auto const& el : map->get()) { - hasher.Update(hash_function.ComputeHash(el.first).Bytes()); + hasher.Update(hash_function.PlainHashData(el.first).Bytes()); hasher.Update(el.second->ToHash()); } } diff --git a/src/buildtool/build_engine/target_map/utils.cpp b/src/buildtool/build_engine/target_map/utils.cpp index 742a5e2f..56f996ca 100644 --- a/src/buildtool/build_engine/target_map/utils.cpp +++ b/src/buildtool/build_engine/target_map/utils.cpp @@ -189,7 +189,7 @@ auto hash_vector(HashFunction hash_function, std::vector<std::string> const& vec) -> std::string { auto hasher = hash_function.MakeHasher(); for (auto const& s : vec) { - hasher.Update(hash_function.ComputeHash(s).Bytes()); + hasher.Update(hash_function.PlainHashData(s).Bytes()); } return std::move(hasher).Finalize().Bytes(); } @@ -207,7 +207,7 @@ auto BuildMaps::Target::Utils::createAction( const ExpressionPtr& inputs_exp) -> ActionDescription::Ptr { // The type of HashFunction is irrelevant here. It is used for // identification and quick comparison of descriptions. SHA256 is used. - HashFunction hash_function{HashFunction::JustHash::Compatible}; + HashFunction hash_function{HashFunction::Type::PlainSHA256}; auto hasher = hash_function.MakeHasher(); hasher.Update(hash_vector(hash_function, output_files)); diff --git a/src/buildtool/common/artifact_description.cpp b/src/buildtool/common/artifact_description.cpp index 49a3afc7..6a0bf7de 100644 --- a/src/buildtool/common/artifact_description.cpp +++ b/src/buildtool/common/artifact_description.cpp @@ -196,8 +196,8 @@ auto ArtifactDescription::ComputeId(nlohmann::json const& desc) noexcept try { // The type of HashFunction is irrelevant here. It is used for // identification and quick comparison of descriptions. SHA256 is used. - return HashFunction{HashFunction::JustHash::Compatible} - .ComputeHash(desc.dump()) + return HashFunction{HashFunction::Type::PlainSHA256} + .PlainHashData(desc.dump()) .Bytes(); } catch (std::exception const& ex) { Logger::Log(LogLevel::Error, diff --git a/src/buildtool/common/artifact_digest.hpp b/src/buildtool/common/artifact_digest.hpp index 1a620793..6b9ecb88 100644 --- a/src/buildtool/common/artifact_digest.hpp +++ b/src/buildtool/common/artifact_digest.hpp @@ -79,13 +79,13 @@ class ArtifactDigest { -> ArtifactDigest { if constexpr (kType == ObjectType::Tree) { return ArtifactDigest{ - hash_function.ComputeTreeHash(content).HexString(), + hash_function.HashTreeData(content).HexString(), content.size(), /*is_tree=*/true}; } else { return ArtifactDigest{ - hash_function.ComputeBlobHash(content).HexString(), + hash_function.HashBlobData(content).HexString(), content.size(), /*is_tree=*/false}; } diff --git a/src/buildtool/common/repository_config.cpp b/src/buildtool/common/repository_config.cpp index 735e2c01..caf0d2bf 100644 --- a/src/buildtool/common/repository_config.cpp +++ b/src/buildtool/common/repository_config.cpp @@ -78,7 +78,7 @@ auto RepositoryConfig::DeduplicateRepo(std::string const& repo, if (data.base_desc) { // Use hash of content-fixed base description as content id auto hash = - hash_function.ComputeHash(data.base_desc->dump()).Bytes(); + hash_function.PlainHashData(data.base_desc->dump()).Bytes(); // Add state with name, transitions, and content id minimizer.AddState(repo, data.info.name_mapping, hash); } diff --git a/src/buildtool/common/tree.hpp b/src/buildtool/common/tree.hpp index 2f33bfe0..53333901 100644 --- a/src/buildtool/common/tree.hpp +++ b/src/buildtool/common/tree.hpp @@ -87,8 +87,8 @@ class Tree { static auto ComputeId(inputs_t const& inputs) -> std::string { // The type of HashFunction is irrelevant here. It is used for // identification of trees. SHA256 is used. - HashFunction const hash_function{HashFunction::JustHash::Compatible}; - return hash_function.ComputeHash(ComputeDescription(inputs).dump()) + HashFunction const hash_function{HashFunction::Type::PlainSHA256}; + return hash_function.PlainHashData(ComputeDescription(inputs).dump()) .HexString(); } }; diff --git a/src/buildtool/compatibility/compatibility.hpp b/src/buildtool/compatibility/compatibility.hpp index 2073ad52..e276c562 100644 --- a/src/buildtool/compatibility/compatibility.hpp +++ b/src/buildtool/compatibility/compatibility.hpp @@ -55,8 +55,8 @@ class Compatibility { } } // This is only used in compatible mode. - HashFunction const hash_function{HashFunction::JustHash::Compatible}; - auto compatible_hash = hash_function.ComputeHash(data).HexString(); + HashFunction const hash_function{HashFunction::Type::PlainSHA256}; + auto compatible_hash = hash_function.PlainHashData(data).HexString(); std::unique_lock lock_{Instance().mutex_}; Instance().git_to_compatible_[git_hash] = compatible_hash; Instance().compatible_to_git_[compatible_hash] = {git_hash, repo}; diff --git a/src/buildtool/crypto/hash_function.cpp b/src/buildtool/crypto/hash_function.cpp index a759a0ce..6f240e50 100644 --- a/src/buildtool/crypto/hash_function.cpp +++ b/src/buildtool/crypto/hash_function.cpp @@ -31,17 +31,17 @@ namespace { } } // namespace -auto HashFunction::ComputeBlobHash(std::string const& data) const noexcept +auto HashFunction::HashBlobData(std::string const& data) const noexcept -> Hasher::HashDigest { return HashTaggedLine(data, CreateGitBlobTag); } -auto HashFunction::ComputeTreeHash(std::string const& data) const noexcept +auto HashFunction::HashTreeData(std::string const& data) const noexcept -> Hasher::HashDigest { return HashTaggedLine(data, CreateGitTreeTag); } -auto HashFunction::ComputeHash(std::string const& data) const noexcept +auto HashFunction::PlainHashData(std::string const& data) const noexcept -> Hasher::HashDigest { return HashTaggedLine(data, std::nullopt); } @@ -50,7 +50,7 @@ auto HashFunction::HashTaggedLine(std::string const& data, std::optional<TagCreator> tag_creator) const noexcept -> Hasher::HashDigest { auto hasher = MakeHasher(); - if (type_ == JustHash::Native and tag_creator.has_value()) { + if (type_ == Type::GitSHA1 and tag_creator.has_value()) { hasher.Update(std::invoke(*tag_creator, data.size())); } hasher.Update(data); @@ -79,7 +79,7 @@ auto HashFunction::HashTaggedFile(std::filesystem::path const& path, "An overflow will occur while reading"); auto hasher = MakeHasher(); - if (type_ == JustHash::Native) { + if (type_ == Type::GitSHA1) { hasher.Update(std::invoke(tag_creator, size)); } diff --git a/src/buildtool/crypto/hash_function.hpp b/src/buildtool/crypto/hash_function.hpp index 99a15cdb..9e5a9c0b 100644 --- a/src/buildtool/crypto/hash_function.hpp +++ b/src/buildtool/crypto/hash_function.hpp @@ -28,12 +28,12 @@ /// \brief Hash function used for the entire buildtool. class HashFunction { public: - enum class JustHash : std::uint8_t { - Native, ///< SHA1 for plain hashes, and Git for blobs and trees. - Compatible ///< SHA256 for all hashes. + enum class Type : std::uint8_t { + GitSHA1, ///< SHA1 for plain hashes, and Git for blobs and trees. + PlainSHA256 ///< SHA256 for all hashes. }; - explicit HashFunction(JustHash type) noexcept : type_{type} { + explicit HashFunction(Type type) noexcept : type_{type} { static_assert( sizeof(HashFunction) <= sizeof(void*), "HashFunction is passed and stored by value. If the " @@ -41,20 +41,18 @@ class HashFunction { "the way how HashFunction is passed and stored must be changed."); } - [[nodiscard]] auto GetHashType() const noexcept -> JustHash { - return type_; - } + [[nodiscard]] auto GetType() const noexcept -> Type { return type_; } /// \brief Compute the blob hash of a string. - [[nodiscard]] auto ComputeBlobHash(std::string const& data) const noexcept + [[nodiscard]] auto HashBlobData(std::string const& data) const noexcept -> Hasher::HashDigest; /// \brief Compute the tree hash of a string. - [[nodiscard]] auto ComputeTreeHash(std::string const& data) const noexcept + [[nodiscard]] auto HashTreeData(std::string const& data) const noexcept -> Hasher::HashDigest; /// \brief Compute the plain hash of a string. - [[nodiscard]] auto ComputeHash(std::string const& data) const noexcept + [[nodiscard]] auto PlainHashData(std::string const& data) const noexcept -> Hasher::HashDigest; /// \brief Compute the blob hash of a file or std::nullopt on IO error. @@ -71,10 +69,10 @@ class HashFunction { [[nodiscard]] auto MakeHasher() const noexcept -> Hasher { std::optional<Hasher> hasher; switch (type_) { - case JustHash::Native: + case Type::GitSHA1: hasher = Hasher::Create(Hasher::HashType::SHA1); break; - case JustHash::Compatible: + case Type::PlainSHA256: hasher = Hasher::Create(Hasher::HashType::SHA256); break; } @@ -83,7 +81,7 @@ class HashFunction { } private: - JustHash const type_; + Type const type_; using TagCreator = std::function<std::string(std::size_t)>; diff --git a/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp b/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp index aeb75540..09462bec 100644 --- a/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp +++ b/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp @@ -186,7 +186,7 @@ template <class T> } // SHA256 is used since bazel types are processed here. - HashFunction const hash_function{HashFunction::JustHash::Compatible}; + HashFunction const hash_function{HashFunction::Type::PlainSHA256}; auto digest = ArtifactDigest::Create<ObjectType::File>(hash_function, *content); diff --git a/src/buildtool/execution_api/common/execution_common.hpp b/src/buildtool/execution_api/common/execution_common.hpp index b6bd1fa0..0cf0983d 100644 --- a/src/buildtool/execution_api/common/execution_common.hpp +++ b/src/buildtool/execution_api/common/execution_common.hpp @@ -107,9 +107,9 @@ static void EncodeUUIDVariant1(std::string* uuid) { // The type of HashFunction is irrelevant here. It is used for // identification purposes only. SHA256 is used. - HashFunction const hash_function{HashFunction::JustHash::Compatible}; + HashFunction const hash_function{HashFunction::Type::PlainSHA256}; auto value = fmt::format("{}-{}", std::to_string(kRandomConstant), seed); - auto uuid = hash_function.ComputeHash(value).Bytes(); + auto uuid = hash_function.PlainHashData(value).Bytes(); EncodeUUIDVersion4(&uuid); EncodeUUIDVariant1(&uuid); Expects(uuid.size() >= kRawLength); diff --git a/src/buildtool/execution_api/common/tree_reader_utils.cpp b/src/buildtool/execution_api/common/tree_reader_utils.cpp index acd24108..0573d89e 100644 --- a/src/buildtool/execution_api/common/tree_reader_utils.cpp +++ b/src/buildtool/execution_api/common/tree_reader_utils.cpp @@ -91,7 +91,7 @@ auto TreeReaderUtils::ReadObjectInfos(bazel_re::Directory const& dir, } // SHA256 is used since bazel types are processed here. - HashFunction const hash_function{HashFunction::JustHash::Compatible}; + HashFunction const hash_function{HashFunction::Type::PlainSHA256}; for (auto const& l : dir.symlinks()) { if (not store_info(l.name(), CreateObjectInfo(l, hash_function))) { return false; diff --git a/src/buildtool/execution_api/git/git_api.hpp b/src/buildtool/execution_api/git/git_api.hpp index 470dca41..139291ef 100644 --- a/src/buildtool/execution_api/git/git_api.hpp +++ b/src/buildtool/execution_api/git/git_api.hpp @@ -196,7 +196,7 @@ class GitApi final : public IExecutionApi { } // GitApi works in the native mode only. - HashFunction const hash_function{HashFunction::JustHash::Native}; + HashFunction const hash_function{HashFunction::Type::GitSHA1}; // Collect blobs of missing artifacts from local CAS. Trees are // processed recursively before any blob is uploaded. diff --git a/src/buildtool/execution_api/local/local_cas_reader.cpp b/src/buildtool/execution_api/local/local_cas_reader.cpp index 397c02ad..fd7ede7f 100644 --- a/src/buildtool/execution_api/local/local_cas_reader.cpp +++ b/src/buildtool/execution_api/local/local_cas_reader.cpp @@ -60,10 +60,10 @@ auto LocalCasReader::ReadGitTree(ArtifactDigest const& digest) const noexcept }; // Git-SHA1 hashing is used for reading from git. - HashFunction const hash_function{HashFunction::JustHash::Native}; + HashFunction const hash_function{HashFunction::Type::GitSHA1}; return GitRepo::ReadTreeData( *content, - hash_function.ComputeTreeHash(*content).Bytes(), + hash_function.HashTreeData(*content).Bytes(), check_symlinks, /*is_hex_id=*/false); } diff --git a/src/buildtool/execution_api/remote/bazel/bazel_cas_client.cpp b/src/buildtool/execution_api/remote/bazel/bazel_cas_client.cpp index 0c0bb433..28400a51 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_cas_client.cpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_cas_client.cpp @@ -54,9 +54,9 @@ namespace { // Create empty blob. std::string empty_str{}; HashFunction const hash_function{Compatibility::IsCompatible() - ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native}; - std::string hash = hash_function.ComputeBlobHash(empty_str).HexString(); + ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1}; + std::string hash = hash_function.HashBlobData(empty_str).HexString(); bazel_re::Digest digest{}; digest.set_hash(NativeSupport::Prefix(hash, false)); digest.set_size_bytes(empty_str.size()); @@ -122,9 +122,9 @@ namespace { // Create empty blob. std::string empty_str{}; HashFunction const hash_function{Compatibility::IsCompatible() - ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native}; - std::string hash = hash_function.ComputeBlobHash(empty_str).HexString(); + ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1}; + std::string hash = hash_function.HashBlobData(empty_str).HexString(); bazel_re::Digest digest{}; digest.set_hash(NativeSupport::Prefix(hash, false)); digest.set_size_bytes(empty_str.size()); diff --git a/src/buildtool/execution_api/remote/bazel/bazel_network_reader.cpp b/src/buildtool/execution_api/remote/bazel/bazel_network_reader.cpp index 8416189b..690a1278 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_network_reader.cpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_network_reader.cpp @@ -67,8 +67,7 @@ auto BazelNetworkReader::ReadDirectory(ArtifactDigest const& digest) auto BazelNetworkReader::ReadGitTree(ArtifactDigest const& digest) const noexcept -> std::optional<GitRepo::tree_entries_t> { - ExpectsAudit(hash_function_.GetHashType() == - HashFunction::JustHash::Native); + ExpectsAudit(hash_function_.GetType() == HashFunction::Type::GitSHA1); auto read_blob = ReadSingleBlob(digest); if (not read_blob) { @@ -97,11 +96,10 @@ auto BazelNetworkReader::ReadGitTree(ArtifactDigest const& digest) }; std::string const& content = *read_blob->data; - return GitRepo::ReadTreeData( - content, - hash_function_.ComputeTreeHash(content).Bytes(), - check_symlinks, - /*is_hex_id=*/false); + return GitRepo::ReadTreeData(content, + hash_function_.HashTreeData(content).Bytes(), + check_symlinks, + /*is_hex_id=*/false); } auto BazelNetworkReader::DumpRawTree(Artifact::ObjectInfo const& info, @@ -142,8 +140,7 @@ auto BazelNetworkReader::DumpBlob(Artifact::ObjectInfo const& info, auto BazelNetworkReader::MakeAuxiliaryMap( std::vector<bazel_re::Directory>&& full_tree) const noexcept -> std::optional<DirectoryMap> { - ExpectsAudit(hash_function_.GetHashType() == - HashFunction::JustHash::Compatible); + ExpectsAudit(hash_function_.GetType() == HashFunction::Type::PlainSHA256); DirectoryMap result; result.reserve(full_tree.size()); diff --git a/src/buildtool/execution_api/utils/subobject.cpp b/src/buildtool/execution_api/utils/subobject.cpp index aa41b5da..380fe65f 100644 --- a/src/buildtool/execution_api/utils/subobject.cpp +++ b/src/buildtool/execution_api/utils/subobject.cpp @@ -76,8 +76,8 @@ auto RetrieveSubPathId(Artifact::ObjectInfo object_info, object_info = *new_object_info; } else { - auto const hash = HashFunction{HashFunction::JustHash::Native} - .ComputeTreeHash(*data) + auto const hash = HashFunction{HashFunction::Type::GitSHA1} + .HashTreeData(*data) .Bytes(); auto entries = GitRepo::ReadTreeData( *data, diff --git a/src/buildtool/main/install_cas.cpp b/src/buildtool/main/install_cas.cpp index 3c460200..024d22c7 100644 --- a/src/buildtool/main/install_cas.cpp +++ b/src/buildtool/main/install_cas.cpp @@ -35,7 +35,7 @@ namespace { // Only in compatible mode the size is checked, so an empty SHA256 hash is // needed. static auto const kEmptyHash = - HashFunction{HashFunction::JustHash::Compatible}.ComputeBlobHash(""); + HashFunction{HashFunction::Type::PlainSHA256}.HashBlobData(""); return Compatibility::IsCompatible() and // native mode is fine (size_str == "0" or size_str.empty()) and // not "0" or "" is fine kEmptyHash.HexString() != hash and // empty hash is fine diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp index b089e321..08864e96 100644 --- a/src/buildtool/main/main.cpp +++ b/src/buildtool/main/main.cpp @@ -122,8 +122,8 @@ void SetupLogging(LogArguments const& clargs) { auto config = builder - .SetHashType(is_compatible ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native) + .SetHashType(is_compatible ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1) .SetRemoteExecutionArgs( remote_address, remote_platform_properties, remote_dispatch) .Build(); diff --git a/src/buildtool/serve_api/serve_service/source_tree.cpp b/src/buildtool/serve_api/serve_service/source_tree.cpp index 6feb9288..511acfd3 100644 --- a/src/buildtool/serve_api/serve_service/source_tree.cpp +++ b/src/buildtool/serve_api/serve_service/source_tree.cpp @@ -1159,8 +1159,8 @@ auto SourceTreeService::ServeDistdirTree( kv.name(), std::make_pair(blob_digest, kv.executable())); } // get hash of distdir content; this must match with that in just-mr - auto content_id = HashFunction{HashFunction::JustHash::Native} - .ComputeBlobHash(nlohmann::json(content_list).dump()) + auto content_id = HashFunction{HashFunction::Type::GitSHA1} + .HashBlobData(nlohmann::json(content_list).dump()) .HexString(); // create in-memory tree of the distdir, now that we know we have all blobs auto tree = GitRepo::CreateShallowTree(entries); diff --git a/src/buildtool/storage/config.hpp b/src/buildtool/storage/config.hpp index 56274c02..0841f9d5 100644 --- a/src/buildtool/storage/config.hpp +++ b/src/buildtool/storage/config.hpp @@ -65,7 +65,7 @@ struct StorageConfig final { // Number of total storage generations (default: two generations). std::size_t const num_generations = 2; - HashFunction const hash_function{HashFunction::JustHash::Native}; + HashFunction const hash_function{HashFunction::Type::GitSHA1}; // Hash of the execution backend description std::string const backend_description_id = DefaultBackendDescriptionId(); @@ -182,7 +182,7 @@ class StorageConfig::Builder final { } /// \brief Specify the type of the hash function - auto SetHashType(HashFunction::JustHash value) noexcept -> Builder& { + auto SetHashType(HashFunction::Type value) noexcept -> Builder& { hash_type_ = value; return *this; } @@ -249,7 +249,7 @@ class StorageConfig::Builder final { private: std::optional<std::filesystem::path> build_root_; std::optional<std::size_t> num_generations_; - std::optional<HashFunction::JustHash> hash_type_; + std::optional<HashFunction::Type> hash_type_; // Fields for computing remote execution backend description std::optional<ServerAddress> remote_address_; diff --git a/src/buildtool/storage/fs_utils.cpp b/src/buildtool/storage/fs_utils.cpp index 05d6bbb8..62adf1e9 100644 --- a/src/buildtool/storage/fs_utils.cpp +++ b/src/buildtool/storage/fs_utils.cpp @@ -77,7 +77,7 @@ auto GetForeignFileTreeIDFile(StorageConfig const& storage_config, return GetDistdirTreeIDFile( storage_config, storage_config.hash_function - .ComputeBlobHash( + .HashBlobData( nlohmann::json(std::unordered_map<std::string, std::pair<std::string, bool>>{ {name, {content, executable}}}) diff --git a/src/buildtool/storage/garbage_collector.cpp b/src/buildtool/storage/garbage_collector.cpp index b03364f8..a108ae73 100644 --- a/src/buildtool/storage/garbage_collector.cpp +++ b/src/buildtool/storage/garbage_collector.cpp @@ -220,8 +220,8 @@ auto GarbageCollector::Compactify(StorageConfig const& storage_config, }); auto compactify = [threshold](StorageConfig const& config) -> bool { - Compatibility::SetCompatible(config.hash_function.GetHashType() == - HashFunction::JustHash::Compatible); + Compatibility::SetCompatible(config.hash_function.GetType() == + HashFunction::Type::PlainSHA256); auto const storage = ::Generation::Create(&config); return Compactifier::RemoveInvalid(storage.CAS()) and @@ -230,19 +230,19 @@ auto GarbageCollector::Compactify(StorageConfig const& storage_config, }; // Compactification must be done for both native and compatible storages. - static constexpr std::array kHashes = {HashFunction::JustHash::Native, - HashFunction::JustHash::Compatible}; + static constexpr std::array kHashes = {HashFunction::Type::GitSHA1, + HashFunction::Type::PlainSHA256}; auto builder = StorageConfig::Builder{} .SetBuildRoot(storage_config.build_root) .SetNumGenerations(storage_config.num_generations); - return std::all_of( - kHashes.begin(), - kHashes.end(), - [&builder, &compactify](HashFunction::JustHash hash_type) { - auto const config = builder.SetHashType(hash_type).Build(); - return config.has_value() and compactify(*config); - }); + return std::all_of(kHashes.begin(), + kHashes.end(), + [&builder, &compactify](HashFunction::Type hash_type) { + auto const config = + builder.SetHashType(hash_type).Build(); + return config.has_value() and compactify(*config); + }); } #endif // BOOTSTRAP_BUILD_TOOL diff --git a/src/other_tools/just_mr/main.cpp b/src/other_tools/just_mr/main.cpp index 698a6ccb..24bf8ffd 100644 --- a/src/other_tools/just_mr/main.cpp +++ b/src/other_tools/just_mr/main.cpp @@ -214,8 +214,8 @@ void SetupLogging(MultiRepoLogArguments const& clargs) { if (args.just_mr_paths->root.has_value()) { builder.SetBuildRoot(*args.just_mr_paths->root); } - builder.SetHashType(is_compatible ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native); + builder.SetHashType(is_compatible ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1); // As just-mr does not require the TargetCache, we do not need to set any of // the remote execution fields for the backend description. diff --git a/src/other_tools/repo_map/repos_to_setup_map.cpp b/src/other_tools/repo_map/repos_to_setup_map.cpp index 5bcfd717..cb6a0149 100644 --- a/src/other_tools/repo_map/repos_to_setup_map.cpp +++ b/src/other_tools/repo_map/repos_to_setup_map.cpp @@ -592,8 +592,8 @@ void DistdirCheckout(ExpressionPtr const& repo_desc, } // get hash of distdir content auto distdir_content_id = - HashFunction{HashFunction::JustHash::Native} - .ComputeBlobHash(nlohmann::json(*distdir_content_for_id).dump()) + HashFunction{HashFunction::Type::GitSHA1} + .HashBlobData(nlohmann::json(*distdir_content_for_id).dump()) .HexString(); // get the WS root as git tree DistdirInfo distdir_info = { diff --git a/test/buildtool/build_engine/target_map/target_map.test.cpp b/test/buildtool/build_engine/target_map/target_map.test.cpp index c64bb306..18927cf4 100644 --- a/test/buildtool/build_engine/target_map/target_map.test.cpp +++ b/test/buildtool/build_engine/target_map/target_map.test.cpp @@ -960,15 +960,13 @@ TEST_CASE("built-in rules", "[target_map]") { CHECK(!error); CHECK(error_msg == "NONE"); CHECK(bar_result->Artifacts()->ToJson()["foo.txt."]["type"] == "KNOWN"); - CHECK(bar_result->Artifacts()->ToJson()["foo.txt."]["data"]["id"] == - storage_config.Get() - .hash_function.ComputeBlobHash("bar") - .HexString()); + CHECK( + bar_result->Artifacts()->ToJson()["foo.txt."]["data"]["id"] == + storage_config.Get().hash_function.HashBlobData("bar").HexString()); CHECK(baz_result->Artifacts()->ToJson()["foo.txt."]["type"] == "KNOWN"); - CHECK(baz_result->Artifacts()->ToJson()["foo.txt."]["data"]["id"] == - storage_config.Get() - .hash_function.ComputeBlobHash("baz") - .HexString()); + CHECK( + baz_result->Artifacts()->ToJson()["foo.txt."]["data"]["id"] == + storage_config.Get().hash_function.HashBlobData("baz").HexString()); } } diff --git a/test/buildtool/crypto/hash_function.test.cpp b/test/buildtool/crypto/hash_function.test.cpp index 209f16a6..61c92eb9 100644 --- a/test/buildtool/crypto/hash_function.test.cpp +++ b/test/buildtool/crypto/hash_function.test.cpp @@ -21,17 +21,17 @@ TEST_CASE("Hash Function", "[crypto]") { std::string bytes{"test"}; - SECTION("Native") { - HashFunction const hash_function{HashFunction::JustHash::Native}; + SECTION("GitSHA1") { + HashFunction const hash_function{HashFunction::Type::GitSHA1}; // same as: echo -n test | sha1sum - CHECK(hash_function.ComputeHash(bytes).HexString() == + CHECK(hash_function.PlainHashData(bytes).HexString() == "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3"); // same as: echo -n test | git hash-object --stdin - CHECK(hash_function.ComputeBlobHash(bytes).HexString() == + CHECK(hash_function.HashBlobData(bytes).HexString() == "30d74d258442c7c65512eafab474568dd706c430"); // same as: echo -n test | git hash-object -t "tree" --stdin --literally - CHECK(hash_function.ComputeTreeHash(bytes).HexString() == + CHECK(hash_function.HashTreeData(bytes).HexString() == "5f0ecc1a989593005e80f457446133250fcc43cc"); auto hasher = hash_function.MakeHasher(); @@ -40,18 +40,18 @@ TEST_CASE("Hash Function", "[crypto]") { "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3"); } - SECTION("Compatible") { - HashFunction const hash_function{HashFunction::JustHash::Compatible}; + SECTION("PlainSHA256") { + HashFunction const hash_function{HashFunction::Type::PlainSHA256}; // all same as: echo -n test | sha256sum CHECK( - hash_function.ComputeHash(bytes).HexString() == + hash_function.PlainHashData(bytes).HexString() == "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"); CHECK( - hash_function.ComputeBlobHash(bytes).HexString() == + hash_function.HashBlobData(bytes).HexString() == "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"); CHECK( - hash_function.ComputeTreeHash(bytes).HexString() == + hash_function.HashTreeData(bytes).HexString() == "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"); auto hasher = hash_function.MakeHasher(); diff --git a/test/buildtool/execution_api/bazel/bazel_api.test.cpp b/test/buildtool/execution_api/bazel/bazel_api.test.cpp index 42d4880e..3ebee8d2 100644 --- a/test/buildtool/execution_api/bazel/bazel_api.test.cpp +++ b/test/buildtool/execution_api/bazel/bazel_api.test.cpp @@ -64,8 +64,8 @@ TEST_CASE("BazelAPI: No input, no output", "[execution_api]") { REQUIRE(auth); HashFunction const hash_function{Compatibility::IsCompatible() - ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native}; + ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1}; FactoryApi api_factory{ &*remote_config->remote_address, &*auth, hash_function}; @@ -80,8 +80,8 @@ TEST_CASE("BazelAPI: No input, create output", "[execution_api]") { REQUIRE(auth); HashFunction const hash_function{Compatibility::IsCompatible() - ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native}; + ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1}; FactoryApi api_factory{ &*remote_config->remote_address, &*auth, hash_function}; @@ -96,8 +96,8 @@ TEST_CASE("BazelAPI: One input copied to output", "[execution_api]") { REQUIRE(auth); HashFunction const hash_function{Compatibility::IsCompatible() - ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native}; + ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1}; FactoryApi api_factory{ &*remote_config->remote_address, &*auth, hash_function}; @@ -112,8 +112,8 @@ TEST_CASE("BazelAPI: Non-zero exit code, create output", "[execution_api]") { REQUIRE(auth); HashFunction const hash_function{Compatibility::IsCompatible() - ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native}; + ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1}; FactoryApi api_factory{ &*remote_config->remote_address, &*auth, hash_function}; @@ -129,8 +129,8 @@ TEST_CASE("BazelAPI: Retrieve two identical trees to path", "[execution_api]") { REQUIRE(auth); HashFunction const hash_function{Compatibility::IsCompatible() - ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native}; + ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1}; FactoryApi api_factory{ &*remote_config->remote_address, &*auth, hash_function}; @@ -147,8 +147,8 @@ TEST_CASE("BazelAPI: Retrieve file and symlink with same content to path", REQUIRE(auth); HashFunction const hash_function{Compatibility::IsCompatible() - ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native}; + ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1}; FactoryApi api_factory{ &*remote_config->remote_address, &*auth, hash_function}; @@ -164,8 +164,8 @@ TEST_CASE("BazelAPI: Retrieve mixed blobs and trees", "[execution_api]") { REQUIRE(auth); HashFunction const hash_function{Compatibility::IsCompatible() - ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native}; + ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1}; FactoryApi api_factory{ &*remote_config->remote_address, &*auth, hash_function}; @@ -181,8 +181,8 @@ TEST_CASE("BazelAPI: Create directory prior to execution", "[execution_api]") { REQUIRE(auth); HashFunction const hash_function{Compatibility::IsCompatible() - ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native}; + ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1}; FactoryApi api_factory{ &*remote_config->remote_address, &*auth, hash_function}; diff --git a/test/buildtool/execution_api/bazel/bazel_cas_client.test.cpp b/test/buildtool/execution_api/bazel/bazel_cas_client.test.cpp index 86cee26a..103c7be3 100644 --- a/test/buildtool/execution_api/bazel/bazel_cas_client.test.cpp +++ b/test/buildtool/execution_api/bazel/bazel_cas_client.test.cpp @@ -48,9 +48,9 @@ TEST_CASE("Bazel internals: CAS Client", "[execution_api]") { SECTION("Valid digest and blob") { // digest of "test" - HashFunction const hash_function{ - Compatibility::IsCompatible() ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native}; + HashFunction const hash_function{Compatibility::IsCompatible() + ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1}; auto digest = ArtifactDigest::Create<ObjectType::File>(hash_function, content); diff --git a/test/buildtool/execution_api/bazel/bazel_execution_client.test.cpp b/test/buildtool/execution_api/bazel/bazel_execution_client.test.cpp index 87bf48cd..d569f884 100644 --- a/test/buildtool/execution_api/bazel/bazel_execution_client.test.cpp +++ b/test/buildtool/execution_api/bazel/bazel_execution_client.test.cpp @@ -31,8 +31,8 @@ TEST_CASE("Bazel internals: Execution Client", "[execution_api]") { std::string content("test"); HashFunction const hash_function{Compatibility::IsCompatible() - ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native}; + ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1}; auto test_digest = static_cast<bazel_re::Digest>( ArtifactDigest::Create<ObjectType::File>(hash_function, content)); @@ -115,8 +115,8 @@ TEST_CASE("Bazel internals: Execution Client using env variables", std::string content("contents of env variable"); HashFunction const hash_function{Compatibility::IsCompatible() - ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native}; + ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1}; auto test_digest = static_cast<bazel_re::Digest>( ArtifactDigest::Create<ObjectType::File>(hash_function, content)); diff --git a/test/buildtool/execution_api/bazel/bazel_msg_factory.test.cpp b/test/buildtool/execution_api/bazel/bazel_msg_factory.test.cpp index 849f4485..fa6c3d4d 100644 --- a/test/buildtool/execution_api/bazel/bazel_msg_factory.test.cpp +++ b/test/buildtool/execution_api/bazel/bazel_msg_factory.test.cpp @@ -38,8 +38,8 @@ TEST_CASE("Bazel internals: MessageFactory", "[execution_api]") { REQUIRE(FileSystemManager::CreateSymlink("file1", link)); HashFunction const hash_function{Compatibility::IsCompatible() - ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native}; + ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1}; // create the corresponding blobs auto file1_blob = CreateBlobFromPath(file1, hash_function); diff --git a/test/buildtool/execution_api/bazel/bazel_network.test.cpp b/test/buildtool/execution_api/bazel/bazel_network.test.cpp index 7dfd0ffa..1103c52b 100644 --- a/test/buildtool/execution_api/bazel/bazel_network.test.cpp +++ b/test/buildtool/execution_api/bazel/bazel_network.test.cpp @@ -46,8 +46,8 @@ TEST_CASE("Bazel network: write/read blobs", "[execution_api]") { RetryConfig retry_config{}; // default retry config HashFunction const hash_function{Compatibility::IsCompatible() - ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native}; + ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1}; auto network = BazelNetwork{instance_name, remote_config->remote_address->host, @@ -113,8 +113,8 @@ TEST_CASE("Bazel network: read blobs with unknown size", "[execution_api]") { RetryConfig retry_config{}; // default retry config HashFunction const hash_function{Compatibility::IsCompatible() - ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native}; + ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1}; auto network = BazelNetwork{instance_name, remote_config->remote_address->host, diff --git a/test/buildtool/execution_api/bazel/bytestream_client.test.cpp b/test/buildtool/execution_api/bazel/bytestream_client.test.cpp index aa08cc7f..dbf965dd 100644 --- a/test/buildtool/execution_api/bazel/bytestream_client.test.cpp +++ b/test/buildtool/execution_api/bazel/bytestream_client.test.cpp @@ -45,8 +45,8 @@ TEST_CASE("ByteStream Client: Transfer single blob", "[execution_api]") { auto uuid = CreateUUIDVersion4(*CreateProcessUniqueId()); HashFunction const hash_function{Compatibility::IsCompatible() - ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native}; + ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1}; SECTION("Upload small blob") { std::string instance_name{"remote-execution"}; @@ -135,8 +135,8 @@ TEST_CASE("ByteStream Client: Transfer multiple blobs", "[execution_api]") { auto uuid = CreateUUIDVersion4(*CreateProcessUniqueId()); HashFunction const hash_function{Compatibility::IsCompatible() - ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native}; + ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1}; SECTION("Upload small blobs") { std::string instance_name{"remote-execution"}; diff --git a/test/buildtool/execution_api/common/api_test.hpp b/test/buildtool/execution_api/common/api_test.hpp index 81a11364..6d8e7928 100644 --- a/test/buildtool/execution_api/common/api_test.hpp +++ b/test/buildtool/execution_api/common/api_test.hpp @@ -132,8 +132,8 @@ using ExecProps = std::map<std::string, std::string>; std::string test_content("test"); HashFunction const hash_function{Compatibility::IsCompatible() - ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native}; + ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1}; auto test_digest = ArtifactDigest::Create<ObjectType::File>(hash_function, test_content); @@ -215,8 +215,8 @@ using ExecProps = std::map<std::string, std::string>; std::string test_content("test"); HashFunction const hash_function{Compatibility::IsCompatible() - ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native}; + ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1}; auto test_digest = ArtifactDigest::Create<ObjectType::File>(hash_function, test_content); @@ -305,8 +305,8 @@ using ExecProps = std::map<std::string, std::string>; std::string test_content("test"); HashFunction const hash_function{Compatibility::IsCompatible() - ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native}; + ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1}; auto test_digest = ArtifactDigest::Create<ObjectType::File>(hash_function, test_content); diff --git a/test/buildtool/execution_engine/executor/executor.test.cpp b/test/buildtool/execution_engine/executor/executor.test.cpp index 6a71f497..dcdfd2dd 100644 --- a/test/buildtool/execution_engine/executor/executor.test.cpp +++ b/test/buildtool/execution_engine/executor/executor.test.cpp @@ -273,8 +273,8 @@ TEST_CASE("Executor: Process artifact", "[executor]") { auto [config, repo_config] = CreateTest(&g, workspace_path); HashFunction const hash_function{Compatibility::IsCompatible() - ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native}; + ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1}; auto const local_cpp_id = ArtifactDescription::CreateLocal("local.cpp", "").Id(); @@ -360,8 +360,8 @@ TEST_CASE("Executor: Process action", "[executor]") { auto [config, repo_config] = CreateTest(&g, workspace_path); HashFunction const hash_function{Compatibility::IsCompatible() - ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native}; + ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1}; auto const local_cpp_id = ArtifactDescription::CreateLocal("local.cpp", "").Id(); diff --git a/test/buildtool/execution_engine/executor/executor_api.test.hpp b/test/buildtool/execution_engine/executor/executor_api.test.hpp index 4990e805..e49ab4c4 100644 --- a/test/buildtool/execution_engine/executor/executor_api.test.hpp +++ b/test/buildtool/execution_engine/executor/executor_api.test.hpp @@ -53,12 +53,12 @@ static inline void RunBlobUpload(RepositoryConfig* repo_config, SetupConfig(repo_config); auto api = factory(); HashFunction const hash_function{Compatibility::IsCompatible() - ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native}; + ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1}; std::string const blob = "test"; CHECK(api->Upload(ArtifactBlobContainer{{ArtifactBlob{ - ArtifactDigest{hash_function.ComputeBlobHash(blob).HexString(), + ArtifactDigest{hash_function.HashBlobData(blob).HexString(), blob.size(), /*is_tree=*/false}, blob, @@ -139,8 +139,8 @@ static inline void RunHelloWorldCompilation( RetryConfig retry_config{}; // default retry config HashFunction const hash_function{Compatibility::IsCompatible() - ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native}; + ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1}; auto api = factory(); Executor runner{repo_config, @@ -273,8 +273,8 @@ static inline void RunGreeterCompilation( RetryConfig retry_config{}; // default retry config HashFunction const hash_function{Compatibility::IsCompatible() - ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native}; + ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1}; auto api = factory(); Executor runner{repo_config, @@ -416,17 +416,17 @@ static inline void TestUploadAndDownloadTrees( } HashFunction const hash_function{Compatibility::IsCompatible() - ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native}; + ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1}; auto foo = std::string{"foo"}; auto bar = std::string{"bar"}; auto foo_digest = - ArtifactDigest{hash_function.ComputeBlobHash(foo).HexString(), + ArtifactDigest{hash_function.HashBlobData(foo).HexString(), foo.size(), /*is_tree=*/false}; auto bar_digest = - ArtifactDigest{hash_function.ComputeBlobHash(bar).HexString(), + ArtifactDigest{hash_function.HashBlobData(bar).HexString(), bar.size(), /*is_tree=*/false}; @@ -575,8 +575,8 @@ static inline void TestRetrieveOutputDirectories( auto tmpdir = GetTestDir(); HashFunction const hash_function{Compatibility::IsCompatible() - ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native}; + ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1}; auto const make_tree_id = std::string{"make_tree"}; auto const* make_tree_cmd = diff --git a/test/buildtool/execution_engine/executor/executor_api_remote_bazel.test.cpp b/test/buildtool/execution_engine/executor/executor_api_remote_bazel.test.cpp index f97de299..0e068ea9 100644 --- a/test/buildtool/execution_engine/executor/executor_api_remote_bazel.test.cpp +++ b/test/buildtool/execution_engine/executor/executor_api_remote_bazel.test.cpp @@ -42,8 +42,8 @@ TEST_CASE("Executor<BazelApi>: Upload blob", "[executor]") { RetryConfig retry_config{}; // default retry config HashFunction const hash_function{Compatibility::IsCompatible() - ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native}; + ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1}; TestBlobUpload(&repo_config, [&] { return BazelApi::Ptr{new BazelApi{"remote-execution", @@ -73,8 +73,8 @@ TEST_CASE("Executor<BazelApi>: Compile hello world", "[executor]") { RetryConfig retry_config{}; // default retry config HashFunction const hash_function{Compatibility::IsCompatible() - ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native}; + ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1}; TestHelloWorldCompilation( &repo_config, @@ -111,8 +111,8 @@ TEST_CASE("Executor<BazelApi>: Compile greeter", "[executor]") { RetryConfig retry_config{}; // default retry config HashFunction const hash_function{Compatibility::IsCompatible() - ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native}; + ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1}; TestGreeterCompilation( &repo_config, @@ -149,8 +149,8 @@ TEST_CASE("Executor<BazelApi>: Upload and download trees", "[executor]") { RetryConfig retry_config{}; // default retry config HashFunction const hash_function{Compatibility::IsCompatible() - ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native}; + ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1}; TestUploadAndDownloadTrees( &repo_config, @@ -187,8 +187,8 @@ TEST_CASE("Executor<BazelApi>: Retrieve output directories", "[executor]") { RetryConfig retry_config{}; // default retry config HashFunction const hash_function{Compatibility::IsCompatible() - ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native}; + ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1}; TestRetrieveOutputDirectories( &repo_config, diff --git a/test/buildtool/graph_traverser/graph_traverser_remote.test.cpp b/test/buildtool/graph_traverser/graph_traverser_remote.test.cpp index fa8202ce..d92b9ef9 100644 --- a/test/buildtool/graph_traverser/graph_traverser_remote.test.cpp +++ b/test/buildtool/graph_traverser/graph_traverser_remote.test.cpp @@ -35,8 +35,8 @@ StorageConfig::Builder builder; auto config = builder.SetBuildRoot(cache_dir) .SetHashType(Compatibility::IsCompatible() - ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native) + ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1) .SetRemoteExecutionArgs(remote_config.remote_address, remote_config.platform_properties, remote_config.dispatch) diff --git a/test/utils/hermeticity/test_storage_config.hpp b/test/utils/hermeticity/test_storage_config.hpp index 26dc53df..4bcbc1be 100644 --- a/test/utils/hermeticity/test_storage_config.hpp +++ b/test/utils/hermeticity/test_storage_config.hpp @@ -54,8 +54,8 @@ class TestStorageConfig final { StorageConfig::Builder builder; auto config = builder.SetBuildRoot(temp_dir->GetPath()) .SetHashType(Compatibility::IsCompatible() - ? HashFunction::JustHash::Compatible - : HashFunction::JustHash::Native) + ? HashFunction::Type::PlainSHA256 + : HashFunction::Type::GitSHA1) .Build(); if (not config) { Logger::Log(LogLevel::Error, config.error()); |