From 59677e140ed064813660641d8e841e0fcc4af0ea Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Wed, 14 Jun 2023 16:53:33 +0200 Subject: Allow non-upwards symlinks with local API --- .../execution_api/local/local_response.hpp | 29 ++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'src/buildtool/execution_api/local/local_response.hpp') diff --git a/src/buildtool/execution_api/local/local_response.hpp b/src/buildtool/execution_api/local/local_response.hpp index 135897d8..8e6cb04f 100644 --- a/src/buildtool/execution_api/local/local_response.hpp +++ b/src/buildtool/execution_api/local/local_response.hpp @@ -105,8 +105,7 @@ class LocalResponse final : public IExecutionResponse { action_result.output_file_symlinks_size()) + static_cast( action_result.output_directory_symlinks_size()) + - static_cast( - action_result.output_directories().size())); + static_cast(action_result.output_directories_size())); DirSymlinks dir_symlinks{}; dir_symlinks_.reserve(static_cast( @@ -153,6 +152,32 @@ 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( + 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( + link.target()), + .type = ObjectType::Symlink}); + } catch (...) { + return false; + } + } + // collect directories and store them for (auto const& dir : action_result.output_directories()) { try { -- cgit v1.2.3