summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/buildtool/execution_api/common/TARGETS2
-rw-r--r--src/buildtool/execution_api/common/execution_api.cpp55
-rw-r--r--src/buildtool/execution_api/common/execution_api.hpp7
-rw-r--r--src/buildtool/execution_api/local/local_api.hpp28
4 files changed, 0 insertions, 92 deletions
diff --git a/src/buildtool/execution_api/common/TARGETS b/src/buildtool/execution_api/common/TARGETS
index 57543d7b..8b3659e6 100644
--- a/src/buildtool/execution_api/common/TARGETS
+++ b/src/buildtool/execution_api/common/TARGETS
@@ -10,7 +10,6 @@
, "stream_dumper.hpp"
, "artifact_blob_container.hpp"
]
- , "srcs": ["execution_api.cpp"]
, "deps":
[ "content_blob_container"
, ["@", "gsl", "", "gsl"]
@@ -18,7 +17,6 @@
, ["src/buildtool/crypto", "hash_function"]
, ["src/buildtool/execution_api/bazel_msg", "bazel_msg_factory"]
, ["src/buildtool/file_system", "file_system_manager"]
- , ["src/buildtool/file_system", "object_type"]
, ["src/buildtool/logging", "log_level"]
, ["src/buildtool/logging", "logging"]
, ["src/utils/cpp", "gsl"]
diff --git a/src/buildtool/execution_api/common/execution_api.cpp b/src/buildtool/execution_api/common/execution_api.cpp
deleted file mode 100644
index d3fcb36f..00000000
--- a/src/buildtool/execution_api/common/execution_api.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2023 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.
-
-#include "src/buildtool/execution_api/common/execution_api.hpp"
-
-#include "src/buildtool/file_system/file_system_manager.hpp"
-#include "src/buildtool/logging/log_level.hpp"
-#include "src/buildtool/logging/logger.hpp"
-
-[[nodiscard]] auto IExecutionApi::UploadFile(
- std::filesystem::path const& file_path,
- ObjectType type) noexcept -> bool {
- auto data = FileSystemManager::ReadFile(file_path);
- if (not data) {
- return false;
- }
- ArtifactDigest digest{};
- switch (type) {
- case ObjectType::File:
- digest = ArtifactDigest::Create<ObjectType::File>(*data);
- break;
- case ObjectType::Executable:
- digest = ArtifactDigest::Create<ObjectType::Executable>(*data);
- break;
- case ObjectType::Tree:
- digest = ArtifactDigest::Create<ObjectType::Tree>(*data);
- break;
- case ObjectType::Symlink:
- digest = ArtifactDigest::Create<ObjectType::Symlink>(*data);
- break;
- default:
- Ensures(false); // unreachable
- return false;
- }
- ArtifactBlobContainer container{};
- try {
- auto exec = IsExecutableObject(type);
- container.Emplace(ArtifactBlob{digest, *data, exec});
- } catch (std::exception const& ex) {
- Logger::Log(LogLevel::Error, "failed to emplace blob: ", ex.what());
- return false;
- }
- return Upload(std::move(container));
-}
diff --git a/src/buildtool/execution_api/common/execution_api.hpp b/src/buildtool/execution_api/common/execution_api.hpp
index 42554a48..a4892258 100644
--- a/src/buildtool/execution_api/common/execution_api.hpp
+++ b/src/buildtool/execution_api/common/execution_api.hpp
@@ -29,7 +29,6 @@
#include "src/buildtool/execution_api/common/artifact_blob_container.hpp"
#include "src/buildtool/execution_api/common/execution_action.hpp"
#include "src/buildtool/execution_engine/dag/dag.hpp"
-#include "src/buildtool/file_system/object_type.hpp"
/// \brief Abstract remote execution API
/// Can be used to create actions.
@@ -120,12 +119,6 @@ class IExecutionApi {
bool skip_find_missing = false) noexcept
-> bool = 0;
- /// \brief Upload a file to CAS as an object of the specified type.
- /// It may be assumed that the file is owned entirely by the build process.
- [[nodiscard]] virtual auto UploadFile(
- std::filesystem::path const& file_path,
- ObjectType type) noexcept -> bool;
-
[[nodiscard]] virtual auto UploadTree(
std::vector<DependencyGraph::NamedArtifactNodePtr> const&
artifacts) noexcept -> std::optional<ArtifactDigest> = 0;
diff --git a/src/buildtool/execution_api/local/local_api.hpp b/src/buildtool/execution_api/local/local_api.hpp
index 75ad97bc..035b14e9 100644
--- a/src/buildtool/execution_api/local/local_api.hpp
+++ b/src/buildtool/execution_api/local/local_api.hpp
@@ -287,34 +287,6 @@ class LocalApi final : public IExecutionApi {
return true;
}
- [[nodiscard]] auto UploadFile(std::filesystem::path const& file_path,
- ObjectType type) noexcept -> bool override {
- Logger::Log(LogLevel::Trace, [&file_path, &type]() {
- return fmt::format("Storing {} of type {} directly to CAS.",
- file_path.string(),
- ToChar(type));
- });
- switch (type) {
- case ObjectType::Tree:
- return storage_->CAS()
- .StoreTree</* kOwner= */ true>(file_path)
- .has_value();
- case ObjectType::Symlink:
- case ObjectType::File:
- return storage_->CAS()
- .StoreBlob</* kOwner= */ true>(file_path,
- /* is_executable= */ false)
- .has_value();
- case ObjectType::Executable:
- return storage_->CAS()
- .StoreBlob</* kOwner= */ true>(file_path,
- /* is_executable= */ true)
- .has_value();
- }
- Ensures(false); // unreachable
- return false;
- }
-
[[nodiscard]] auto UploadTree(
std::vector<DependencyGraph::NamedArtifactNodePtr> const&
artifacts) noexcept -> std::optional<ArtifactDigest> final {