From 7012f6c0762cf11e7b1c22304f8fb0b3b330cd0a Mon Sep 17 00:00:00 2001 From: Maksim Denisov Date: Thu, 1 Aug 2024 10:40:30 +0200 Subject: Remove code duplication in Populate method in responses. --- .../execution_api/local/local_response.hpp | 26 ---------------------- .../execution_api/remote/bazel/bazel_response.cpp | 26 ---------------------- 2 files changed, 52 deletions(-) (limited to 'src') diff --git a/src/buildtool/execution_api/local/local_response.hpp b/src/buildtool/execution_api/local/local_response.hpp index d0ad27bd..4871097a 100644 --- a/src/buildtool/execution_api/local/local_response.hpp +++ b/src/buildtool/execution_api/local/local_response.hpp @@ -160,32 +160,6 @@ class LocalResponse final : public IExecutionResponse { } } - // collect all symlinks and store them - for (auto const& link : action_result.output_file_symlinks()) { - try { - artifacts.emplace( - link.path(), - Artifact::ObjectInfo{ - .digest = ArtifactDigest::Create( - storage_.GetHashFunction(), link.target()), - .type = ObjectType::Symlink}); - } catch (...) { - return false; - } - } - for (auto const& link : action_result.output_directory_symlinks()) { - try { - artifacts.emplace( - link.path(), - Artifact::ObjectInfo{ - .digest = ArtifactDigest::Create( - storage_.GetHashFunction(), link.target()), - .type = ObjectType::Symlink}); - } catch (...) { - return false; - } - } - // collect directories and store them for (auto const& dir : action_result.output_directories()) { try { diff --git a/src/buildtool/execution_api/remote/bazel/bazel_response.cpp b/src/buildtool/execution_api/remote/bazel/bazel_response.cpp index 7db88a08..ae9f00e3 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_response.cpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_response.cpp @@ -122,32 +122,6 @@ auto BazelResponse::Populate() noexcept -> bool { } } - // collect all symlinks and store them - for (auto const& link : action_result.output_file_symlinks()) { - try { - artifacts.emplace( - link.path(), - Artifact::ObjectInfo{ - .digest = ArtifactDigest::Create( - network_->GetHashFunction(), link.target()), - .type = ObjectType::Symlink}); - } catch (...) { - return false; - } - } - for (auto const& link : action_result.output_directory_symlinks()) { - try { - artifacts.emplace( - link.path(), - Artifact::ObjectInfo{ - .digest = ArtifactDigest::Create( - network_->GetHashFunction(), link.target()), - .type = ObjectType::Symlink}); - } catch (...) { - return false; - } - } - if (not Compatibility::IsCompatible()) { // in native mode: just collect and store tree digests for (auto const& tree : action_result.output_directories()) { -- cgit v1.2.3