summaryrefslogtreecommitdiff
path: root/src/buildtool/execution_api
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildtool/execution_api')
-rw-r--r--src/buildtool/execution_api/local/local_action.cpp21
-rw-r--r--src/buildtool/execution_api/local/local_action.hpp10
2 files changed, 18 insertions, 13 deletions
diff --git a/src/buildtool/execution_api/local/local_action.cpp b/src/buildtool/execution_api/local/local_action.cpp
index badc62e5..1d964533 100644
--- a/src/buildtool/execution_api/local/local_action.cpp
+++ b/src/buildtool/execution_api/local/local_action.cpp
@@ -176,8 +176,13 @@ auto LocalAction::Run(bazel_re::Digest const& action_id) const noexcept
return std::nullopt;
}
-auto LocalAction::StageFile(std::filesystem::path const& target_path,
- Artifact::ObjectInfo const& info) const -> bool {
+auto LocalAction::StageInput(std::filesystem::path const& target_path,
+ Artifact::ObjectInfo const& info) const noexcept
+ -> bool {
+ if (IsTreeObject(info.type)) {
+ return FileSystemManager::CreateDirectory(target_path);
+ }
+
auto blob_path =
storage_->CAS().BlobPath(info.digest, IsExecutableObject(info.type));
@@ -204,19 +209,19 @@ auto LocalAction::StageFile(std::filesystem::path const& target_path,
FileSystemManager::CreateFileHardlink(*blob_path, target_path);
}
-auto LocalAction::StageInputFiles(
+auto LocalAction::StageInputs(
std::filesystem::path const& exec_path) const noexcept -> bool {
if (FileSystemManager::IsRelativePath(exec_path)) {
return false;
}
- auto infos =
- storage_->CAS().RecursivelyReadTreeLeafs(root_digest_, exec_path);
+ auto infos = storage_->CAS().RecursivelyReadTreeLeafs(
+ root_digest_, exec_path, /*include_trees=*/true);
if (not infos) {
return false;
}
for (std::size_t i{}; i < infos->first.size(); ++i) {
- if (not StageFile(infos->first.at(i), infos->second.at(i))) {
+ if (not StageInput(infos->first.at(i), infos->second.at(i))) {
return false;
}
}
@@ -237,8 +242,8 @@ auto LocalAction::CreateDirectoryStructure(
return false;
}
- // stage input files to execution directory
- if (not StageInputFiles(exec_path)) {
+ // stage inputs (files, leaf trees) to execution directory
+ if (not StageInputs(exec_path)) {
logger_.Emit(LogLevel::Error,
"failed to stage input files to exec_path");
return false;
diff --git a/src/buildtool/execution_api/local/local_action.hpp b/src/buildtool/execution_api/local/local_action.hpp
index 82101016..c4d9ecd1 100644
--- a/src/buildtool/execution_api/local/local_action.hpp
+++ b/src/buildtool/execution_api/local/local_action.hpp
@@ -101,16 +101,16 @@ class LocalAction final : public IExecutionAction {
[[nodiscard]] auto Run(bazel_re::Digest const& action_id) const noexcept
-> std::optional<Output>;
- [[nodiscard]] auto StageFile(std::filesystem::path const& target_path,
- Artifact::ObjectInfo const& info) const
- -> bool;
+ [[nodiscard]] auto StageInput(
+ std::filesystem::path const& target_path,
+ Artifact::ObjectInfo const& info) const noexcept -> bool;
- /// \brief Stage input artifacts to the execution directory.
+ /// \brief Stage input artifacts and leaf trees to the execution directory.
/// Stage artifacts and their parent directory structure from CAS to the
/// specified execution directory. The execution directory may no exist.
/// \param[in] exec_path Absolute path to the execution directory.
/// \returns Success indicator.
- [[nodiscard]] auto StageInputFiles(
+ [[nodiscard]] auto StageInputs(
std::filesystem::path const& exec_path) const noexcept -> bool;
[[nodiscard]] auto CreateDirectoryStructure(