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_action.hpp | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 src/buildtool/execution_api/remote/bazel/bazel_action.hpp (limited to 'src/buildtool/execution_api/remote/bazel/bazel_action.hpp') diff --git a/src/buildtool/execution_api/remote/bazel/bazel_action.hpp b/src/buildtool/execution_api/remote/bazel/bazel_action.hpp new file mode 100644 index 00000000..7eb9a9e0 --- /dev/null +++ b/src/buildtool/execution_api/remote/bazel/bazel_action.hpp @@ -0,0 +1,54 @@ +#ifndef INCLUDED_SRC_BUILDTOOL_EXECUTION_API_REMOTE_BAZEL_BAZEL_ACTION_HPP +#define INCLUDED_SRC_BUILDTOOL_EXECUTION_API_REMOTE_BAZEL_BAZEL_ACTION_HPP + +#include +#include +#include +#include + +#include "src/buildtool/common/bazel_types.hpp" +#include "src/buildtool/execution_api/remote/bazel/bazel_network.hpp" + +class BazelApi; + +/// \brief Bazel implementation of the abstract Execution Action. +/// Uploads all dependencies, creates a Bazel Action and executes it. +class BazelAction final : public IExecutionAction { + friend class BazelApi; + + public: + auto Execute(Logger const* logger) noexcept + -> IExecutionResponse::Ptr final; + void SetCacheFlag(CacheFlag flag) noexcept final { cache_flag_ = flag; } + void SetTimeout(std::chrono::milliseconds timeout) noexcept final { + timeout_ = timeout; + } + + private: + std::shared_ptr network_; + std::shared_ptr tree_map_; + bazel_re::Digest const root_digest_; + std::vector const cmdline_; + std::vector output_files_; + std::vector output_dirs_; + std::vector env_vars_; + std::vector properties_; + CacheFlag cache_flag_{CacheFlag::CacheOutput}; + std::chrono::milliseconds timeout_{kDefaultTimeout}; + + BazelAction(std::shared_ptr network, + std::shared_ptr tree_map, + bazel_re::Digest root_digest, + std::vector command, + std::vector output_files, + std::vector output_dirs, + std::map const& env_vars, + std::map const& properties) noexcept; + + [[nodiscard]] auto CreateBundlesForAction(BlobContainer* blobs, + bazel_re::Digest const& exec_dir, + bool do_not_cache) const noexcept + -> bazel_re::Digest; +}; + +#endif // INCLUDED_SRC_BUILDTOOL_EXECUTION_API_REMOTE_BAZEL_BAZEL_ACTION_HPP -- cgit v1.2.3