From 619def44c1cca9f3cdf63544d5f24f2c7a7d9b77 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Tue, 22 Feb 2022 17:03:21 +0100 Subject: Initial self-hosting commit This is the initial version of our tool that is able to build itself. In can be bootstrapped by ./bin/bootstrap.py Co-authored-by: Oliver Reiche Co-authored-by: Victor Moreno --- .../execution_api/remote/bazel/bazel_api.hpp | 65 ++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 src/buildtool/execution_api/remote/bazel/bazel_api.hpp (limited to 'src/buildtool/execution_api/remote/bazel/bazel_api.hpp') diff --git a/src/buildtool/execution_api/remote/bazel/bazel_api.hpp b/src/buildtool/execution_api/remote/bazel/bazel_api.hpp new file mode 100644 index 00000000..1405737b --- /dev/null +++ b/src/buildtool/execution_api/remote/bazel/bazel_api.hpp @@ -0,0 +1,65 @@ +#ifndef INCLUDED_SRC_BUILDTOOL_EXECUTION_API_REMOTE_BAZEL_BAZEL_API_HPP +#define INCLUDED_SRC_BUILDTOOL_EXECUTION_API_REMOTE_BAZEL_BAZEL_API_HPP + +#include +#include +#include +#include + +#include "gsl-lite/gsl-lite.hpp" +#include "src/buildtool/common/artifact_digest.hpp" +#include "src/buildtool/execution_api/bazel_msg/bazel_common.hpp" +#include "src/buildtool/execution_api/common/execution_api.hpp" +#include "src/buildtool/execution_api/common/local_tree_map.hpp" + +// forward declaration for actual implementations +class BazelNetwork; +struct ExecutionConfiguration; + +/// \brief Bazel implementation of the abstract Execution API. +class BazelApi final : public IExecutionApi { + public: + BazelApi(std::string const& instance_name, + std::string const& host, + Port port, + ExecutionConfiguration const& exec_config) noexcept; + BazelApi(BazelApi const&) = delete; + BazelApi(BazelApi&& other) noexcept; + auto operator=(BazelApi const&) -> BazelApi& = delete; + auto operator=(BazelApi &&) -> BazelApi& = delete; + ~BazelApi() final; + + auto CreateAction( + ArtifactDigest const& root_digest, + std::vector const& command, + std::vector const& output_files, + std::vector const& output_dirs, + std::map const& env_vars, + std::map const& properties) noexcept + -> IExecutionAction::Ptr final; + + [[nodiscard]] auto RetrieveToPaths( + std::vector const& artifacts_info, + std::vector const& output_paths) noexcept + -> bool final; + + [[nodiscard]] auto RetrieveToFds( + std::vector const& artifacts_info, + std::vector const& fds) noexcept -> bool final; + + [[nodiscard]] auto Upload(BlobContainer const& blobs, + bool skip_find_missing) noexcept -> bool final; + + [[nodiscard]] auto UploadTree( + std::vector const& + artifacts) noexcept -> std::optional final; + + [[nodiscard]] auto IsAvailable(ArtifactDigest const& digest) const noexcept + -> bool final; + + private: + std::shared_ptr network_; + std::shared_ptr tree_map_; +}; + +#endif // INCLUDED_SRC_BUILDTOOL_EXECUTION_API_REMOTE_BAZEL_BAZEL_API_HPP -- cgit v1.2.3