diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2025-02-25 10:30:41 +0100 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2025-02-27 09:03:30 +0100 |
commit | e1880bead60d433de2960104bd62cd9e27bfca17 (patch) | |
tree | 61ff400e1231ede42013d1a93335362eb2f2b750 /src/buildtool/execution_api/common | |
parent | 322218e6f0029a7cd6fd90d551217e71d8339998 (diff) | |
download | justbuild-e1880bead60d433de2960104bd62cd9e27bfca17.tar.gz |
ArtifactBlob: Move from execution_api/common to common
Diffstat (limited to 'src/buildtool/execution_api/common')
-rw-r--r-- | src/buildtool/execution_api/common/TARGETS | 20 | ||||
-rw-r--r-- | src/buildtool/execution_api/common/artifact_blob.hpp | 58 | ||||
-rw-r--r-- | src/buildtool/execution_api/common/blob_tree.hpp | 2 | ||||
-rw-r--r-- | src/buildtool/execution_api/common/common_api.hpp | 2 | ||||
-rw-r--r-- | src/buildtool/execution_api/common/execution_api.hpp | 2 |
5 files changed, 9 insertions, 75 deletions
diff --git a/src/buildtool/execution_api/common/TARGETS b/src/buildtool/execution_api/common/TARGETS index f7258cb6..6eeb3931 100644 --- a/src/buildtool/execution_api/common/TARGETS +++ b/src/buildtool/execution_api/common/TARGETS @@ -11,10 +11,10 @@ ] , "srcs": ["tree_reader_utils.cpp"] , "deps": - [ "artifact_blob" - , ["@", "fmt", "", "fmt"] + [ ["@", "fmt", "", "fmt"] , ["@", "gsl", "", "gsl"] , ["@", "protoc", "", "libprotobuf"] + , ["src/buildtool/common", "artifact_blob"] , ["src/buildtool/common", "bazel_types"] , ["src/buildtool/common", "common"] , ["src/buildtool/crypto", "hash_function"] @@ -104,10 +104,10 @@ , "hdrs": ["common_api.hpp"] , "srcs": ["common_api.cpp"] , "deps": - [ "artifact_blob" - , "blob_tree" + [ "blob_tree" , "common" , ["@", "gsl", "", "gsl"] + , ["src/buildtool/common", "artifact_blob"] , ["src/buildtool/common", "common"] , ["src/buildtool/execution_api/bazel_msg", "bazel_msg_factory"] , ["src/buildtool/execution_api/bazel_msg", "directory_tree"] @@ -128,8 +128,8 @@ , "hdrs": ["blob_tree.hpp"] , "srcs": ["blob_tree.cpp"] , "deps": - [ "artifact_blob" - , ["@", "gsl", "", "gsl"] + [ ["@", "gsl", "", "gsl"] + , ["src/buildtool/common", "artifact_blob"] , ["src/buildtool/execution_api/bazel_msg", "directory_tree"] ] , "private-deps": @@ -143,12 +143,4 @@ ] , "stage": ["src", "buildtool", "execution_api", "common"] } -, "artifact_blob": - { "type": ["@", "rules", "CC", "library"] - , "name": ["artifact_blob"] - , "hdrs": ["artifact_blob.hpp"] - , "deps": - [["src/buildtool/common", "common"], ["src/utils/cpp", "hash_combine"]] - , "stage": ["src", "buildtool", "execution_api", "common"] - } } diff --git a/src/buildtool/execution_api/common/artifact_blob.hpp b/src/buildtool/execution_api/common/artifact_blob.hpp deleted file mode 100644 index c54ac2fe..00000000 --- a/src/buildtool/execution_api/common/artifact_blob.hpp +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2024 Huawei Cloud Computing Technology Co., Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef INCLUDED_SRC_BUILDTOOL_EXECUTION_API_COMMON_ARTIFACT_BLOB_HPP -#define INCLUDED_SRC_BUILDTOOL_EXECUTION_API_COMMON_ARTIFACT_BLOB_HPP - -#include <cstddef> -#include <functional> -#include <memory> -#include <string> -#include <utility> //std::move - -#include "src/buildtool/common/artifact_digest.hpp" -#include "src/utils/cpp/hash_combine.hpp" - -struct ArtifactBlob final { - ArtifactBlob(ArtifactDigest digest, - std::string mydata, - bool is_exec) noexcept - : digest{std::move(digest)}, - data{std::make_shared<std::string>(std::move(mydata))}, - is_exec{is_exec} {} - - [[nodiscard]] auto operator==(ArtifactBlob const& other) const noexcept - -> bool { - return digest == other.digest and is_exec == other.is_exec; - } - - ArtifactDigest digest; - std::shared_ptr<std::string> data; - bool is_exec = false; -}; - -namespace std { -template <> -struct hash<ArtifactBlob> { - [[nodiscard]] auto operator()(ArtifactBlob const& blob) const noexcept - -> std::size_t { - std::size_t seed{}; - hash_combine(&seed, blob.digest); - hash_combine(&seed, blob.is_exec); - return seed; - } -}; -} // namespace std - -#endif // INCLUDED_SRC_BUILDTOOL_EXECUTION_API_COMMON_ARTIFACT_BLOB_HPP diff --git a/src/buildtool/execution_api/common/blob_tree.hpp b/src/buildtool/execution_api/common/blob_tree.hpp index d8fc7c1d..47b3c3ae 100644 --- a/src/buildtool/execution_api/common/blob_tree.hpp +++ b/src/buildtool/execution_api/common/blob_tree.hpp @@ -22,9 +22,9 @@ #include <vector> #include "gsl/gsl" +#include "src/buildtool/common/artifact_blob.hpp" #include "src/buildtool/common/artifact_digest.hpp" #include "src/buildtool/execution_api/bazel_msg/directory_tree.hpp" -#include "src/buildtool/execution_api/common/artifact_blob.hpp" class BlobTree; using BlobTreePtr = gsl::not_null<std::shared_ptr<BlobTree>>; diff --git a/src/buildtool/execution_api/common/common_api.hpp b/src/buildtool/execution_api/common/common_api.hpp index dfd16b1d..0071c1e1 100644 --- a/src/buildtool/execution_api/common/common_api.hpp +++ b/src/buildtool/execution_api/common/common_api.hpp @@ -23,10 +23,10 @@ #include "gsl/gsl" #include "src/buildtool/common/artifact.hpp" +#include "src/buildtool/common/artifact_blob.hpp" #include "src/buildtool/common/artifact_digest.hpp" #include "src/buildtool/execution_api/bazel_msg/bazel_msg_factory.hpp" #include "src/buildtool/execution_api/bazel_msg/directory_tree.hpp" -#include "src/buildtool/execution_api/common/artifact_blob.hpp" #include "src/buildtool/execution_api/common/blob_tree.hpp" #include "src/buildtool/execution_api/common/execution_api.hpp" #include "src/buildtool/logging/logger.hpp" diff --git a/src/buildtool/execution_api/common/execution_api.hpp b/src/buildtool/execution_api/common/execution_api.hpp index c8415764..43a7e581 100644 --- a/src/buildtool/execution_api/common/execution_api.hpp +++ b/src/buildtool/execution_api/common/execution_api.hpp @@ -25,9 +25,9 @@ #include <vector> #include "src/buildtool/common/artifact.hpp" // Artifact::ObjectInfo +#include "src/buildtool/common/artifact_blob.hpp" #include "src/buildtool/common/artifact_digest.hpp" #include "src/buildtool/crypto/hash_function.hpp" -#include "src/buildtool/execution_api/common/artifact_blob.hpp" #include "src/buildtool/execution_api/common/execution_action.hpp" #include "src/buildtool/execution_engine/dag/dag.hpp" |