diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2025-02-14 15:16:10 +0100 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2025-02-19 17:50:30 +0100 |
commit | 8ab573ef1c624e2ed81b2032178c25451176d2f1 (patch) | |
tree | b3e41ee30eed3240bcd18502b7972903e7c2a53e /src/buildtool/main/archive.cpp | |
parent | dfa481bd5f97d92c444dc31a4a051cb890494d1d (diff) | |
download | justbuild-8ab573ef1c624e2ed81b2032178c25451176d2f1.tar.gz |
ApiBundle: Remove HashFunction.
And ensure every user obtains HashFunction from corresponding IExecutionApi
Diffstat (limited to 'src/buildtool/main/archive.cpp')
-rw-r--r-- | src/buildtool/main/archive.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/buildtool/main/archive.cpp b/src/buildtool/main/archive.cpp index 2d8c95db..017aaaeb 100644 --- a/src/buildtool/main/archive.cpp +++ b/src/buildtool/main/archive.cpp @@ -59,8 +59,7 @@ void archive_entry_cleanup(archive_entry* entry) { } } -auto add_to_archive(HashFunction::Type hash_type, - archive* archive, +auto add_to_archive(archive* archive, IExecutionApi const& api, const Artifact::ObjectInfo& artifact, const std::filesystem::path& location) -> bool { @@ -134,8 +133,11 @@ auto add_to_archive(HashFunction::Type hash_type, for (auto const& [hash, entries] : *git_tree) { auto hex_hash = ToHexString(hash); for (auto const& entry : entries) { - auto digest = ArtifactDigestFactory::Create( - hash_type, hex_hash, 0, IsTreeObject(entry.type)); + auto digest = + ArtifactDigestFactory::Create(api.GetHashType(), + hex_hash, + 0, + IsTreeObject(entry.type)); if (not digest) { return false; } @@ -146,8 +148,7 @@ auto add_to_archive(HashFunction::Type hash_type, } } for (auto const& [name, obj] : tree) { - if (not add_to_archive( - hash_type, archive, api, obj, location / name)) { + if (not add_to_archive(archive, api, obj, location / name)) { return false; } } @@ -160,7 +161,6 @@ auto add_to_archive(HashFunction::Type hash_type, } // namespace [[nodiscard]] auto GenerateArchive( - HashFunction::Type hash_type, IExecutionApi const& api, const Artifact::ObjectInfo& artifact, const std::optional<std::filesystem::path>& output_path) -> bool { @@ -204,11 +204,8 @@ auto add_to_archive(HashFunction::Type hash_type, } } - if (not add_to_archive(hash_type, - archive.get(), - api, - artifact, - std::filesystem::path{""})) { + if (not add_to_archive( + archive.get(), api, artifact, std::filesystem::path{""})) { return false; } if (output_path) { |