diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2024-05-28 11:24:46 +0200 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2024-05-28 16:19:19 +0200 |
commit | a8cbdab9f795999cf99458e63343e13322402739 (patch) | |
tree | ccf96478f88c285e0b327d748b5845f3340f057d /src/buildtool/execution_api/bazel_msg/bazel_blob.hpp | |
parent | 1b6d17b9dad596fea334f9b4b662e0708c495453 (diff) | |
download | justbuild-a8cbdab9f795999cf99458e63343e13322402739.tar.gz |
Move CreateBlobFromPath since it is only used in tests.
Diffstat (limited to 'src/buildtool/execution_api/bazel_msg/bazel_blob.hpp')
-rw-r--r-- | src/buildtool/execution_api/bazel_msg/bazel_blob.hpp | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/src/buildtool/execution_api/bazel_msg/bazel_blob.hpp b/src/buildtool/execution_api/bazel_msg/bazel_blob.hpp index 75ceb97f..75f174b5 100644 --- a/src/buildtool/execution_api/bazel_msg/bazel_blob.hpp +++ b/src/buildtool/execution_api/bazel_msg/bazel_blob.hpp @@ -15,15 +15,10 @@ #ifndef INCLUDED_SRC_BUILDTOOL_EXECUTION_API_BAZEL_MSG_BAZEL_BLOB_HPP #define INCLUDED_SRC_BUILDTOOL_EXECUTION_API_BAZEL_MSG_BAZEL_BLOB_HPP -#include <filesystem> -#include <memory> -#include <optional> #include <string> #include <utility> // std::move -#include "src/buildtool/common/artifact_digest.hpp" #include "src/buildtool/common/bazel_types.hpp" -#include "src/buildtool/file_system/file_system_manager.hpp" struct BazelBlob { BazelBlob(bazel_re::Digest mydigest, std::string mydata, bool is_exec) @@ -36,21 +31,4 @@ struct BazelBlob { bool is_exec{}; // optional: hint to put the blob in executable CAS }; -/// \brief Create a blob from the content found in file or symlink pointed to by -/// given path. -[[nodiscard]] static inline auto CreateBlobFromPath( - std::filesystem::path const& fpath) noexcept -> std::optional<BazelBlob> { - auto const type = FileSystemManager::Type(fpath, /*allow_upwards=*/true); - if (not type) { - return std::nullopt; - } - auto const content = FileSystemManager::ReadContentAtPath(fpath, *type); - if (not content.has_value()) { - return std::nullopt; - } - return BazelBlob{ArtifactDigest::Create<ObjectType::File>(*content), - *content, - IsExecutableObject(*type)}; -} - #endif // INCLUDED_SRC_BUILDTOOL_EXECUTION_API_BAZEL_MSG_BAZEL_BLOB_HPP |