diff options
Diffstat (limited to 'src/buildtool/execution_api')
5 files changed, 44 insertions, 35 deletions
diff --git a/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp b/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp index 5f392483..ba52443b 100644 --- a/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp +++ b/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp @@ -349,15 +349,16 @@ template <class T> [[nodiscard]] auto CreateObjectInfo(bazel_re::DirectoryNode const& node) -> Artifact::ObjectInfo { - return Artifact::ObjectInfo{ArtifactDigest{node.digest()}, - ObjectType::Tree}; + return Artifact::ObjectInfo{.digest = ArtifactDigest{node.digest()}, + .type = ObjectType::Tree}; } [[nodiscard]] auto CreateObjectInfo(bazel_re::FileNode const& node) -> Artifact::ObjectInfo { - return Artifact::ObjectInfo{ - ArtifactDigest{node.digest()}, - node.is_executable() ? ObjectType::Executable : ObjectType::File}; + return Artifact::ObjectInfo{.digest = ArtifactDigest{node.digest()}, + .type = node.is_executable() + ? ObjectType::Executable + : ObjectType::File}; } /// \brief Convert `DirectoryTree` to `DirectoryNodeBundle`. @@ -445,12 +446,13 @@ auto BazelMsgFactory::ReadObjectInfosFromGitTree( for (auto const& [raw_id, es] : entries) { auto const hex_id = ToHexString(raw_id); for (auto const& entry : es) { - if (not store_info(entry.name, - Artifact::ObjectInfo{ - ArtifactDigest{hex_id, - /*size is unknown*/ 0, - IsTreeObject(entry.type)}, - entry.type})) { + if (not store_info( + entry.name, + Artifact::ObjectInfo{ + .digest = ArtifactDigest{hex_id, + /*size is unknown*/ 0, + IsTreeObject(entry.type)}, + .type = entry.type})) { return false; } } diff --git a/src/buildtool/execution_api/git/git_api.hpp b/src/buildtool/execution_api/git/git_api.hpp index 2844d492..acbab788 100644 --- a/src/buildtool/execution_api/git/git_api.hpp +++ b/src/buildtool/execution_api/git/git_api.hpp @@ -59,10 +59,11 @@ class GitApi final : public IExecutionApi { for (auto const& [path, entry] : *tree) { if (not RetrieveToPaths( {Artifact::ObjectInfo{ - ArtifactDigest{ - entry->Hash(), /*size*/ 0, entry->IsTree()}, - entry->Type(), - false}}, + .digest = ArtifactDigest{entry->Hash(), + /*size*/ 0, + entry->IsTree()}, + .type = entry->Type(), + .failed = false}}, {output_paths[i] / path})) { return false; } @@ -111,10 +112,11 @@ class GitApi final : public IExecutionApi { for (auto const& [path, entry] : *tree) { json[path] = Artifact::ObjectInfo{ - ArtifactDigest{ - entry->Hash(), /*size*/ 0, entry->IsTree()}, - entry->Type(), - false} + .digest = + ArtifactDigest{ + entry->Hash(), /*size*/ 0, entry->IsTree()}, + .type = entry->Type(), + .failed = false} .ToString(/*size_unknown*/ true); } auto msg = json.dump(2) + "\n"; diff --git a/src/buildtool/execution_api/local/local_response.hpp b/src/buildtool/execution_api/local/local_response.hpp index 2875ec16..7faa5619 100644 --- a/src/buildtool/execution_api/local/local_response.hpp +++ b/src/buildtool/execution_api/local/local_response.hpp @@ -76,10 +76,10 @@ class LocalResponse final : public IExecutionResponse { try { artifacts.emplace( file.path(), - Artifact::ObjectInfo{ArtifactDigest{file.digest()}, - file.is_executable() - ? ObjectType::Executable - : ObjectType::File}); + Artifact::ObjectInfo{ + .digest = ArtifactDigest{file.digest()}, + .type = file.is_executable() ? ObjectType::Executable + : ObjectType::File}); } catch (...) { return {}; } @@ -90,8 +90,9 @@ class LocalResponse final : public IExecutionResponse { try { artifacts.emplace( dir.path(), - Artifact::ObjectInfo{ArtifactDigest{dir.tree_digest()}, - ObjectType::Tree}); + Artifact::ObjectInfo{ + .digest = ArtifactDigest{dir.tree_digest()}, + .type = ObjectType::Tree}); } catch (...) { return {}; } diff --git a/src/buildtool/execution_api/remote/bazel/bazel_execution_client.hpp b/src/buildtool/execution_api/remote/bazel/bazel_execution_client.hpp index a528eecb..7f683132 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_execution_client.hpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_execution_client.hpp @@ -47,8 +47,9 @@ class BazelExecutionClient { std::optional<ExecutionOutput> output{std::nullopt}; static auto MakeEmptyFailed() -> ExecutionResponse { - return ExecutionResponse{ - {}, ExecutionResponse::State::Failed, std::nullopt}; + return ExecutionResponse{.execution_handle = {}, + .state = ExecutionResponse::State::Failed, + .output = std::nullopt}; } }; diff --git a/src/buildtool/execution_api/remote/bazel/bazel_response.cpp b/src/buildtool/execution_api/remote/bazel/bazel_response.cpp index d45d9aa1..9889d8ed 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_response.cpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_response.cpp @@ -51,11 +51,12 @@ auto BazelResponse::Artifacts() const noexcept -> ArtifactInfos { // collect files and store them for (auto const& file : action_result.output_files()) { try { - artifacts.emplace(file.path(), - Artifact::ObjectInfo{ - ArtifactDigest{file.digest()}, - file.is_executable() ? ObjectType::Executable - : ObjectType::File}); + artifacts.emplace( + file.path(), + Artifact::ObjectInfo{.digest = ArtifactDigest{file.digest()}, + .type = file.is_executable() + ? ObjectType::Executable + : ObjectType::File}); } catch (...) { return {}; } @@ -68,8 +69,9 @@ auto BazelResponse::Artifacts() const noexcept -> ArtifactInfos { try { artifacts.emplace( tree.path(), - Artifact::ObjectInfo{ArtifactDigest{tree.tree_digest()}, - ObjectType::Tree}); + Artifact::ObjectInfo{ + .digest = ArtifactDigest{tree.tree_digest()}, + .type = ObjectType::Tree}); } catch (...) { return {}; } @@ -109,7 +111,8 @@ auto BazelResponse::Artifacts() const noexcept -> ArtifactInfos { } artifacts.emplace( action_result.output_directories(pos).path(), - Artifact::ObjectInfo{*root_digest, ObjectType::Tree}); + Artifact::ObjectInfo{.digest = *root_digest, + .type = ObjectType::Tree}); } catch (...) { return {}; } |