summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/buildtool/common/TARGETS8
-rw-r--r--src/buildtool/common/action_description.hpp3
-rw-r--r--src/buildtool/common/artifact.hpp6
-rw-r--r--src/buildtool/common/artifact_description.cpp4
-rw-r--r--src/buildtool/common/artifact_description.hpp4
-rw-r--r--src/buildtool/common/artifact_digest.hpp1
-rw-r--r--src/buildtool/common/artifact_digest_factory.cpp2
-rw-r--r--src/buildtool/common/bazel_types.hpp6
-rw-r--r--src/buildtool/common/cli.hpp6
-rw-r--r--src/buildtool/common/git_hashes_converter.hpp1
-rw-r--r--src/buildtool/common/identifier.hpp1
-rw-r--r--src/buildtool/common/location.hpp1
-rw-r--r--src/buildtool/common/remote/TARGETS3
-rw-r--r--src/buildtool/common/remote/client_common.hpp7
-rw-r--r--src/buildtool/common/remote/port.hpp2
-rw-r--r--src/buildtool/common/remote/remote_common.hpp2
-rw-r--r--src/buildtool/common/remote/retry.cpp2
-rw-r--r--src/buildtool/common/remote/retry.hpp3
-rw-r--r--src/buildtool/common/repository_config.hpp12
-rw-r--r--src/buildtool/common/tree.hpp1
-rw-r--r--src/buildtool/common/user_structs.hpp2
-rw-r--r--src/buildtool/main/TARGETS3
-rw-r--r--src/buildtool/main/cli.hpp1
23 files changed, 64 insertions, 17 deletions
diff --git a/src/buildtool/common/TARGETS b/src/buildtool/common/TARGETS
index 878d2787..791b2ac3 100644
--- a/src/buildtool/common/TARGETS
+++ b/src/buildtool/common/TARGETS
@@ -18,7 +18,6 @@
, "hdrs": ["cli.hpp"]
, "deps":
[ "clidefaults"
- , "retry_cli"
, ["@", "cli11", "", "cli11"]
, ["@", "fmt", "", "fmt"]
, ["@", "gsl", "", "gsl"]
@@ -26,6 +25,7 @@
, ["src/buildtool/build_engine/expression", "expression"]
, ["src/buildtool/crypto", "hash_function"]
, ["src/buildtool/logging", "log_level"]
+ , ["src/buildtool/logging", "logging"]
, ["src/buildtool/main", "build_utils"]
, ["src/utils/cpp", "path"]
]
@@ -37,6 +37,7 @@
, "hdrs": ["bazel_types.hpp"]
, "proto": [["@", "bazel_remote_apis", "", "remote_execution_proto"]]
, "stage": ["src", "buildtool", "common"]
+ , "deps": [["@", "protoc", "", "libprotobuf"]]
}
, "bazel_digest_factory":
{ "type": ["@", "rules", "CC", "library"]
@@ -89,12 +90,14 @@
]
, "deps":
[ "protocol_traits"
+ , ["@", "fmt", "", "fmt"]
, ["@", "json", "", "json"]
, ["src/buildtool/crypto", "hash_function"]
, ["src/buildtool/crypto", "hash_info"]
, ["src/buildtool/file_system", "object_type"]
, ["src/buildtool/logging", "log_level"]
, ["src/buildtool/logging", "logging"]
+ , ["src/utils/cpp", "expected"]
, ["src/utils/cpp", "hash_combine"]
]
, "stage": ["src", "buildtool", "common"]
@@ -112,8 +115,10 @@
]
, "private-deps":
[ "artifact_digest_factory"
+ , ["@", "gsl", "", "gsl"]
, ["src/buildtool/logging", "log_level"]
, ["src/buildtool/logging", "logging"]
+ , ["src/utils/cpp", "expected"]
, ["src/utils/cpp", "json"]
]
, "stage": ["src", "buildtool", "common"]
@@ -158,6 +163,7 @@
, ["src/buildtool/crypto", "hash_function"]
, ["src/buildtool/file_system", "file_root"]
, ["src/buildtool/file_system", "git_cas"]
+ , ["src/buildtool/file_system", "git_tree"]
, ["src/buildtool/multithreading", "atomic_value"]
, ["src/buildtool/storage", "storage"]
]
diff --git a/src/buildtool/common/action_description.hpp b/src/buildtool/common/action_description.hpp
index e51552ad..09691f7d 100644
--- a/src/buildtool/common/action_description.hpp
+++ b/src/buildtool/common/action_description.hpp
@@ -15,6 +15,8 @@
#ifndef INCLUDED_SRC_BUILDTOOL_COMMON_ACTION_DESCRIPTION_HPP
#define INCLUDED_SRC_BUILDTOOL_COMMON_ACTION_DESCRIPTION_HPP
+#include <exception>
+#include <functional>
#include <map>
#include <memory>
#include <optional>
@@ -26,6 +28,7 @@
#include "nlohmann/json.hpp"
#include "src/buildtool/common/action.hpp"
#include "src/buildtool/common/artifact_description.hpp"
+#include "src/buildtool/common/identifier.hpp"
#include "src/buildtool/crypto/hash_function.hpp"
#include "src/buildtool/logging/log_level.hpp"
#include "src/buildtool/logging/logger.hpp"
diff --git a/src/buildtool/common/artifact.hpp b/src/buildtool/common/artifact.hpp
index 403071a2..b1754c70 100644
--- a/src/buildtool/common/artifact.hpp
+++ b/src/buildtool/common/artifact.hpp
@@ -17,11 +17,14 @@
#include <cstddef>
#include <filesystem>
+#include <functional>
#include <optional>
+#include <sstream>
+#include <stdexcept>
#include <string>
-#include <unordered_map>
#include <utility>
+#include "fmt/core.h"
#include "nlohmann/json.hpp"
#include "src/buildtool/common/artifact_digest.hpp"
#include "src/buildtool/common/identifier.hpp"
@@ -31,6 +34,7 @@
#include "src/buildtool/file_system/object_type.hpp"
#include "src/buildtool/logging/log_level.hpp"
#include "src/buildtool/logging/logger.hpp"
+#include "src/utils/cpp/expected.hpp"
#include "src/utils/cpp/hash_combine.hpp"
// Artifacts (source files, libraries, executables...) need to store their
diff --git a/src/buildtool/common/artifact_description.cpp b/src/buildtool/common/artifact_description.cpp
index b1451491..eecb8c01 100644
--- a/src/buildtool/common/artifact_description.cpp
+++ b/src/buildtool/common/artifact_description.cpp
@@ -15,11 +15,15 @@
#include "src/buildtool/common/artifact_description.hpp"
#include <cstddef>
+#include <exception>
+#include <functional>
+#include "gsl/gsl"
#include "nlohmann/json.hpp"
#include "src/buildtool/common/artifact_digest_factory.hpp"
#include "src/buildtool/logging/log_level.hpp"
#include "src/buildtool/logging/logger.hpp"
+#include "src/utils/cpp/expected.hpp"
#include "src/utils/cpp/json.hpp"
namespace {
diff --git a/src/buildtool/common/artifact_description.hpp b/src/buildtool/common/artifact_description.hpp
index 1858e41e..6a4b3b9e 100644
--- a/src/buildtool/common/artifact_description.hpp
+++ b/src/buildtool/common/artifact_description.hpp
@@ -16,13 +16,17 @@
#define INCLUDED_SRC_BUILDTOOL_COMMON_ARTIFACT_DESCRIPTION_HPP
#include <filesystem>
+#include <functional>
#include <optional>
#include <string>
+#include <tuple>
#include <utility> // std::move
#include <variant>
+#include "nlohmann/json.hpp"
#include "src/buildtool/common/artifact.hpp"
#include "src/buildtool/common/artifact_digest.hpp"
+#include "src/buildtool/common/identifier.hpp"
#include "src/buildtool/crypto/hash_function.hpp"
#include "src/buildtool/file_system/object_type.hpp"
diff --git a/src/buildtool/common/artifact_digest.hpp b/src/buildtool/common/artifact_digest.hpp
index 5e88232a..fbde854d 100644
--- a/src/buildtool/common/artifact_digest.hpp
+++ b/src/buildtool/common/artifact_digest.hpp
@@ -16,6 +16,7 @@
#define INCLUDED_SRC_COMMON_ARTIFACT_DIGEST_HPP
#include <cstddef>
+#include <functional>
#include <string>
#include <utility> // std::move
diff --git a/src/buildtool/common/artifact_digest_factory.cpp b/src/buildtool/common/artifact_digest_factory.cpp
index f3ea30c1..e39b61f5 100644
--- a/src/buildtool/common/artifact_digest_factory.cpp
+++ b/src/buildtool/common/artifact_digest_factory.cpp
@@ -14,6 +14,8 @@
#include "src/buildtool/common/artifact_digest_factory.hpp"
+#include <cstdint>
+
#include "gsl/gsl"
#include "src/buildtool/common/bazel_digest_factory.hpp"
#include "src/buildtool/common/bazel_types.hpp"
diff --git a/src/buildtool/common/bazel_types.hpp b/src/buildtool/common/bazel_types.hpp
index ca191eed..9b6cc2fb 100644
--- a/src/buildtool/common/bazel_types.hpp
+++ b/src/buildtool/common/bazel_types.hpp
@@ -48,7 +48,13 @@ using int64 = std::int64_t;
#else
+#include <cstddef>
+#include <functional>
+#include <string>
+
#include "build/bazel/remote/execution/v2/remote_execution.pb.h"
+#include "google/protobuf/message.h"
+#include "google/protobuf/repeated_ptr_field.h"
#endif
diff --git a/src/buildtool/common/cli.hpp b/src/buildtool/common/cli.hpp
index 7f935364..2a04f413 100644
--- a/src/buildtool/common/cli.hpp
+++ b/src/buildtool/common/cli.hpp
@@ -15,11 +15,13 @@
#ifndef INCLUDED_SRC_BUILDTOOL_COMMON_CLI_HPP
#define INCLUDED_SRC_BUILDTOOL_COMMON_CLI_HPP
+#include <algorithm>
#include <chrono>
#include <cstddef>
#include <cstdint>
-#include <cstdlib>
+#include <exception>
#include <filesystem>
+#include <functional>
#include <optional>
#include <string>
#include <thread>
@@ -32,9 +34,9 @@
#include "nlohmann/json.hpp"
#include "src/buildtool/build_engine/expression/evaluator.hpp"
#include "src/buildtool/common/clidefaults.hpp"
-#include "src/buildtool/common/retry_cli.hpp"
#include "src/buildtool/crypto/hash_function.hpp"
#include "src/buildtool/logging/log_level.hpp"
+#include "src/buildtool/logging/logger.hpp"
#include "src/buildtool/main/build_utils.hpp"
#include "src/utils/cpp/path.hpp"
diff --git a/src/buildtool/common/git_hashes_converter.hpp b/src/buildtool/common/git_hashes_converter.hpp
index 52fd1283..718ce0f2 100644
--- a/src/buildtool/common/git_hashes_converter.hpp
+++ b/src/buildtool/common/git_hashes_converter.hpp
@@ -15,6 +15,7 @@
#ifndef INCLUDED_SRC_BUILDTOOL_COMMON_GIT_HASHES_CONVERTER_HPP
#define INCLUDED_SRC_BUILDTOOL_COMMON_GIT_HASHES_CONVERTER_HPP
+#include <functional>
#include <mutex> //std::unique_lock
#include <optional>
#include <shared_mutex>
diff --git a/src/buildtool/common/identifier.hpp b/src/buildtool/common/identifier.hpp
index e10e4f73..a00d2572 100644
--- a/src/buildtool/common/identifier.hpp
+++ b/src/buildtool/common/identifier.hpp
@@ -18,6 +18,7 @@
#include <iomanip>
#include <sstream>
#include <string>
+#include <type_traits>
// Global artifact identifier (not the CAS hash)
using ArtifactIdentifier = std::string;
diff --git a/src/buildtool/common/location.hpp b/src/buildtool/common/location.hpp
index c3788339..10e70375 100644
--- a/src/buildtool/common/location.hpp
+++ b/src/buildtool/common/location.hpp
@@ -15,7 +15,6 @@
#include <filesystem>
#include <optional>
#include <string>
-#include <unordered_set>
#include <utility>
#include "nlohmann/json.hpp"
diff --git a/src/buildtool/common/remote/TARGETS b/src/buildtool/common/remote/TARGETS
index 9bb840b7..170e09d4 100644
--- a/src/buildtool/common/remote/TARGETS
+++ b/src/buildtool/common/remote/TARGETS
@@ -2,13 +2,13 @@
{ "type": ["@", "rules", "CC", "library"]
, "name": ["client_common"]
, "hdrs": ["client_common.hpp"]
+ , "proto": [["@", "googleapis", "", "google_rpc_status_proto"]]
, "deps":
[ "port"
, ["@", "fmt", "", "fmt"]
, ["@", "grpc", "", "grpc++"]
, ["@", "gsl", "", "gsl"]
, ["src/buildtool/auth", "auth"]
- , ["src/buildtool/common", "bazel_types"]
, ["src/buildtool/logging", "log_level"]
, ["src/buildtool/logging", "logging"]
]
@@ -61,5 +61,6 @@
, ["src/buildtool/logging", "logging"]
]
, "stage": ["src", "buildtool", "common", "remote"]
+ , "private-deps": [["@", "fmt", "", "fmt"]]
}
}
diff --git a/src/buildtool/common/remote/client_common.hpp b/src/buildtool/common/remote/client_common.hpp
index aecbf02f..87c95cf4 100644
--- a/src/buildtool/common/remote/client_common.hpp
+++ b/src/buildtool/common/remote/client_common.hpp
@@ -18,16 +18,17 @@
/// \file client_common.hpp
/// \brief Common types and functions required by client implementations.
+#include <memory>
#include <optional>
-#include <sstream>
#include <string>
#include <variant>
+#include <grpcpp/grpcpp.h>
+
#include "fmt/core.h"
-#include "grpcpp/grpcpp.h"
+#include "google/rpc/status.pb.h"
#include "gsl/gsl"
#include "src/buildtool/auth/authentication.hpp"
-#include "src/buildtool/common/bazel_types.hpp"
#include "src/buildtool/common/remote/port.hpp"
#include "src/buildtool/logging/log_level.hpp"
#include "src/buildtool/logging/logger.hpp"
diff --git a/src/buildtool/common/remote/port.hpp b/src/buildtool/common/remote/port.hpp
index 01d28e8d..3cba855d 100644
--- a/src/buildtool/common/remote/port.hpp
+++ b/src/buildtool/common/remote/port.hpp
@@ -16,9 +16,9 @@
#define INCLUDED_SRC_BUILDTOOL_COMMON_PORT_HPP
#include <cstdint>
-#include <exception>
#include <limits>
#include <optional>
+#include <stdexcept>
#include <string>
#include "gsl/gsl"
diff --git a/src/buildtool/common/remote/remote_common.hpp b/src/buildtool/common/remote/remote_common.hpp
index b9bc926a..cf35d9fc 100644
--- a/src/buildtool/common/remote/remote_common.hpp
+++ b/src/buildtool/common/remote/remote_common.hpp
@@ -15,6 +15,8 @@
#ifndef INCLUDED_SRC_BUILDTOOL_COMMON_REMOTE_COMMON_HPP
#define INCLUDED_SRC_BUILDTOOL_COMMON_REMOTE_COMMON_HPP
+#include <cstdint>
+#include <exception>
#include <map>
#include <optional>
#include <sstream>
diff --git a/src/buildtool/common/remote/retry.cpp b/src/buildtool/common/remote/retry.cpp
index 8c97bf38..76985897 100644
--- a/src/buildtool/common/remote/retry.cpp
+++ b/src/buildtool/common/remote/retry.cpp
@@ -19,7 +19,7 @@
#include <chrono>
#include <thread>
-#include "src/buildtool/logging/log_level.hpp"
+#include "fmt/core.h"
auto WithRetry(CallableReturningRetryResponse const& f,
RetryConfig const& retry_config,
diff --git a/src/buildtool/common/remote/retry.hpp b/src/buildtool/common/remote/retry.hpp
index 9387ef2a..18a495ad 100644
--- a/src/buildtool/common/remote/retry.hpp
+++ b/src/buildtool/common/remote/retry.hpp
@@ -22,7 +22,8 @@
#include <string>
#include <utility>
-#include "grpcpp/grpcpp.h"
+#include <grpcpp/grpcpp.h>
+
#include "src/buildtool/common/remote/retry_config.hpp"
#include "src/buildtool/logging/log_level.hpp"
#include "src/buildtool/logging/logger.hpp"
diff --git a/src/buildtool/common/repository_config.hpp b/src/buildtool/common/repository_config.hpp
index 54440187..cffd4971 100644
--- a/src/buildtool/common/repository_config.hpp
+++ b/src/buildtool/common/repository_config.hpp
@@ -16,6 +16,7 @@
#define INCLUDED_SRC_BUILDTOOL_COMMON_REPOSITORY_CONFIG_HPP
#include <filesystem>
+#include <functional>
#include <map>
#include <memory>
#include <optional>
@@ -29,6 +30,7 @@
#include "src/buildtool/crypto/hash_function.hpp"
#include "src/buildtool/file_system/file_root.hpp"
#include "src/buildtool/file_system/git_cas.hpp"
+#include "src/buildtool/file_system/git_tree.hpp"
#include "src/buildtool/multithreading/atomic_value.hpp"
#include "src/buildtool/storage/storage.hpp"
@@ -172,9 +174,13 @@ class RepositoryConfig {
[[nodiscard]] auto Get(std::string const& repo,
std::function<T const*(RepositoryInfo const&)> const&
getter) const noexcept -> T const* {
- if (auto const* info = Info(repo)) {
- return getter(*info);
- }
+ try {
+ if (auto const* info = Info(repo)) {
+ return getter(*info);
+ }
+ } catch (...) {
+ return nullptr;
+ };
return nullptr;
}
diff --git a/src/buildtool/common/tree.hpp b/src/buildtool/common/tree.hpp
index 55922346..c861b264 100644
--- a/src/buildtool/common/tree.hpp
+++ b/src/buildtool/common/tree.hpp
@@ -15,6 +15,7 @@
#ifndef INCLUDED_SRC_BUILDTOOL_COMMON_TREE_HPP
#define INCLUDED_SRC_BUILDTOOL_COMMON_TREE_HPP
+#include <functional>
#include <memory>
#include <optional>
#include <string>
diff --git a/src/buildtool/common/user_structs.hpp b/src/buildtool/common/user_structs.hpp
index 019d5925..9f67ed45 100644
--- a/src/buildtool/common/user_structs.hpp
+++ b/src/buildtool/common/user_structs.hpp
@@ -15,11 +15,11 @@
#ifndef INCLUDED_SRC_BUILDTOOL_COMMON_USER_STRUCTS_HPP
#define INCLUDED_SRC_BUILDTOOL_COMMON_USER_STRUCTS_HPP
+#include <algorithm>
#include <filesystem>
#include <functional>
#include <memory>
#include <optional>
-#include <string>
#include <vector>
#include "nlohmann/json.hpp"
diff --git a/src/buildtool/main/TARGETS b/src/buildtool/main/TARGETS
index e25e1677..18ab6c65 100644
--- a/src/buildtool/main/TARGETS
+++ b/src/buildtool/main/TARGETS
@@ -120,7 +120,8 @@
, "hdrs": ["cli.hpp"]
, "srcs": ["cli.cpp"]
, "stage": ["src", "buildtool", "main"]
- , "deps": [["src/buildtool/common", "cli"]]
+ , "deps":
+ [["src/buildtool/common", "cli"], ["src/buildtool/common", "retry_cli"]]
, "private-deps":
[ "common"
, ["@", "gsl", "", "gsl"]
diff --git a/src/buildtool/main/cli.hpp b/src/buildtool/main/cli.hpp
index 7717d16c..54a13180 100644
--- a/src/buildtool/main/cli.hpp
+++ b/src/buildtool/main/cli.hpp
@@ -18,6 +18,7 @@
#include <cstdint>
#include "src/buildtool/common/cli.hpp"
+#include "src/buildtool/common/retry_cli.hpp"
enum class SubCommand : std::uint8_t {
kUnknown,