diff options
91 files changed, 386 insertions, 297 deletions
diff --git a/src/buildtool/build_engine/analysed_target/target_graph_information.cpp b/src/buildtool/build_engine/analysed_target/target_graph_information.cpp index eb12863c..dfd333ac 100644 --- a/src/buildtool/build_engine/analysed_target/target_graph_information.cpp +++ b/src/buildtool/build_engine/analysed_target/target_graph_information.cpp @@ -23,9 +23,8 @@ auto TargetGraphInformation::NodeString() const noexcept } namespace { -auto NodesToString( - std::vector<BuildMaps::Target::ConfiguredTargetPtr> const& nodes) - -> std::vector<std::string> { +auto NodesToString(std::vector<BuildMaps::Target::ConfiguredTargetPtr> const& + nodes) -> std::vector<std::string> { std::vector<std::string> result{}; result.reserve(nodes.size()); for (auto const& n : nodes) { diff --git a/src/buildtool/build_engine/base_maps/json_file_map.hpp b/src/buildtool/build_engine/base_maps/json_file_map.hpp index c18a713e..52ab89ab 100644 --- a/src/buildtool/build_engine/base_maps/json_file_map.hpp +++ b/src/buildtool/build_engine/base_maps/json_file_map.hpp @@ -34,11 +34,11 @@ using JsonFileMap = AsyncMapConsumer<ModuleName, nlohmann::json>; // function pointer type for specifying which root to get from global config using RootGetter = auto (RepositoryConfig::*)(std::string const&) const - -> FileRoot const*; + -> FileRoot const*; // function pointer type for specifying the file name from the global config using FileNameGetter = auto (RepositoryConfig::*)(std::string const&) const - -> std::string const*; + -> std::string const*; template <RootGetter get_root, FileNameGetter get_name, bool kMandatory = true> auto CreateJsonFileMap( diff --git a/src/buildtool/build_engine/base_maps/source_map.cpp b/src/buildtool/build_engine/base_maps/source_map.cpp index 4ca726cb..e47c59b1 100644 --- a/src/buildtool/build_engine/base_maps/source_map.cpp +++ b/src/buildtool/build_engine/base_maps/source_map.cpp @@ -27,8 +27,8 @@ namespace BuildMaps::Base { namespace { -auto as_target(const BuildMaps::Base::EntityName& key, ExpressionPtr artifact) - -> AnalysedTargetPtr { +auto as_target(const BuildMaps::Base::EntityName& key, + ExpressionPtr artifact) -> AnalysedTargetPtr { auto stage = ExpressionPtr{ Expression::map_t{key.GetNamedTarget().name, std::move(artifact)}}; return std::make_shared<AnalysedTarget const>( diff --git a/src/buildtool/build_engine/expression/configuration.hpp b/src/buildtool/build_engine/expression/configuration.hpp index ec00bb4a..15f8c379 100644 --- a/src/buildtool/build_engine/expression/configuration.hpp +++ b/src/buildtool/build_engine/expression/configuration.hpp @@ -126,9 +126,10 @@ class Configuration { } template <class T> - requires(Expression::IsValidType<T>() or std::is_same_v<T, ExpressionPtr>) - [[nodiscard]] auto Update(std::string const& name, T const& value) const - -> Configuration { + requires(Expression::IsValidType<T>() or + std::is_same_v<T, ExpressionPtr>) + [[nodiscard]] auto Update(std::string const& name, + T const& value) const -> Configuration { auto update = Expression::map_t::underlying_map_t{}; update.emplace(name, value); return Configuration{Expression::map_t{expr_, update}}; diff --git a/src/buildtool/build_engine/expression/evaluator.cpp b/src/buildtool/build_engine/expression/evaluator.cpp index 350afa4e..66eb8cfe 100644 --- a/src/buildtool/build_engine/expression/evaluator.cpp +++ b/src/buildtool/build_engine/expression/evaluator.cpp @@ -324,8 +324,8 @@ auto Range(ExpressionPtr const& expr) -> ExpressionPtr { return ExpressionPtr{result}; } -auto ChangeEndingTo(ExpressionPtr const& name, ExpressionPtr const& ending) - -> ExpressionPtr { +auto ChangeEndingTo(ExpressionPtr const& name, + ExpressionPtr const& ending) -> ExpressionPtr { std::filesystem::path path{name->String()}; return ExpressionPtr{(path.parent_path() / path.stem()).string() + ending->String()}; @@ -376,8 +376,9 @@ auto Join(ExpressionPtr const& expr, std::string const& sep) -> ExpressionPtr { template <bool kDisjoint = false> // NOLINTNEXTLINE(misc-no-recursion) -auto Union(Expression::list_t const& dicts, std::size_t from, std::size_t to) - -> ExpressionPtr { +auto Union(Expression::list_t const& dicts, + std::size_t from, + std::size_t to) -> ExpressionPtr { if (to <= from) { return Expression::kEmptyMap; } @@ -432,8 +433,8 @@ auto Union(ExpressionPtr const& expr) -> ExpressionPtr { return Union<kDisjoint>(list, 0, list.size()); } -auto ConcatTargetName(ExpressionPtr const& expr, ExpressionPtr const& append) - -> ExpressionPtr { +auto ConcatTargetName(ExpressionPtr const& expr, + ExpressionPtr const& append) -> ExpressionPtr { if (expr->IsString()) { return ExpressionPtr{expr->String() + append->String()}; } diff --git a/src/buildtool/build_engine/expression/evaluator.hpp b/src/buildtool/build_engine/expression/evaluator.hpp index 598b36d4..726df568 100644 --- a/src/buildtool/build_engine/expression/evaluator.hpp +++ b/src/buildtool/build_engine/expression/evaluator.hpp @@ -108,8 +108,8 @@ class Evaluator { std::function<void(std::string const&)> const& logger, std::function<std::string(ExpressionPtr)> const& annotate_object = [](auto const& /*unused*/) { return std::string{}; }, - std::function<void(void)> const& note_user_context = []() {}) noexcept - -> ExpressionPtr; + std::function<void(void)> const& note_user_context = + []() {}) noexcept -> ExpressionPtr; constexpr static std::size_t kDefaultExpressionLogLimit = 320; diff --git a/src/buildtool/build_engine/expression/expression.hpp b/src/buildtool/build_engine/expression/expression.hpp index 89f5c5ea..cbfb2f24 100644 --- a/src/buildtool/build_engine/expression/expression.hpp +++ b/src/buildtool/build_engine/expression/expression.hpp @@ -40,8 +40,8 @@ #include "src/utils/cpp/json.hpp" class Expression { - friend auto operator+(Expression const& /*lhs*/, Expression const& /*rhs*/) - -> Expression; + friend auto operator+(Expression const& /*lhs*/, + Expression const& /*rhs*/) -> Expression; public: using none_t = std::monostate; @@ -84,10 +84,9 @@ class Expression { auto operator=(Expression&& other) noexcept = delete; template <class T> - requires(IsValidType<std::remove_cvref_t<T>>()) - // NOLINTNEXTLINE(bugprone-forwarding-reference-overload) - explicit Expression(T&& data) noexcept - : data_{std::forward<T>(data)} {} + requires(IsValidType<std::remove_cvref_t<T>>()) + // NOLINTNEXTLINE(bugprone-forwarding-reference-overload) + explicit Expression(T&& data) noexcept : data_{std::forward<T>(data)} {} [[nodiscard]] auto IsNone() const noexcept -> bool { return IsA<none_t>(); } [[nodiscard]] auto IsBool() const noexcept -> bool { return IsA<bool>(); } @@ -161,10 +160,10 @@ class Expression { } template <class T> - requires(IsValidType<std::remove_cvref_t<T>>() or - std::is_same_v<std::remove_cvref_t<T>, ExpressionPtr>) - [[nodiscard]] auto Get(std::string const& key, T&& default_value) const - -> ExpressionPtr { + requires(IsValidType<std::remove_cvref_t<T>>() or + std::is_same_v<std::remove_cvref_t<T>, ExpressionPtr>) + [[nodiscard]] auto Get(std::string const& key, + T&& default_value) const -> ExpressionPtr { auto value = At(key); if (value) { return value->get(); @@ -178,7 +177,8 @@ class Expression { } template <class T> - requires(IsValidType<T>()) [[nodiscard]] auto Value() const& noexcept + requires(IsValidType<T>()) + [[nodiscard]] auto Value() const& noexcept -> std::optional<std::reference_wrapper<T const>> { if (GetIndexOf<T>() == data_.index()) { return std::make_optional(std::ref(std::get<T>(data_))); @@ -187,8 +187,8 @@ class Expression { } template <class T> - requires(IsValidType<T>()) [[nodiscard]] auto Value() && noexcept - -> std::optional<T> { + requires(IsValidType<T>()) + [[nodiscard]] auto Value() && noexcept -> std::optional<T> { if (GetIndexOf<T>() == data_.index()) { return std::make_optional(std::move(std::get<T>(data_))); } @@ -268,8 +268,8 @@ class Expression { AtomicValue<bool> is_cachable_{}; template <class T, std::size_t kIndex = 0> - requires(IsValidType<T>()) [[nodiscard]] static consteval auto GetIndexOf() - -> std::size_t { + requires(IsValidType<T>()) + [[nodiscard]] static consteval auto GetIndexOf() -> std::size_t { static_assert(kIndex < std::variant_size_v<decltype(data_)>, "kIndex out of range"); if constexpr (std::is_same_v< @@ -313,8 +313,8 @@ class Expression { } template <class T> - requires(Expression::IsValidType<T>()) - [[nodiscard]] static auto TypeToString() noexcept -> std::string { + requires(Expression::IsValidType<T>()) + [[nodiscard]] static auto TypeToString() noexcept -> std::string { if constexpr (std::is_same_v<T, bool>) { return "bool"; } diff --git a/src/buildtool/build_engine/expression/expression_ptr.hpp b/src/buildtool/build_engine/expression/expression_ptr.hpp index f8b9a77f..b1f698c6 100644 --- a/src/buildtool/build_engine/expression/expression_ptr.hpp +++ b/src/buildtool/build_engine/expression/expression_ptr.hpp @@ -37,9 +37,9 @@ class ExpressionPtr { // Initialize from Expression's variant type or Expression template <class T> - requires(not std::is_same_v<std::remove_cvref_t<T>, ExpressionPtr>) - // NOLINTNEXTLINE(bugprone-forwarding-reference-overload) - explicit ExpressionPtr(T&& data) noexcept + requires(not std::is_same_v<std::remove_cvref_t<T>, ExpressionPtr>) + // NOLINTNEXTLINE(bugprone-forwarding-reference-overload) + explicit ExpressionPtr(T&& data) noexcept : ptr_{std::make_shared<Expression>(std::forward<T>(data))} {} ExpressionPtr() noexcept; diff --git a/src/buildtool/build_engine/expression/target_node.hpp b/src/buildtool/build_engine/expression/target_node.hpp index 39c1b4dd..feed94d6 100644 --- a/src/buildtool/build_engine/expression/target_node.hpp +++ b/src/buildtool/build_engine/expression/target_node.hpp @@ -34,9 +34,9 @@ class TargetNode { }; template <class NodeType> - requires( - std::is_same_v<NodeType, Value> or - std::is_same_v<NodeType, Abstract>) explicit TargetNode(NodeType node) + requires(std::is_same_v<NodeType, Value> or + std::is_same_v<NodeType, Abstract>) + explicit TargetNode(NodeType node) : data_{std::move(node)}, is_cacheable_{std::get<NodeType>(data_).IsCacheable()} {} diff --git a/src/buildtool/build_engine/target_map/built_in_rules.cpp b/src/buildtool/build_engine/target_map/built_in_rules.cpp index 94da5991..0237e450 100644 --- a/src/buildtool/build_engine/target_map/built_in_rules.cpp +++ b/src/buildtool/build_engine/target_map/built_in_rules.cpp @@ -1660,16 +1660,15 @@ auto IsBuiltInRule(nlohmann::json const& rule_type) -> bool { return kBuiltIns.contains(rule_name); } -auto HandleBuiltin( - const gsl::not_null<AnalyseContext*>& context, - const nlohmann::json& rule_type, - const nlohmann::json& desc, - const BuildMaps::Target::ConfiguredTarget& key, - const BuildMaps::Target::TargetMap::SubCallerPtr& subcaller, - const BuildMaps::Target::TargetMap::SetterPtr& setter, - const BuildMaps::Target::TargetMap::LoggerPtr& logger, - const gsl::not_null<BuildMaps::Target::ResultTargetMap*>& result_map) - -> bool { +auto HandleBuiltin(const gsl::not_null<AnalyseContext*>& context, + const nlohmann::json& rule_type, + const nlohmann::json& desc, + const BuildMaps::Target::ConfiguredTarget& key, + const BuildMaps::Target::TargetMap::SubCallerPtr& subcaller, + const BuildMaps::Target::TargetMap::SetterPtr& setter, + const BuildMaps::Target::TargetMap::LoggerPtr& logger, + const gsl::not_null<BuildMaps::Target::ResultTargetMap*>& + result_map) -> bool { if (not rule_type.is_string()) { // Names for built-in rules are always strings return false; diff --git a/src/buildtool/build_engine/target_map/built_in_rules.hpp b/src/buildtool/build_engine/target_map/built_in_rules.hpp index 6790148a..653344f2 100644 --- a/src/buildtool/build_engine/target_map/built_in_rules.hpp +++ b/src/buildtool/build_engine/target_map/built_in_rules.hpp @@ -23,15 +23,14 @@ #include "src/buildtool/main/analyse_context.hpp" namespace BuildMaps::Target { -auto HandleBuiltin( - const gsl::not_null<AnalyseContext*>& context, - const nlohmann::json& rule_type, - const nlohmann::json& desc, - const BuildMaps::Target::ConfiguredTarget& key, - const BuildMaps::Target::TargetMap::SubCallerPtr& subcaller, - const BuildMaps::Target::TargetMap::SetterPtr& setter, - const BuildMaps::Target::TargetMap::LoggerPtr& logger, - const gsl::not_null<BuildMaps::Target::ResultTargetMap*>& result_map) - -> bool; +auto HandleBuiltin(const gsl::not_null<AnalyseContext*>& context, + const nlohmann::json& rule_type, + const nlohmann::json& desc, + const BuildMaps::Target::ConfiguredTarget& key, + const BuildMaps::Target::TargetMap::SubCallerPtr& subcaller, + const BuildMaps::Target::TargetMap::SetterPtr& setter, + const BuildMaps::Target::TargetMap::LoggerPtr& logger, + const gsl::not_null<BuildMaps::Target::ResultTargetMap*>& + result_map) -> bool; } // namespace BuildMaps::Target #endif diff --git a/src/buildtool/build_engine/target_map/configured_target.hpp b/src/buildtool/build_engine/target_map/configured_target.hpp index 9a374b5a..88c59cf2 100644 --- a/src/buildtool/build_engine/target_map/configured_target.hpp +++ b/src/buildtool/build_engine/target_map/configured_target.hpp @@ -32,9 +32,8 @@ struct ConfiguredTarget { static constexpr std::size_t kConfigLength = 320; - [[nodiscard]] auto operator==( - BuildMaps::Target::ConfiguredTarget const& other) const noexcept - -> bool { + [[nodiscard]] auto operator==(BuildMaps::Target::ConfiguredTarget const& + other) const noexcept -> bool { return target == other.target and config == other.config; } diff --git a/src/buildtool/crypto/hash_function.cpp b/src/buildtool/crypto/hash_function.cpp index 6f240e50..4be9033d 100644 --- a/src/buildtool/crypto/hash_function.cpp +++ b/src/buildtool/crypto/hash_function.cpp @@ -57,15 +57,13 @@ auto HashFunction::HashTaggedLine(std::string const& data, return std::move(hasher).Finalize(); } -auto HashFunction::HashBlobFile( - std::filesystem::path const& path) const noexcept - -> std::optional<std::pair<Hasher::HashDigest, std::uintmax_t>> { +auto HashFunction::HashBlobFile(std::filesystem::path const& path) const + noexcept -> std::optional<std::pair<Hasher::HashDigest, std::uintmax_t>> { return HashTaggedFile(path, CreateGitBlobTag); } -auto HashFunction::HashTreeFile( - std::filesystem::path const& path) const noexcept - -> std::optional<std::pair<Hasher::HashDigest, std::uintmax_t>> { +auto HashFunction::HashTreeFile(std::filesystem::path const& path) const + noexcept -> std::optional<std::pair<Hasher::HashDigest, std::uintmax_t>> { return HashTaggedFile(path, CreateGitTreeTag); } diff --git a/src/buildtool/execution_api/execution_service/execution_server.hpp b/src/buildtool/execution_api/execution_service/execution_server.hpp index e0c4f4fe..01ede03e 100644 --- a/src/buildtool/execution_api/execution_service/execution_server.hpp +++ b/src/buildtool/execution_api/execution_service/execution_server.hpp @@ -124,11 +124,10 @@ class ExecutionServiceImpl final : public bazel_re::Execution::Service { // operation. The server MAY choose to stream additional updates as // execution progresses, such as to provide an update as to the state of the // execution. - auto WaitExecution( - ::grpc::ServerContext* context, - const ::bazel_re::WaitExecutionRequest* request, - ::grpc::ServerWriter<::google::longrunning::Operation>* writer) - -> ::grpc::Status override; + auto WaitExecution(::grpc::ServerContext* context, + const ::bazel_re::WaitExecutionRequest* request, + ::grpc::ServerWriter<::google::longrunning::Operation>* + writer) -> ::grpc::Status override; private: StorageConfig const& storage_config_; diff --git a/src/buildtool/execution_engine/dag/dag.hpp b/src/buildtool/execution_engine/dag/dag.hpp index 422e42c6..99a35f4b 100644 --- a/src/buildtool/execution_engine/dag/dag.hpp +++ b/src/buildtool/execution_engine/dag/dag.hpp @@ -134,8 +134,8 @@ class DirectedAcyclicGraph { NodeTraversalState() noexcept = default; NodeTraversalState(NodeTraversalState const&) = delete; NodeTraversalState(NodeTraversalState&&) = delete; - auto operator=(NodeTraversalState const&) - -> NodeTraversalState& = delete; + auto operator=(NodeTraversalState const&) -> NodeTraversalState& = + delete; auto operator=(NodeTraversalState&&) -> NodeTraversalState& = delete; ~NodeTraversalState() noexcept = default; diff --git a/src/buildtool/execution_engine/traverser/traverser.hpp b/src/buildtool/execution_engine/traverser/traverser.hpp index e99c2565..8cfb991f 100644 --- a/src/buildtool/execution_engine/traverser/traverser.hpp +++ b/src/buildtool/execution_engine/traverser/traverser.hpp @@ -31,10 +31,8 @@ template <class T> concept Runnable = requires(T const r, DependencyGraph::ActionNode const* action, DependencyGraph::ArtifactNode const* artifact) { - { r.Process(action) } - ->same_as<bool>; - { r.Process(artifact) } - ->same_as<bool>; + { r.Process(action) } -> same_as<bool>; + { r.Process(artifact) } -> same_as<bool>; }; /// \brief Class to traverse the dependency graph executing necessary actions @@ -67,9 +65,8 @@ class Traverser { // Traverse starting by the artifacts with the given identifiers, avoiding // executing actions that are not strictly needed to build the given // artifacts - [[nodiscard]] auto Traverse( - std::unordered_set<ArtifactIdentifier> const& target_ids) noexcept - -> bool; + [[nodiscard]] auto Traverse(std::unordered_set<ArtifactIdentifier> const& + target_ids) noexcept -> bool; private: Executor const& runner_{}; diff --git a/src/buildtool/file_system/file_system_manager.hpp b/src/buildtool/file_system/file_system_manager.hpp index 0e00537a..6cf8f256 100644 --- a/src/buildtool/file_system/file_system_manager.hpp +++ b/src/buildtool/file_system/file_system_manager.hpp @@ -246,11 +246,11 @@ class FileSystemManager { } template <ObjectType kType, bool kSetEpochTime = false> - requires(IsFileObject(kType)) - [[nodiscard]] static auto CreateFileHardlinkAs( - std::filesystem::path const& file_path, - std::filesystem::path const& link_path, - LogLevel log_failure_at = LogLevel::Error) noexcept -> bool { + requires(IsFileObject(kType)) + [[nodiscard]] static auto CreateFileHardlinkAs( + std::filesystem::path const& file_path, + std::filesystem::path const& link_path, + LogLevel log_failure_at = LogLevel::Error) noexcept -> bool { // Set permissions first (permissions are a property of the file) so // that the created link has the correct permissions as soon as the link // creation is finished. @@ -354,7 +354,8 @@ class FileSystemManager { template <ObjectType kType, bool kSetEpochTime = false, bool kSetWritable = false> - requires(IsFileObject(kType)) [[nodiscard]] static auto CopyFileAs( + requires(IsFileObject(kType)) + [[nodiscard]] static auto CopyFileAs( std::filesystem::path const& src, std::filesystem::path const& dst, bool fd_less = false, @@ -929,10 +930,10 @@ class FileSystemManager { template <ObjectType kType, bool kSetEpochTime = false, bool kSetWritable = false> - requires(IsFileObject(kType)) - [[nodiscard]] static auto WriteFileAs(std::string const& content, - std::filesystem::path const& file, - bool fd_less = false) noexcept + requires(IsFileObject(kType)) + [[nodiscard]] static auto WriteFileAs(std::string const& content, + std::filesystem::path const& file, + bool fd_less = false) noexcept -> bool { return WriteFile(content, file, fd_less) and SetFilePermissions<kSetWritable>(file, @@ -1336,6 +1337,6 @@ class FileSystemManager { } }; // class LowLevel -}; // class FileSystemManager +}; // class FileSystemManager #endif // INCLUDED_SRC_BUILDTOOL_FILE_SYSTEM_FILE_SYSTEM_MANAGER_HPP diff --git a/src/buildtool/file_system/git_cas.hpp b/src/buildtool/file_system/git_cas.hpp index f01d5617..c1223411 100644 --- a/src/buildtool/file_system/git_cas.hpp +++ b/src/buildtool/file_system/git_cas.hpp @@ -48,9 +48,8 @@ class GitCAS { /// \brief Read object from CAS. /// \param id The object id. /// \param is_hex_id Specify whether `id` is hex string or raw. - [[nodiscard]] auto ReadObject(std::string const& id, - bool is_hex_id = false) const noexcept - -> std::optional<std::string>; + [[nodiscard]] auto ReadObject(std::string const& id, bool is_hex_id = false) + const noexcept -> std::optional<std::string>; /// \brief Read object header from CAS. /// \param id The object id. @@ -59,9 +58,8 @@ class GitCAS { // Note that most backends do not support reading only the header of an // object, so the whole object will be read and then the header will be // returned. - [[nodiscard]] auto ReadHeader(std::string const& id, - bool is_hex_id = false) const noexcept - -> std::optional<std::pair<std::size_t, ObjectType>>; + [[nodiscard]] auto ReadHeader(std::string const& id, bool is_hex_id = false) + const noexcept -> std::optional<std::pair<std::size_t, ObjectType>>; private: std::unique_ptr<git_odb, decltype(&odb_closer)> odb_{nullptr, odb_closer}; diff --git a/src/buildtool/file_system/git_repo.cpp b/src/buildtool/file_system/git_repo.cpp index 5ab010d4..c75029ee 100644 --- a/src/buildtool/file_system/git_repo.cpp +++ b/src/buildtool/file_system/git_repo.cpp @@ -264,8 +264,8 @@ struct InMemoryODBBackend { return GIT_ERROR; } -[[nodiscard]] auto backend_exists(git_odb_backend* _backend, const git_oid* oid) - -> int { +[[nodiscard]] auto backend_exists(git_odb_backend* _backend, + const git_oid* oid) -> int { if (_backend != nullptr and oid != nullptr) { auto* b = reinterpret_cast<InMemoryODBBackend*>(_backend); // NOLINT if (auto id = ToRawString(*oid)) { diff --git a/src/buildtool/file_system/git_utils.cpp b/src/buildtool/file_system/git_utils.cpp index 8e45671b..8fed7d7b 100644 --- a/src/buildtool/file_system/git_utils.cpp +++ b/src/buildtool/file_system/git_utils.cpp @@ -40,8 +40,8 @@ auto GitLastError() noexcept -> std::string { return "<unknown error>"; } -auto GitObjectID(std::string const& id, bool is_hex_id) noexcept - -> std::optional<git_oid> { +auto GitObjectID(std::string const& id, + bool is_hex_id) noexcept -> std::optional<git_oid> { #ifdef BOOTSTRAP_BUILD_TOOL return std::nullopt; #else diff --git a/src/buildtool/logging/log_sink_cmdline.hpp b/src/buildtool/logging/log_sink_cmdline.hpp index 89990f1c..a30aee56 100644 --- a/src/buildtool/logging/log_sink_cmdline.hpp +++ b/src/buildtool/logging/log_sink_cmdline.hpp @@ -93,9 +93,8 @@ class LogSinkCmdLine final : public ILogSink { bool colored_{}; std::optional<LogLevel> restrict_level_{}; - [[nodiscard]] auto FormatPrefix(LogLevel level, - std::string const& prefix) const noexcept - -> std::string { + [[nodiscard]] auto FormatPrefix(LogLevel level, std::string const& prefix) + const noexcept -> std::string { fmt::text_style style{}; if (colored_) { switch (level) { diff --git a/src/buildtool/main/cli.hpp b/src/buildtool/main/cli.hpp index e03e9bec..4c28b1f6 100644 --- a/src/buildtool/main/cli.hpp +++ b/src/buildtool/main/cli.hpp @@ -57,7 +57,7 @@ struct CommandLineArguments { ToAddArguments to_add; }; -auto ParseCommandLineArguments(int argc, char const* const* argv) - -> CommandLineArguments; +auto ParseCommandLineArguments(int argc, + char const* const* argv) -> CommandLineArguments; #endif diff --git a/src/buildtool/progress_reporting/progress.hpp b/src/buildtool/progress_reporting/progress.hpp index 303617e1..f04a4657 100644 --- a/src/buildtool/progress_reporting/progress.hpp +++ b/src/buildtool/progress_reporting/progress.hpp @@ -33,10 +33,11 @@ class Progress { // Return a reference to the origin map. It is the responsibility of the // caller to ensure that access only happens in a single-threaded context. - [[nodiscard]] auto OriginMap() noexcept -> std::unordered_map< - std::string, - std::vector< - std::pair<BuildMaps::Target::ConfiguredTarget, std::size_t>>>& { + [[nodiscard]] auto OriginMap() noexcept + -> std::unordered_map< + std::string, + std::vector< + std::pair<BuildMaps::Target::ConfiguredTarget, std::size_t>>>& { return origin_map_; } diff --git a/src/buildtool/storage/compactifier.cpp b/src/buildtool/storage/compactifier.cpp index e6f9a344..1e6033ed 100644 --- a/src/buildtool/storage/compactifier.cpp +++ b/src/buildtool/storage/compactifier.cpp @@ -59,9 +59,9 @@ template <ObjectType kType> /// \return True if the entry directory doesn't contain spliced /// entries. template <ObjectType kLargeType, ObjectType... kType> -requires(sizeof...(kType) != 0) - [[nodiscard]] auto RemoveSpliced(CompactificationTask const& task, - std::filesystem::path const& key) noexcept + requires(sizeof...(kType) != 0) +[[nodiscard]] auto RemoveSpliced(CompactificationTask const& task, + std::filesystem::path const& key) noexcept -> bool; /// \brief Split and remove a key entry from the kType storage. Results of @@ -211,9 +211,9 @@ template <ObjectType kType> } template <ObjectType kLargeType, ObjectType... kType> -requires(sizeof...(kType) != 0) - [[nodiscard]] auto RemoveSpliced(CompactificationTask const& task, - std::filesystem::path const& key) noexcept + requires(sizeof...(kType) != 0) +[[nodiscard]] auto RemoveSpliced(CompactificationTask const& task, + std::filesystem::path const& key) noexcept -> bool { static constexpr bool kLarge = true; auto const directory = task.cas.StorageRoot(kLargeType, kLarge) / key; diff --git a/src/buildtool/storage/large_object_cas.hpp b/src/buildtool/storage/large_object_cas.hpp index 70f1e7d8..971b943d 100644 --- a/src/buildtool/storage/large_object_cas.hpp +++ b/src/buildtool/storage/large_object_cas.hpp @@ -163,7 +163,8 @@ class LargeObjectCAS final { /// \param digest The digest of the large entry to uplink. /// \returns True if the large entry was successfully uplinked. template <bool kIsLocalGeneration = not kDoGlobalUplink> - requires(kIsLocalGeneration) [[nodiscard]] auto LocalUplink( + requires(kIsLocalGeneration) + [[nodiscard]] auto LocalUplink( LocalCAS<false> const& latest, LargeObjectCAS<false, kType> const& latest_large, bazel_re::Digest const& digest) const noexcept -> bool; diff --git a/src/buildtool/storage/large_object_cas.tpp b/src/buildtool/storage/large_object_cas.tpp index dae1d696..5fbfee07 100644 --- a/src/buildtool/storage/large_object_cas.tpp +++ b/src/buildtool/storage/large_object_cas.tpp @@ -243,10 +243,11 @@ auto LargeObjectCAS<kDoGlobalUplink, kType>::Splice( template <bool kDoGlobalUplink, ObjectType kType> template <bool kIsLocalGeneration> -requires(kIsLocalGeneration) auto LargeObjectCAS<kDoGlobalUplink, kType>:: - LocalUplink(LocalCAS<false> const& latest, - LargeObjectCAS<false, kType> const& latest_large, - bazel_re::Digest const& digest) const noexcept -> bool { + requires(kIsLocalGeneration) +auto LargeObjectCAS<kDoGlobalUplink, kType>::LocalUplink( + LocalCAS<false> const& latest, + LargeObjectCAS<false, kType> const& latest_large, + bazel_re::Digest const& digest) const noexcept -> bool { // Check the large entry in the youngest generation: if (latest_large.GetEntryPath(digest)) { return true; diff --git a/src/buildtool/storage/local_ac.hpp b/src/buildtool/storage/local_ac.hpp index a93130a5..b39c63dd 100644 --- a/src/buildtool/storage/local_ac.hpp +++ b/src/buildtool/storage/local_ac.hpp @@ -82,7 +82,8 @@ class LocalAC { /// \param action_id The id of the action used as entry key. /// \returns True if entry was successfully uplinked. template <bool kIsLocalGeneration = not kDoGlobalUplink> - requires(kIsLocalGeneration) [[nodiscard]] auto LocalUplinkEntry( + requires(kIsLocalGeneration) + [[nodiscard]] auto LocalUplinkEntry( LocalGenerationAC const& latest, bazel_re::Digest const& action_id) const noexcept -> bool; diff --git a/src/buildtool/storage/local_ac.tpp b/src/buildtool/storage/local_ac.tpp index 5fee10ff..ee21e86a 100644 --- a/src/buildtool/storage/local_ac.tpp +++ b/src/buildtool/storage/local_ac.tpp @@ -54,7 +54,8 @@ auto LocalAC<kDoGlobalUplink>::CachedResult(bazel_re::Digest const& action_id) template <bool kDoGlobalUplink> template <bool kIsLocalGeneration> -requires(kIsLocalGeneration) auto LocalAC<kDoGlobalUplink>::LocalUplinkEntry( + requires(kIsLocalGeneration) +auto LocalAC<kDoGlobalUplink>::LocalUplinkEntry( LocalGenerationAC const& latest, bazel_re::Digest const& action_id) const noexcept -> bool { // Determine action cache key path in latest generation. diff --git a/src/buildtool/storage/local_cas.hpp b/src/buildtool/storage/local_cas.hpp index 287b1d7b..86bfc0e4 100644 --- a/src/buildtool/storage/local_cas.hpp +++ b/src/buildtool/storage/local_cas.hpp @@ -71,9 +71,8 @@ class LocalCAS { /// \brief Obtain path to the storage root. /// \param type Type of the storage to be obtained. /// \param large True if a large storage is needed. - [[nodiscard]] auto StorageRoot(ObjectType type, - bool large = false) const noexcept - -> std::filesystem::path const& { + [[nodiscard]] auto StorageRoot(ObjectType type, bool large = false) + const noexcept -> std::filesystem::path const& { if (large) { return IsTreeObject(type) ? cas_tree_large_.StorageRoot() : cas_file_large_.StorageRoot(); @@ -226,7 +225,8 @@ class LocalCAS { /// generation. /// \returns True if blob was successfully uplinked. template <bool kIsLocalGeneration = not kDoGlobalUplink> - requires(kIsLocalGeneration) [[nodiscard]] auto LocalUplinkBlob( + requires(kIsLocalGeneration) + [[nodiscard]] auto LocalUplinkBlob( LocalGenerationCAS const& latest, bazel_re::Digest const& digest, bool is_executable, @@ -248,7 +248,8 @@ class LocalCAS { /// generation. /// \returns True if tree was successfully uplinked. template <bool kIsLocalGeneration = not kDoGlobalUplink> - requires(kIsLocalGeneration) [[nodiscard]] auto LocalUplinkTree( + requires(kIsLocalGeneration) + [[nodiscard]] auto LocalUplinkTree( LocalGenerationCAS const& latest, bazel_re::Digest const& digest, bool splice_result = false) const noexcept -> bool; @@ -263,7 +264,8 @@ class LocalCAS { /// \param digest The digest of the large entry to uplink. /// \returns True if the large entry was successfully uplinked. template <ObjectType kType, bool kIsLocalGeneration = not kDoGlobalUplink> - requires(kIsLocalGeneration) [[nodiscard]] auto LocalUplinkLargeObject( + requires(kIsLocalGeneration) + [[nodiscard]] auto LocalUplinkLargeObject( LocalGenerationCAS const& latest, bazel_re::Digest const& digest) const noexcept -> bool; @@ -311,21 +313,23 @@ class LocalCAS { } template <bool kIsLocalGeneration = not kDoGlobalUplink> - requires(kIsLocalGeneration) [[nodiscard]] auto LocalUplinkGitTree( + requires(kIsLocalGeneration) + [[nodiscard]] auto LocalUplinkGitTree( LocalGenerationCAS const& latest, bazel_re::Digest const& digest, bool splice_result = false) const noexcept -> bool; template <bool kIsLocalGeneration = not kDoGlobalUplink> - requires(kIsLocalGeneration) [[nodiscard]] auto LocalUplinkBazelDirectory( + requires(kIsLocalGeneration) + [[nodiscard]] auto LocalUplinkBazelDirectory( LocalGenerationCAS const& latest, bazel_re::Digest const& digest, gsl::not_null<std::unordered_set<bazel_re::Digest>*> const& seen, bool splice_result = false) const noexcept -> bool; template <ObjectType kType, bool kIsLocalGeneration = not kDoGlobalUplink> - requires(kIsLocalGeneration) [[nodiscard]] auto TrySplice( - bazel_re::Digest const& digest) const noexcept + requires(kIsLocalGeneration) + [[nodiscard]] auto TrySplice(bazel_re::Digest const& digest) const noexcept -> std::optional<LargeObject>; template <ObjectType kType> diff --git a/src/buildtool/storage/local_cas.tpp b/src/buildtool/storage/local_cas.tpp index eba99a67..96224c3c 100644 --- a/src/buildtool/storage/local_cas.tpp +++ b/src/buildtool/storage/local_cas.tpp @@ -41,7 +41,8 @@ namespace detail { template <bool kDoGlobalUplink> template <bool kIsLocalGeneration> -requires(kIsLocalGeneration) auto LocalCAS<kDoGlobalUplink>::LocalUplinkBlob( + requires(kIsLocalGeneration) +auto LocalCAS<kDoGlobalUplink>::LocalUplinkBlob( LocalGenerationCAS const& latest, bazel_re::Digest const& digest, bool is_executable, @@ -92,7 +93,8 @@ requires(kIsLocalGeneration) auto LocalCAS<kDoGlobalUplink>::LocalUplinkBlob( template <bool kDoGlobalUplink> template <bool kIsLocalGeneration> -requires(kIsLocalGeneration) auto LocalCAS<kDoGlobalUplink>::LocalUplinkTree( + requires(kIsLocalGeneration) +auto LocalCAS<kDoGlobalUplink>::LocalUplinkTree( LocalGenerationCAS const& latest, bazel_re::Digest const& digest, bool splice_result) const noexcept -> bool { @@ -105,7 +107,8 @@ requires(kIsLocalGeneration) auto LocalCAS<kDoGlobalUplink>::LocalUplinkTree( template <bool kDoGlobalUplink> template <bool kIsLocalGeneration> -requires(kIsLocalGeneration) auto LocalCAS<kDoGlobalUplink>::LocalUplinkGitTree( + requires(kIsLocalGeneration) +auto LocalCAS<kDoGlobalUplink>::LocalUplinkGitTree( LocalGenerationCAS const& latest, bazel_re::Digest const& digest, bool splice_result) const noexcept -> bool { @@ -199,12 +202,12 @@ requires(kIsLocalGeneration) auto LocalCAS<kDoGlobalUplink>::LocalUplinkGitTree( template <bool kDoGlobalUplink> template <bool kIsLocalGeneration> -requires(kIsLocalGeneration) auto LocalCAS<kDoGlobalUplink>:: - LocalUplinkBazelDirectory( - LocalGenerationCAS const& latest, - bazel_re::Digest const& digest, - gsl::not_null<std::unordered_set<bazel_re::Digest>*> const& seen, - bool splice_result) const noexcept -> bool { + requires(kIsLocalGeneration) +auto LocalCAS<kDoGlobalUplink>::LocalUplinkBazelDirectory( + LocalGenerationCAS const& latest, + bazel_re::Digest const& digest, + gsl::not_null<std::unordered_set<bazel_re::Digest>*> const& seen, + bool splice_result) const noexcept -> bool { // Skip already uplinked directories if (seen->contains(digest)) { return true; @@ -271,10 +274,10 @@ requires(kIsLocalGeneration) auto LocalCAS<kDoGlobalUplink>:: template <bool kDoGlobalUplink> template <ObjectType kType, bool kIsLocalGeneration> -requires(kIsLocalGeneration) auto LocalCAS<kDoGlobalUplink>:: - LocalUplinkLargeObject(LocalGenerationCAS const& latest, - bazel_re::Digest const& digest) const noexcept - -> bool { + requires(kIsLocalGeneration) +auto LocalCAS<kDoGlobalUplink>::LocalUplinkLargeObject( + LocalGenerationCAS const& latest, + bazel_re::Digest const& digest) const noexcept -> bool { if constexpr (IsTreeObject(kType)) { return cas_tree_large_.LocalUplink( latest, latest.cas_tree_large_, digest); @@ -287,9 +290,9 @@ requires(kIsLocalGeneration) auto LocalCAS<kDoGlobalUplink>:: template <bool kDoGlobalUplink> template <ObjectType kType, bool kIsLocalGeneration> -requires(kIsLocalGeneration) auto LocalCAS<kDoGlobalUplink>::TrySplice( - bazel_re::Digest const& digest) const noexcept - -> std::optional<LargeObject> { + requires(kIsLocalGeneration) +auto LocalCAS<kDoGlobalUplink>::TrySplice(bazel_re::Digest const& digest) + const noexcept -> std::optional<LargeObject> { auto spliced = IsTreeObject(kType) ? cas_tree_large_.TrySplice(digest) : cas_file_large_.TrySplice(digest); return spliced and spliced->IsValid() ? std::optional{std::move(*spliced)} diff --git a/src/buildtool/storage/target_cache.hpp b/src/buildtool/storage/target_cache.hpp index 2f52e100..6feff6a2 100644 --- a/src/buildtool/storage/target_cache.hpp +++ b/src/buildtool/storage/target_cache.hpp @@ -112,7 +112,8 @@ class TargetCache { /// \param key The target-cache key for the entry to uplink. /// \returns True if entry was successfully uplinked. template <bool kIsLocalGeneration = not kDoGlobalUplink> - requires(kIsLocalGeneration) [[nodiscard]] auto LocalUplinkEntry( + requires(kIsLocalGeneration) + [[nodiscard]] auto LocalUplinkEntry( LocalGenerationTC const& latest, TargetCacheKey const& key) const noexcept -> bool; @@ -140,7 +141,8 @@ class TargetCache { explicit_shard_{explicit_shard} {} template <bool kIsLocalGeneration = not kDoGlobalUplink> - requires(kIsLocalGeneration) [[nodiscard]] auto LocalUplinkEntry( + requires(kIsLocalGeneration) + [[nodiscard]] auto LocalUplinkEntry( LocalGenerationTC const& latest, std::string const& key_digest) const noexcept -> bool; diff --git a/src/buildtool/storage/target_cache.tpp b/src/buildtool/storage/target_cache.tpp index 9ddd19d2..502c346a 100644 --- a/src/buildtool/storage/target_cache.tpp +++ b/src/buildtool/storage/target_cache.tpp @@ -113,18 +113,19 @@ auto TargetCache<kDoGlobalUplink>::Read( template <bool kDoGlobalUplink> template <bool kIsLocalGeneration> -requires(kIsLocalGeneration) auto TargetCache< - kDoGlobalUplink>::LocalUplinkEntry(LocalGenerationTC const& latest, - TargetCacheKey const& key) const noexcept - -> bool { + requires(kIsLocalGeneration) +auto TargetCache<kDoGlobalUplink>::LocalUplinkEntry( + LocalGenerationTC const& latest, + TargetCacheKey const& key) const noexcept -> bool { return LocalUplinkEntry(latest, key.Id().digest.hash()); } template <bool kDoGlobalUplink> template <bool kIsLocalGeneration> -requires(kIsLocalGeneration) auto TargetCache<kDoGlobalUplink>:: - LocalUplinkEntry(LocalGenerationTC const& latest, - std::string const& key_digest) const noexcept -> bool { + requires(kIsLocalGeneration) +auto TargetCache<kDoGlobalUplink>::LocalUplinkEntry( + LocalGenerationTC const& latest, + std::string const& key_digest) const noexcept -> bool { // Determine target cache key path of given generation. if (FileSystemManager::IsFile(latest.file_store_.GetPath(key_digest))) { return true; diff --git a/src/other_tools/just_mr/mirrors.hpp b/src/other_tools/just_mr/mirrors.hpp index 8b7dae30..f3fa8b14 100644 --- a/src/other_tools/just_mr/mirrors.hpp +++ b/src/other_tools/just_mr/mirrors.hpp @@ -113,9 +113,8 @@ namespace MirrorsUtils { hostnames.begin(), hostnames.end(), std::inserter(mirrors_by_hostname, mirrors_by_hostname.end()), - [](auto const& hostname) -> typename map_t::value_type { - return {hostname, {/*empty*/}}; - }); + [](auto const& hostname) -> + typename map_t::value_type { return {hostname, {/*empty*/}}; }); // fill mirrors list per hostname for (auto const& mirror : mirrors) { diff --git a/src/utils/archive/archive_ops.cpp b/src/utils/archive/archive_ops.cpp index 59b1d8a0..8e70c814 100644 --- a/src/utils/archive/archive_ops.cpp +++ b/src/utils/archive/archive_ops.cpp @@ -95,8 +95,8 @@ auto enable_read_filter(archive* ar, ArchiveType type) -> bool { } // namespace #endif // BOOTSTRAP_BUILD_TOOL -auto ArchiveOps::WriteEntry(archive_entry* entry, archive* aw) - -> std::optional<std::string> { +auto ArchiveOps::WriteEntry(archive_entry* entry, + archive* aw) -> std::optional<std::string> { #ifndef BOOTSTRAP_BUILD_TOOL std::filesystem::path entry_path{archive_entry_sourcepath(entry)}; // only write to archive if entry is file @@ -115,8 +115,8 @@ auto ArchiveOps::WriteEntry(archive_entry* entry, archive* aw) return std::nullopt; } -auto ArchiveOps::CopyData(archive* ar, archive* aw) - -> std::optional<std::string> { +auto ArchiveOps::CopyData(archive* ar, + archive* aw) -> std::optional<std::string> { #ifndef BOOTSTRAP_BUILD_TOOL int r{}; const void* buff{nullptr}; diff --git a/src/utils/cpp/atomic.hpp b/src/utils/cpp/atomic.hpp index 13dc8ca9..4ef7e40c 100644 --- a/src/utils/cpp/atomic.hpp +++ b/src/utils/cpp/atomic.hpp @@ -102,8 +102,8 @@ class atomic_shared_ptr { atomic_shared_ptr(atomic_shared_ptr&& other) = delete; ~atomic_shared_ptr() = default; - auto operator=(atomic_shared_ptr const& other) - -> atomic_shared_ptr& = delete; + auto operator=(atomic_shared_ptr const& other) -> atomic_shared_ptr& = + delete; auto operator=(atomic_shared_ptr&& other) -> atomic_shared_ptr& = delete; auto operator=(ptr_t desired) -> ptr_t { // NOLINT std::shared_lock lock(mutex_); diff --git a/src/utils/cpp/concepts.hpp b/src/utils/cpp/concepts.hpp index 548fb960..90946762 100644 --- a/src/utils/cpp/concepts.hpp +++ b/src/utils/cpp/concepts.hpp @@ -22,71 +22,72 @@ // TODO(modernize): remove this once std::derived_from is shipped with libcxx template <class T, class U> -concept derived_from = std::is_base_of_v<U, T>&& +concept derived_from = + std::is_base_of_v<U, T> && std::is_convertible_v<const volatile T*, const volatile U*>; // TODO(modernize): remove this once std::same_as is shipped with libcxx template <class T, class U> -concept same_as = std::is_same_v<T, U>and std::is_same_v<U, T>; +concept same_as = std::is_same_v<T, U> and std::is_same_v<U, T>; template <class T> -concept ContainsString = requires { - typename T::value_type; -} -and std::is_same_v<typename T::value_type, std::string>; +concept ContainsString = requires { typename T::value_type; } and + std::is_same_v<typename T::value_type, std::string>; template <class T> concept HasSize = requires(T const c) { - { c.size() } - ->same_as<std::size_t>; // TODO(modernize): replace by std::same_as + { + c.size() + } -> same_as<std::size_t>; // TODO(modernize): replace by std::same_as }; template <typename T> concept HasToString = requires(T const t) { - { t.ToString() } - ->same_as<std::string>; // TODO(modernize): replace by std::same_as + { + t.ToString() + } -> same_as<std::string>; // TODO(modernize): replace by std::same_as }; template <class T> concept InputIterableContainer = requires(T const c) { - { c.begin() } - ->same_as<typename T::const_iterator>; // TODO(modernize): replace by - // std::input_iterator - { c.end() } - ->same_as<typename T::const_iterator>; // TODO(modernize): replace by - // std::input_iterator + { + c.begin() + } -> same_as<typename T::const_iterator>; // TODO(modernize): replace by + // std::input_iterator + { + c.end() + } -> same_as<typename T::const_iterator>; // TODO(modernize): replace by + // std::input_iterator }; template <class T> -concept OutputIterableContainer = InputIterableContainer<T>and requires(T c) { - { std::inserter(c, c.begin()) } - ->same_as<std::insert_iterator<T>>; // TODO(modernize): replace by - // std::output_iterator +concept OutputIterableContainer = InputIterableContainer<T> and requires(T c) { + { + std::inserter(c, c.begin()) + } -> same_as<std::insert_iterator<T>>; // TODO(modernize): replace by + // std::output_iterator }; template <class T> concept InputIterableStringContainer = - InputIterableContainer<T>and ContainsString<T>; + InputIterableContainer<T> and ContainsString<T>; // TODO(modernize): remove this once we require clang version >= 14.0.0 template <typename T> concept ClockHasFromSys = requires(std::chrono::time_point<std::chrono::system_clock> const tp) { - T::from_sys(tp); -}; + T::from_sys(tp); + }; // TODO(modernize): remove this once we require clang version >= 14.0.0 template <typename T> -concept ClockHasFromTime = requires(std::time_t const t) { - T::from_time_t(t); -}; +concept ClockHasFromTime = requires(std::time_t const t) { T::from_time_t(t); }; template <typename T> concept StrMapConstForwardIterator = requires(T const c) { { - std::remove_reference_t<decltype((*c).first)> { (*c).first } - } - ->same_as<std::string const>; + std::remove_reference_t<decltype((*c).first)>{(*c).first} + } -> same_as<std::string const>; }; #endif // INCLUDED_SRC_UTILS_CPP_CONCEPTS_HPP diff --git a/src/utils/cpp/hash_combine.hpp b/src/utils/cpp/hash_combine.hpp index a09c9985..78fed417 100644 --- a/src/utils/cpp/hash_combine.hpp +++ b/src/utils/cpp/hash_combine.hpp @@ -22,8 +22,8 @@ // Taken from Boost, as hash_combine did not yet make it to STL. // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0814r0.pdf template <class T> -inline auto hash_combine(gsl::not_null<std::size_t*> const& seed, T const& v) - -> void { +inline auto hash_combine(gsl::not_null<std::size_t*> const& seed, + T const& v) -> void { *seed ^= std::hash<T>{}(v) + 0x9e3779b9 + (*seed << 6) + (*seed >> 2); // NOLINT } diff --git a/src/utils/cpp/json.hpp b/src/utils/cpp/json.hpp index 64c208a7..1fe4df3f 100644 --- a/src/utils/cpp/json.hpp +++ b/src/utils/cpp/json.hpp @@ -33,8 +33,8 @@ auto ExtractValueAs( nlohmann::json const& j, std::string const& key, std::function<void(std::string const& error)>&& logger = - [](std::string const& /*unused*/) -> void {}) noexcept - -> std::optional<ValueT> { + [](std::string const& /*unused*/) -> void { + }) noexcept -> std::optional<ValueT> { try { auto it = j.find(key); if (it == j.end()) { diff --git a/src/utils/cpp/type_safe_arithmetic.hpp b/src/utils/cpp/type_safe_arithmetic.hpp index 373f76fc..be2ca405 100644 --- a/src/utils/cpp/type_safe_arithmetic.hpp +++ b/src/utils/cpp/type_safe_arithmetic.hpp @@ -70,10 +70,10 @@ class type_safe_arithmetic { type_safe_arithmetic(type_safe_arithmetic const&) = default; type_safe_arithmetic(type_safe_arithmetic&&) noexcept = default; - auto operator=(type_safe_arithmetic const&) - -> type_safe_arithmetic& = default; - auto operator=(type_safe_arithmetic&&) noexcept - -> type_safe_arithmetic& = default; + auto operator=(type_safe_arithmetic const&) -> type_safe_arithmetic& = + default; + auto operator=(type_safe_arithmetic&&) noexcept -> type_safe_arithmetic& = + default; ~type_safe_arithmetic() = default; auto operator=(value_t value) -> type_safe_arithmetic& { @@ -138,8 +138,8 @@ class type_safe_arithmetic { // } template <typename TAG> -auto operator+=(type_safe_arithmetic<TAG>& lhs, type_safe_arithmetic<TAG> rhs) - -> type_safe_arithmetic<TAG>& { +auto operator+=(type_safe_arithmetic<TAG>& lhs, + type_safe_arithmetic<TAG> rhs) -> type_safe_arithmetic<TAG>& { lhs.set(lhs.get() + rhs.get()); return lhs; } @@ -189,8 +189,8 @@ auto operator+=(type_safe_arithmetic<TAG>& lhs, type_safe_arithmetic<TAG> rhs) // } template <typename TAG> -auto operator++(type_safe_arithmetic<TAG>& a, int) - -> type_safe_arithmetic<TAG> { +auto operator++(type_safe_arithmetic<TAG>& a, + int) -> type_safe_arithmetic<TAG> { auto r = a; a += type_safe_arithmetic<TAG>{1}; return r; diff --git a/test/buildtool/build_engine/base_maps/directory_map.test.cpp b/test/buildtool/build_engine/base_maps/directory_map.test.cpp index d001f50e..b59c4ff0 100644 --- a/test/buildtool/build_engine/base_maps/directory_map.test.cpp +++ b/test/buildtool/build_engine/base_maps/directory_map.test.cpp @@ -12,13 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/build_engine/base_maps/directory_map.hpp" + #include <filesystem> #include <memory> #include <string> #include <utility> // std::move #include "catch2/catch_test_macros.hpp" -#include "src/buildtool/build_engine/base_maps/directory_map.hpp" #include "src/buildtool/build_engine/base_maps/module_name.hpp" #include "src/buildtool/common/repository_config.hpp" #include "src/buildtool/file_system/file_root.hpp" diff --git a/test/buildtool/build_engine/base_maps/entity_name.test.cpp b/test/buildtool/build_engine/base_maps/entity_name.test.cpp index 223de0fc..be88f017 100644 --- a/test/buildtool/build_engine/base_maps/entity_name.test.cpp +++ b/test/buildtool/build_engine/base_maps/entity_name.test.cpp @@ -12,9 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "catch2/catch_test_macros.hpp" #include "src/buildtool/build_engine/base_maps/entity_name.hpp" +#include "catch2/catch_test_macros.hpp" + TEST_CASE("Normal module names") { using NT = BuildMaps::Base::NamedTarget; CHECK(NT::normal_module_name("foo/bar") == "foo/bar"); diff --git a/test/buildtool/build_engine/base_maps/expression_map.test.cpp b/test/buildtool/build_engine/base_maps/expression_map.test.cpp index 21cf1e50..04d5b86e 100644 --- a/test/buildtool/build_engine/base_maps/expression_map.test.cpp +++ b/test/buildtool/build_engine/base_maps/expression_map.test.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/build_engine/base_maps/expression_map.hpp" + #include <filesystem> #include <functional> #include <memory> @@ -20,7 +22,6 @@ #include "catch2/catch_test_macros.hpp" #include "src/buildtool/build_engine/base_maps/entity_name_data.hpp" -#include "src/buildtool/build_engine/base_maps/expression_map.hpp" #include "src/buildtool/build_engine/base_maps/json_file_map.hpp" #include "src/buildtool/build_engine/expression/expression.hpp" #include "src/buildtool/common/repository_config.hpp" diff --git a/test/buildtool/build_engine/base_maps/json_file_map.test.cpp b/test/buildtool/build_engine/base_maps/json_file_map.test.cpp index 91e74877..be657cff 100644 --- a/test/buildtool/build_engine/base_maps/json_file_map.test.cpp +++ b/test/buildtool/build_engine/base_maps/json_file_map.test.cpp @@ -12,13 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/build_engine/base_maps/json_file_map.hpp" + #include <filesystem> #include <memory> #include <string> #include <utility> #include "catch2/catch_test_macros.hpp" -#include "src/buildtool/build_engine/base_maps/json_file_map.hpp" #include "src/buildtool/common/repository_config.hpp" #include "src/buildtool/file_system/file_root.hpp" #include "src/buildtool/multithreading/task_system.hpp" @@ -28,8 +29,8 @@ namespace { using namespace BuildMaps::Base; // NOLINT -auto SetupConfig(std::string target_file_name, bool use_git) - -> RepositoryConfig { +auto SetupConfig(std::string target_file_name, + bool use_git) -> RepositoryConfig { auto root = FileRoot{kBasePath}; if (use_git) { auto repo_path = CreateTestRepo(); diff --git a/test/buildtool/build_engine/base_maps/rule_map.test.cpp b/test/buildtool/build_engine/base_maps/rule_map.test.cpp index 97e9c06d..87a76c2b 100644 --- a/test/buildtool/build_engine/base_maps/rule_map.test.cpp +++ b/test/buildtool/build_engine/base_maps/rule_map.test.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/build_engine/base_maps/rule_map.hpp" + #include <filesystem> #include <functional> #include <memory> @@ -22,7 +24,6 @@ #include "src/buildtool/build_engine/base_maps/entity_name_data.hpp" #include "src/buildtool/build_engine/base_maps/expression_map.hpp" #include "src/buildtool/build_engine/base_maps/json_file_map.hpp" -#include "src/buildtool/build_engine/base_maps/rule_map.hpp" #include "src/buildtool/build_engine/expression/configuration.hpp" #include "src/buildtool/build_engine/expression/expression.hpp" #include "src/buildtool/common/repository_config.hpp" diff --git a/test/buildtool/build_engine/base_maps/source_map.test.cpp b/test/buildtool/build_engine/base_maps/source_map.test.cpp index 36a58895..44c6863a 100644 --- a/test/buildtool/build_engine/base_maps/source_map.test.cpp +++ b/test/buildtool/build_engine/base_maps/source_map.test.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/build_engine/base_maps/source_map.hpp" + #include <filesystem> #include <memory> #include <optional> @@ -23,7 +25,6 @@ #include "src/buildtool/build_engine/base_maps/directory_map.hpp" #include "src/buildtool/build_engine/base_maps/entity_name.hpp" #include "src/buildtool/build_engine/base_maps/entity_name_data.hpp" -#include "src/buildtool/build_engine/base_maps/source_map.hpp" #include "src/buildtool/common/repository_config.hpp" #include "src/buildtool/file_system/file_root.hpp" #include "src/buildtool/multithreading/async_map_consumer.hpp" @@ -56,12 +57,11 @@ auto SetupConfig(bool use_git) -> RepositoryConfig { return repo_config; } -auto ReadSourceTarget( - EntityName const& id, - SourceTargetMap::Consumer consumer, - bool use_git = false, - std::optional<SourceTargetMap::FailureFunction> fail_func = std::nullopt) - -> bool { +auto ReadSourceTarget(EntityName const& id, + SourceTargetMap::Consumer consumer, + bool use_git = false, + std::optional<SourceTargetMap::FailureFunction> + fail_func = std::nullopt) -> bool { auto repo_config = SetupConfig(use_git); auto directory_entries = CreateDirectoryEntriesMap(&repo_config); auto source_artifacts = diff --git a/test/buildtool/build_engine/expression/configuration.test.cpp b/test/buildtool/build_engine/expression/configuration.test.cpp index 7f54748d..0a902c73 100644 --- a/test/buildtool/build_engine/expression/configuration.test.cpp +++ b/test/buildtool/build_engine/expression/configuration.test.cpp @@ -12,11 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/build_engine/expression/configuration.hpp" + #include <string> #include <vector> #include "catch2/catch_test_macros.hpp" -#include "src/buildtool/build_engine/expression/configuration.hpp" #include "src/buildtool/build_engine/expression/expression.hpp" #include "test/utils/container_matchers.hpp" diff --git a/test/buildtool/build_engine/expression/expression.test.cpp b/test/buildtool/build_engine/expression/expression.test.cpp index 83d6a2fe..aaca1c71 100644 --- a/test/buildtool/build_engine/expression/expression.test.cpp +++ b/test/buildtool/build_engine/expression/expression.test.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/build_engine/expression/expression.hpp" + #include <filesystem> #include <sstream> #include <string> @@ -20,7 +22,6 @@ #include "catch2/catch_test_macros.hpp" #include "catch2/matchers/catch_matchers_all.hpp" #include "src/buildtool/build_engine/expression/configuration.hpp" -#include "src/buildtool/build_engine/expression/expression.hpp" #include "src/buildtool/build_engine/expression/function_map.hpp" #include "src/buildtool/common/artifact_description.hpp" #include "test/utils/container_matchers.hpp" @@ -291,8 +292,9 @@ concept ValidExpressionTypeOrPtr = Expression::IsValidType<T>() or std::is_same_v<T, ExpressionPtr>; template <ValidExpressionTypeOrPtr T> -auto Add(ExpressionPtr const& expr, std::string const& key, T const& by) - -> ExpressionPtr { +auto Add(ExpressionPtr const& expr, + std::string const& key, + T const& by) -> ExpressionPtr { try { auto new_map = Expression::map_t::underlying_map_t{}; new_map.emplace(key, by); @@ -303,8 +305,9 @@ auto Add(ExpressionPtr const& expr, std::string const& key, T const& by) } template <ValidExpressionTypeOrPtr T> -auto Replace(ExpressionPtr const& expr, std::string const& key, T const& by) - -> ExpressionPtr { +auto Replace(ExpressionPtr const& expr, + std::string const& key, + T const& by) -> ExpressionPtr { auto const& map = expr->Map(); if (not map.contains(key)) { return ExpressionPtr{nullptr}; diff --git a/test/buildtool/build_engine/expression/linked_map.test.cpp b/test/buildtool/build_engine/expression/linked_map.test.cpp index 4c9a996f..4d0bf993 100644 --- a/test/buildtool/build_engine/expression/linked_map.test.cpp +++ b/test/buildtool/build_engine/expression/linked_map.test.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/build_engine/expression/linked_map.hpp" + #include <algorithm> #include <cstddef> #include <memory> @@ -19,7 +21,6 @@ #include <utility> // std::move #include "catch2/catch_test_macros.hpp" -#include "src/buildtool/build_engine/expression/linked_map.hpp" #include "test/utils/container_matchers.hpp" TEST_CASE("Empty map", "[linked_map]") { diff --git a/test/buildtool/build_engine/target_map/result_map.test.cpp b/test/buildtool/build_engine/target_map/result_map.test.cpp index 56fbfbd6..c781d83c 100644 --- a/test/buildtool/build_engine/target_map/result_map.test.cpp +++ b/test/buildtool/build_engine/target_map/result_map.test.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/build_engine/target_map/result_map.hpp" + #include <cstdlib> #include <filesystem> #include <fstream> @@ -23,7 +25,6 @@ #include "nlohmann/json.hpp" #include "src/buildtool/build_engine/analysed_target/analysed_target.hpp" #include "src/buildtool/build_engine/expression/target_result.hpp" -#include "src/buildtool/build_engine/target_map/result_map.hpp" #include "src/buildtool/common/action_description.hpp" #include "src/buildtool/common/statistics.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" diff --git a/test/buildtool/build_engine/target_map/target_map.test.cpp b/test/buildtool/build_engine/target_map/target_map.test.cpp index 85d3b104..cb8aa230 100644 --- a/test/buildtool/build_engine/target_map/target_map.test.cpp +++ b/test/buildtool/build_engine/target_map/target_map.test.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/build_engine/target_map/target_map.hpp" + #include <filesystem> #include <string> #include <utility> // std::move @@ -25,7 +27,6 @@ #include "src/buildtool/build_engine/base_maps/source_map.hpp" #include "src/buildtool/build_engine/base_maps/targets_file_map.hpp" #include "src/buildtool/build_engine/expression/expression.hpp" -#include "src/buildtool/build_engine/target_map/target_map.hpp" #include "src/buildtool/common/remote/retry_config.hpp" #include "src/buildtool/common/repository_config.hpp" #include "src/buildtool/common/statistics.hpp" diff --git a/test/buildtool/common/action_description.test.cpp b/test/buildtool/common/action_description.test.cpp index c79caeaa..eab2cc48 100644 --- a/test/buildtool/common/action_description.test.cpp +++ b/test/buildtool/common/action_description.test.cpp @@ -12,12 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/common/action_description.hpp" + #include <filesystem> #include "catch2/catch_test_macros.hpp" #include "nlohmann/json.hpp" #include "src/buildtool/common/action.hpp" -#include "src/buildtool/common/action_description.hpp" #include "src/buildtool/common/artifact_description.hpp" TEST_CASE("From JSON", "[action_description]") { diff --git a/test/buildtool/common/artifact_description.test.cpp b/test/buildtool/common/artifact_description.test.cpp index 76e49e34..c6d3a8d5 100644 --- a/test/buildtool/common/artifact_description.test.cpp +++ b/test/buildtool/common/artifact_description.test.cpp @@ -12,17 +12,18 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/common/artifact_description.hpp" + #include <filesystem> #include <string> #include "catch2/catch_test_macros.hpp" #include "nlohmann/json.hpp" #include "src/buildtool/common/artifact.hpp" -#include "src/buildtool/common/artifact_description.hpp" #include "src/buildtool/file_system/object_type.hpp" -[[nodiscard]] auto operator==(Artifact const& lhs, Artifact const& rhs) - -> bool { +[[nodiscard]] auto operator==(Artifact const& lhs, + Artifact const& rhs) -> bool { return lhs.Id() == rhs.Id() and lhs.FilePath() == rhs.FilePath() and lhs.Info() == rhs.Info(); } diff --git a/test/buildtool/common/repository_config.test.cpp b/test/buildtool/common/repository_config.test.cpp index 4fd8362b..931ead30 100644 --- a/test/buildtool/common/repository_config.test.cpp +++ b/test/buildtool/common/repository_config.test.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/common/repository_config.hpp" + #include <atomic> #include <cstddef> #include <filesystem> @@ -24,7 +26,6 @@ #include "catch2/catch_test_macros.hpp" #include "nlohmann/json.hpp" #include "src/buildtool/common/artifact_digest.hpp" -#include "src/buildtool/common/repository_config.hpp" #include "src/buildtool/file_system/file_root.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" #include "src/buildtool/storage/config.hpp" @@ -86,8 +87,8 @@ template <class T> } // Read graph from CAS -[[nodiscard]] auto ReadGraph(Storage const& storage, std::string const& hash) - -> nlohmann::json { +[[nodiscard]] auto ReadGraph(Storage const& storage, + std::string const& hash) -> nlohmann::json { auto const& cas = storage.CAS(); auto blob = cas.BlobPath( ArtifactDigest{hash, /*does not matter*/ 0, /*is_tree=*/false}, diff --git a/test/buildtool/crypto/hash_function.test.cpp b/test/buildtool/crypto/hash_function.test.cpp index 61c92eb9..89c073f4 100644 --- a/test/buildtool/crypto/hash_function.test.cpp +++ b/test/buildtool/crypto/hash_function.test.cpp @@ -12,11 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/crypto/hash_function.hpp" + #include <string> #include <utility> // std::move #include "catch2/catch_test_macros.hpp" -#include "src/buildtool/crypto/hash_function.hpp" TEST_CASE("Hash Function", "[crypto]") { std::string bytes{"test"}; diff --git a/test/buildtool/crypto/hasher.test.cpp b/test/buildtool/crypto/hasher.test.cpp index 4f5e8448..8414cc81 100644 --- a/test/buildtool/crypto/hasher.test.cpp +++ b/test/buildtool/crypto/hasher.test.cpp @@ -12,11 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/crypto/hasher.hpp" + #include <string> #include <utility> // std::move #include "catch2/catch_test_macros.hpp" -#include "src/buildtool/crypto/hasher.hpp" template <Hasher::HashType type> void test_increment_hash(std::string const& bytes, std::string const& result) { diff --git a/test/buildtool/execution_api/bazel/bazel_api.test.cpp b/test/buildtool/execution_api/bazel/bazel_api.test.cpp index 3ebee8d2..bced4a87 100644 --- a/test/buildtool/execution_api/bazel/bazel_api.test.cpp +++ b/test/buildtool/execution_api/bazel/bazel_api.test.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/execution_api/remote/bazel/bazel_api.hpp" + #include <cstdlib> #include <string> @@ -19,7 +21,6 @@ #include "src/buildtool/common/remote/retry_config.hpp" #include "src/buildtool/compatibility/compatibility.hpp" #include "src/buildtool/crypto/hash_function.hpp" -#include "src/buildtool/execution_api/remote/bazel/bazel_api.hpp" #include "src/buildtool/execution_api/remote/config.hpp" #include "test/buildtool/execution_api/common/api_test.hpp" #include "test/utils/remote_execution/test_auth_config.hpp" diff --git a/test/buildtool/execution_api/bazel/bazel_cas_client.test.cpp b/test/buildtool/execution_api/bazel/bazel_cas_client.test.cpp index 3aae8db2..bd005497 100644 --- a/test/buildtool/execution_api/bazel/bazel_cas_client.test.cpp +++ b/test/buildtool/execution_api/bazel/bazel_cas_client.test.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/execution_api/remote/bazel/bazel_cas_client.hpp" + #include <functional> // std::equal_to #include <string> #include <vector> @@ -22,7 +24,6 @@ #include "src/buildtool/common/remote/retry_config.hpp" #include "src/buildtool/crypto/hash_function.hpp" #include "src/buildtool/execution_api/bazel_msg/bazel_blob_container.hpp" -#include "src/buildtool/execution_api/remote/bazel/bazel_cas_client.hpp" #include "src/buildtool/execution_api/remote/bazel/bazel_execution_client.hpp" #include "src/buildtool/execution_api/remote/config.hpp" #include "src/buildtool/file_system/object_type.hpp" diff --git a/test/buildtool/execution_api/bazel/bazel_execution_client.test.cpp b/test/buildtool/execution_api/bazel/bazel_execution_client.test.cpp index d569f884..093c4eb1 100644 --- a/test/buildtool/execution_api/bazel/bazel_execution_client.test.cpp +++ b/test/buildtool/execution_api/bazel/bazel_execution_client.test.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/execution_api/remote/bazel/bazel_execution_client.hpp" + #include <string> #include "catch2/catch_test_macros.hpp" @@ -19,7 +21,6 @@ #include "src/buildtool/common/remote/retry_config.hpp" #include "src/buildtool/compatibility/compatibility.hpp" #include "src/buildtool/crypto/hash_function.hpp" -#include "src/buildtool/execution_api/remote/bazel/bazel_execution_client.hpp" #include "src/buildtool/execution_api/remote/config.hpp" #include "src/buildtool/file_system/object_type.hpp" #include "test/utils/remote_execution/bazel_action_creator.hpp" diff --git a/test/buildtool/execution_api/bazel/bazel_msg_factory.test.cpp b/test/buildtool/execution_api/bazel/bazel_msg_factory.test.cpp index fa6c3d4d..2c4035b0 100644 --- a/test/buildtool/execution_api/bazel/bazel_msg_factory.test.cpp +++ b/test/buildtool/execution_api/bazel/bazel_msg_factory.test.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/execution_api/bazel_msg/bazel_msg_factory.hpp" + #include <filesystem> #include <unordered_map> @@ -20,7 +22,6 @@ #include "src/buildtool/compatibility/compatibility.hpp" #include "src/buildtool/crypto/hash_function.hpp" #include "src/buildtool/execution_api/bazel_msg/bazel_blob_container.hpp" -#include "src/buildtool/execution_api/bazel_msg/bazel_msg_factory.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" #include "src/buildtool/file_system/object_type.hpp" #include "test/utils/blob_creator.hpp" diff --git a/test/buildtool/execution_api/bazel/bazel_network.test.cpp b/test/buildtool/execution_api/bazel/bazel_network.test.cpp index 1103c52b..edc35ea7 100644 --- a/test/buildtool/execution_api/bazel/bazel_network.test.cpp +++ b/test/buildtool/execution_api/bazel/bazel_network.test.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/execution_api/remote/bazel/bazel_network.hpp" + #include <cstddef> #include <optional> #include <string> @@ -25,7 +27,6 @@ #include "src/buildtool/crypto/hash_function.hpp" #include "src/buildtool/execution_api/bazel_msg/bazel_blob_container.hpp" #include "src/buildtool/execution_api/remote/bazel/bazel_execution_client.hpp" -#include "src/buildtool/execution_api/remote/bazel/bazel_network.hpp" #include "src/buildtool/execution_api/remote/config.hpp" #include "src/buildtool/file_system/object_type.hpp" #include "test/utils/remote_execution/test_auth_config.hpp" diff --git a/test/buildtool/execution_api/bazel/bytestream_client.test.cpp b/test/buildtool/execution_api/bazel/bytestream_client.test.cpp index dbf965dd..fba05118 100644 --- a/test/buildtool/execution_api/bazel/bytestream_client.test.cpp +++ b/test/buildtool/execution_api/bazel/bytestream_client.test.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/execution_api/remote/bazel/bytestream_client.hpp" + #include <cstddef> #include <optional> #include <string> @@ -23,7 +25,6 @@ #include "src/buildtool/crypto/hash_function.hpp" #include "src/buildtool/execution_api/bazel_msg/bazel_blob_container.hpp" #include "src/buildtool/execution_api/common/execution_common.hpp" -#include "src/buildtool/execution_api/remote/bazel/bytestream_client.hpp" #include "src/buildtool/execution_api/remote/config.hpp" #include "src/buildtool/file_system/object_type.hpp" #include "test/utils/remote_execution/test_auth_config.hpp" diff --git a/test/buildtool/execution_api/execution_service/cas_server.test.cpp b/test/buildtool/execution_api/execution_service/cas_server.test.cpp index 80aaa76b..4bc90546 100644 --- a/test/buildtool/execution_api/execution_service/cas_server.test.cpp +++ b/test/buildtool/execution_api/execution_service/cas_server.test.cpp @@ -12,12 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/execution_api/execution_service/cas_server.hpp" + #include <string> #include "catch2/catch_test_macros.hpp" #include "gsl/gsl" #include "src/buildtool/common/artifact_digest.hpp" -#include "src/buildtool/execution_api/execution_service/cas_server.hpp" #include "src/buildtool/execution_api/local/config.hpp" #include "src/buildtool/execution_api/local/context.hpp" #include "src/buildtool/file_system/git_repo.hpp" diff --git a/test/buildtool/execution_api/local/local_api.test.cpp b/test/buildtool/execution_api/local/local_api.test.cpp index 22d6bdbd..548b3497 100644 --- a/test/buildtool/execution_api/local/local_api.test.cpp +++ b/test/buildtool/execution_api/local/local_api.test.cpp @@ -12,13 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/execution_api/local/local_api.hpp" + #include <cstdlib> #include <string> #include "catch2/catch_test_macros.hpp" #include "src/buildtool/execution_api/local/config.hpp" #include "src/buildtool/execution_api/local/context.hpp" -#include "src/buildtool/execution_api/local/local_api.hpp" #include "src/buildtool/storage/config.hpp" #include "src/buildtool/storage/storage.hpp" #include "test/buildtool/execution_api/common/api_test.hpp" diff --git a/test/buildtool/execution_engine/dag/dag.test.cpp b/test/buildtool/execution_engine/dag/dag.test.cpp index 8a88775d..201a537f 100644 --- a/test/buildtool/execution_engine/dag/dag.test.cpp +++ b/test/buildtool/execution_engine/dag/dag.test.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/execution_engine/dag/dag.hpp" + #include <cstddef> #include <cstdint> #include <map> @@ -25,7 +27,6 @@ #include "src/buildtool/common/action_description.hpp" #include "src/buildtool/common/artifact_description.hpp" #include "src/buildtool/common/identifier.hpp" -#include "src/buildtool/execution_engine/dag/dag.hpp" #include "test/utils/container_matchers.hpp" namespace { diff --git a/test/buildtool/execution_engine/executor/executor.test.cpp b/test/buildtool/execution_engine/executor/executor.test.cpp index 84bf7ade..22cd2cc4 100644 --- a/test/buildtool/execution_engine/executor/executor.test.cpp +++ b/test/buildtool/execution_engine/executor/executor.test.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/execution_engine/executor/executor.hpp" + #include <algorithm> #include <filesystem> #include <map> @@ -33,7 +35,6 @@ #include "src/buildtool/execution_api/remote/config.hpp" #include "src/buildtool/execution_api/remote/context.hpp" #include "src/buildtool/execution_engine/executor/context.hpp" -#include "src/buildtool/execution_engine/executor/executor.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" #include "src/buildtool/progress_reporting/progress.hpp" #include "test/utils/executor/test_api_bundle.hpp" diff --git a/test/buildtool/execution_engine/traverser/traverser.test.cpp b/test/buildtool/execution_engine/traverser/traverser.test.cpp index fcdc5ef7..97e2095e 100644 --- a/test/buildtool/execution_engine/traverser/traverser.test.cpp +++ b/test/buildtool/execution_engine/traverser/traverser.test.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/execution_engine/traverser/traverser.hpp" + #include <algorithm> #include <mutex> #include <string> @@ -23,7 +25,6 @@ #include "catch2/catch_test_macros.hpp" #include "src/buildtool/common/artifact_description.hpp" #include "src/buildtool/execution_engine/dag/dag.hpp" -#include "src/buildtool/execution_engine/traverser/traverser.hpp" #include "test/utils/container_matchers.hpp" namespace { diff --git a/test/buildtool/file_system/file_root.test.cpp b/test/buildtool/file_system/file_root.test.cpp index 8fbb0d95..67fd77f3 100644 --- a/test/buildtool/file_system/file_root.test.cpp +++ b/test/buildtool/file_system/file_root.test.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/file_system/file_root.hpp" + #include <atomic> #include <cstdlib> #include <filesystem> @@ -21,7 +23,6 @@ #include "catch2/catch_test_macros.hpp" #include "src/buildtool/common/artifact_description.hpp" -#include "src/buildtool/file_system/file_root.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" #include "test/utils/container_matchers.hpp" #include "test/utils/shell_quoting.hpp" diff --git a/test/buildtool/file_system/file_system_manager.test.cpp b/test/buildtool/file_system/file_system_manager.test.cpp index 05fef390..689dd9b1 100644 --- a/test/buildtool/file_system/file_system_manager.test.cpp +++ b/test/buildtool/file_system/file_system_manager.test.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/file_system/file_system_manager.hpp" + #include <algorithm> #include <chrono> #include <cstdlib> @@ -23,7 +25,6 @@ #include "catch2/catch_test_macros.hpp" #include "catch2/generators/catch_generators_all.hpp" -#include "src/buildtool/file_system/file_system_manager.hpp" #include "src/buildtool/file_system/object_type.hpp" #include "src/buildtool/logging/log_level.hpp" #include "src/buildtool/logging/logger.hpp" @@ -352,8 +353,12 @@ TEST_CASE_METHOD(CopyFileFixture, "CopyFile", "[file_system]") { CHECK(content_from == content_to); }; - SECTION("direct") { run_test(false); } - SECTION("fd_less") { run_test(true); } + SECTION("direct") { + run_test(false); + } + SECTION("fd_less") { + run_test(true); + } } TEST_CASE_METHOD(CopyFileFixture, "CopyFileAs", "[file_system]") { @@ -381,8 +386,12 @@ TEST_CASE_METHOD(CopyFileFixture, "CopyFileAs", "[file_system]") { } }; - SECTION("direct") { run_test(false); } - SECTION("fd_less") { run_test(true); } + SECTION("direct") { + run_test(false); + } + SECTION("fd_less") { + run_test(true); + } SECTION("direct with epoch") { run_test.template operator()<true>(false); } @@ -415,8 +424,12 @@ TEST_CASE_METHOD(CopyFileFixture, "CopyFileAs", "[file_system]") { } }; - SECTION("direct") { run_test(false); } - SECTION("fd_less") { run_test(true); } + SECTION("direct") { + run_test(false); + } + SECTION("fd_less") { + run_test(true); + } SECTION("direct with epoch") { run_test.template operator()<true>(false); } @@ -447,8 +460,12 @@ TEST_CASE_METHOD(CopyFileFixture, "CopyFileAs", "[file_system]") { } }; - SECTION("direct") { run_test(false); } - SECTION("fd_less") { run_test(true); } + SECTION("direct") { + run_test(false); + } + SECTION("fd_less") { + run_test(true); + } SECTION("direct with epoch") { run_test.template operator()<true>(false); } @@ -480,8 +497,12 @@ TEST_CASE_METHOD(CopyFileFixture, "CopyFileAs", "[file_system]") { } }; - SECTION("direct") { run_test(false); } - SECTION("fd_less") { run_test(true); } + SECTION("direct") { + run_test(false); + } + SECTION("fd_less") { + run_test(true); + } SECTION("direct with epoch") { run_test.template operator()<true>(false); } @@ -535,8 +556,12 @@ TEST_CASE_METHOD(WriteFileFixture, "WriteFile", "[file_system]") { CHECK(written_content == content); }; - SECTION("direct") { run_test(false); } - SECTION("fd-less") { run_test(true); } + SECTION("direct") { + run_test(false); + } + SECTION("fd-less") { + run_test(true); + } } TEST_CASE_METHOD(WriteFileFixture, "WriteFileAs", "[file_system]") { @@ -562,8 +587,12 @@ TEST_CASE_METHOD(WriteFileFixture, "WriteFileAs", "[file_system]") { } }; - SECTION("direct") { run_test(false); } - SECTION("fd-less") { run_test(true); } + SECTION("direct") { + run_test(false); + } + SECTION("fd-less") { + run_test(true); + } SECTION("direct with epoch") { run_test.template operator()<true>(false); } @@ -592,8 +621,12 @@ TEST_CASE_METHOD(WriteFileFixture, "WriteFileAs", "[file_system]") { } }; - SECTION("direct") { run_test(false); } - SECTION("fd-less") { run_test(true); } + SECTION("direct") { + run_test(false); + } + SECTION("fd-less") { + run_test(true); + } SECTION("direct with epoch") { run_test.template operator()<true>(false); } diff --git a/test/buildtool/file_system/git_repo.test.cpp b/test/buildtool/file_system/git_repo.test.cpp index 5a0831cc..2663e9bd 100644 --- a/test/buildtool/file_system/git_repo.test.cpp +++ b/test/buildtool/file_system/git_repo.test.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/file_system/git_repo.hpp" + #include <atomic> #include <cstdlib> #include <filesystem> @@ -26,7 +28,6 @@ #include "nlohmann/json.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" #include "src/buildtool/file_system/git_cas.hpp" -#include "src/buildtool/file_system/git_repo.hpp" #include "src/buildtool/logging/log_level.hpp" #include "src/buildtool/logging/logger.hpp" #include "src/buildtool/storage/config.hpp" diff --git a/test/buildtool/file_system/git_tree.test.cpp b/test/buildtool/file_system/git_tree.test.cpp index 82177b45..2cef0e00 100644 --- a/test/buildtool/file_system/git_tree.test.cpp +++ b/test/buildtool/file_system/git_tree.test.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/file_system/git_tree.hpp" + #include <atomic> #include <cstdlib> #include <filesystem> @@ -27,7 +29,6 @@ #include "src/buildtool/file_system/file_system_manager.hpp" #include "src/buildtool/file_system/git_cas.hpp" #include "src/buildtool/file_system/git_repo.hpp" -#include "src/buildtool/file_system/git_tree.hpp" #include "src/utils/cpp/hex_string.hpp" #include "test/utils/container_matchers.hpp" #include "test/utils/shell_quoting.hpp" diff --git a/test/buildtool/file_system/object_cas.test.cpp b/test/buildtool/file_system/object_cas.test.cpp index a8fd746b..e9ebf580 100644 --- a/test/buildtool/file_system/object_cas.test.cpp +++ b/test/buildtool/file_system/object_cas.test.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/file_system/object_cas.hpp" + #include <functional> // std::equal_to #include <string> @@ -19,7 +21,6 @@ #include "src/buildtool/common/artifact_digest.hpp" #include "src/buildtool/common/bazel_types.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" -#include "src/buildtool/file_system/object_cas.hpp" #include "src/buildtool/file_system/object_type.hpp" #include "src/buildtool/storage/config.hpp" #include "test/utils/hermeticity/test_storage_config.hpp" diff --git a/test/buildtool/file_system/resolve_symlinks_map.test.cpp b/test/buildtool/file_system/resolve_symlinks_map.test.cpp index 2cf05ead..d1cd7692 100644 --- a/test/buildtool/file_system/resolve_symlinks_map.test.cpp +++ b/test/buildtool/file_system/resolve_symlinks_map.test.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/file_system/symlinks_map/resolve_symlinks_map.hpp" + #include <atomic> #include <cstdlib> #include <filesystem> @@ -27,7 +29,6 @@ #include "src/buildtool/file_system/git_repo.hpp" #include "src/buildtool/file_system/object_type.hpp" #include "src/buildtool/file_system/symlinks_map/pragma_special.hpp" -#include "src/buildtool/file_system/symlinks_map/resolve_symlinks_map.hpp" #include "src/buildtool/multithreading/task_system.hpp" #include "test/utils/shell_quoting.hpp" diff --git a/test/buildtool/logging/log_sink_file.test.cpp b/test/buildtool/logging/log_sink_file.test.cpp index 2dde74b8..08a59446 100644 --- a/test/buildtool/logging/log_sink_file.test.cpp +++ b/test/buildtool/logging/log_sink_file.test.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/logging/log_sink_file.hpp" + #include <filesystem> #include <fstream> #include <iostream> @@ -26,7 +28,6 @@ #include "src/buildtool/logging/log_config.hpp" #include "src/buildtool/logging/log_level.hpp" #include "src/buildtool/logging/log_sink_cmdline.hpp" -#include "src/buildtool/logging/log_sink_file.hpp" [[nodiscard]] static auto NumberOfLines(std::filesystem::path const& file_path) -> int { diff --git a/test/buildtool/logging/logger.test.cpp b/test/buildtool/logging/logger.test.cpp index f4a9313d..474a656f 100644 --- a/test/buildtool/logging/logger.test.cpp +++ b/test/buildtool/logging/logger.test.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/logging/logger.hpp" + #include <atomic> #include <string> #include <unordered_map> @@ -21,7 +23,6 @@ #include "src/buildtool/logging/log_config.hpp" #include "src/buildtool/logging/log_level.hpp" #include "src/buildtool/logging/log_sink.hpp" -#include "src/buildtool/logging/logger.hpp" // Stores prints from test sink instances class TestPrints { diff --git a/test/buildtool/main/install_cas.test.cpp b/test/buildtool/main/install_cas.test.cpp index 05de9c0d..9c9ef8e0 100644 --- a/test/buildtool/main/install_cas.test.cpp +++ b/test/buildtool/main/install_cas.test.cpp @@ -12,9 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/main/install_cas.hpp" + #include "catch2/catch_test_macros.hpp" #include "src/buildtool/common/artifact.hpp" -#include "src/buildtool/main/install_cas.hpp" TEST_CASE("ObjectInfoFromLiberalString", "[artifact]") { auto expected = *Artifact::ObjectInfo::FromString( diff --git a/test/buildtool/multithreading/async_map.test.cpp b/test/buildtool/multithreading/async_map.test.cpp index 30a6322a..7932f507 100644 --- a/test/buildtool/multithreading/async_map.test.cpp +++ b/test/buildtool/multithreading/async_map.test.cpp @@ -12,10 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/multithreading/async_map.hpp" + #include <string> #include "catch2/catch_test_macros.hpp" -#include "src/buildtool/multithreading/async_map.hpp" #include "src/buildtool/multithreading/async_map_node.hpp" #include "src/buildtool/multithreading/task_system.hpp" diff --git a/test/buildtool/multithreading/async_map_consumer.test.cpp b/test/buildtool/multithreading/async_map_consumer.test.cpp index f65c7851..3ba3eebf 100644 --- a/test/buildtool/multithreading/async_map_consumer.test.cpp +++ b/test/buildtool/multithreading/async_map_consumer.test.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/multithreading/async_map_consumer.hpp" + #include <algorithm> // std::transform #include <atomic> #include <cstdint> // for fixed width integral types @@ -24,7 +26,6 @@ #include "catch2/catch_test_macros.hpp" #include "catch2/matchers/catch_matchers_all.hpp" #include "src/buildtool/multithreading/async_map.hpp" -#include "src/buildtool/multithreading/async_map_consumer.hpp" #include "src/buildtool/multithreading/task_system.hpp" auto FibonacciMapConsumer() -> AsyncMapConsumer<int, std::uint64_t> { diff --git a/test/buildtool/multithreading/async_map_node.test.cpp b/test/buildtool/multithreading/async_map_node.test.cpp index 782f41ad..d0c9a702 100644 --- a/test/buildtool/multithreading/async_map_node.test.cpp +++ b/test/buildtool/multithreading/async_map_node.test.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/multithreading/async_map_node.hpp" + #include <mutex> #include <string> #include <thread> @@ -19,7 +21,6 @@ #include "catch2/catch_test_macros.hpp" #include "catch2/matchers/catch_matchers_all.hpp" -#include "src/buildtool/multithreading/async_map_node.hpp" #include "src/buildtool/multithreading/task_system.hpp" TEST_CASE("No task is queued if the node is never ready", "[async_map_node]") { diff --git a/test/buildtool/multithreading/task.test.cpp b/test/buildtool/multithreading/task.test.cpp index 772b3e83..dbacb1a8 100644 --- a/test/buildtool/multithreading/task.test.cpp +++ b/test/buildtool/multithreading/task.test.cpp @@ -12,11 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/multithreading/task.hpp" + #include <functional> #include <utility> // std::move #include "catch2/catch_test_macros.hpp" -#include "src/buildtool/multithreading/task.hpp" namespace { constexpr int kDummyValue{5}; diff --git a/test/buildtool/multithreading/task_system.test.cpp b/test/buildtool/multithreading/task_system.test.cpp index ea0ed41b..8e9f5c77 100644 --- a/test/buildtool/multithreading/task_system.test.cpp +++ b/test/buildtool/multithreading/task_system.test.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/multithreading/task_system.hpp" + #include <atomic> #include <chrono> #include <condition_variable> @@ -27,7 +29,6 @@ #include "catch2/catch_test_macros.hpp" #include "catch2/generators/catch_generators_all.hpp" #include "catch2/matchers/catch_matchers_all.hpp" -#include "src/buildtool/multithreading/task_system.hpp" #include "test/utils/container_matchers.hpp" namespace { diff --git a/test/buildtool/serve_api/source_tree_client.test.cpp b/test/buildtool/serve_api/source_tree_client.test.cpp index d44a1605..7c9634df 100644 --- a/test/buildtool/serve_api/source_tree_client.test.cpp +++ b/test/buildtool/serve_api/source_tree_client.test.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/serve_api/remote/source_tree_client.hpp" + #include <string> #include <variant> @@ -21,7 +23,6 @@ #include "src/buildtool/execution_api/remote/config.hpp" #include "src/buildtool/execution_api/remote/context.hpp" #include "src/buildtool/serve_api/remote/config.hpp" -#include "src/buildtool/serve_api/remote/source_tree_client.hpp" #include "test/utils/serve_service/test_serve_config.hpp" auto const kRootCommit = diff --git a/test/buildtool/storage/large_object_cas.test.cpp b/test/buildtool/storage/large_object_cas.test.cpp index 39a957e0..7d191629 100644 --- a/test/buildtool/storage/large_object_cas.test.cpp +++ b/test/buildtool/storage/large_object_cas.test.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/storage/large_object_cas.hpp" + #include <cstddef> #include <cstdint> #include <cstdlib> @@ -32,7 +34,6 @@ #include "src/buildtool/file_system/object_type.hpp" #include "src/buildtool/storage/config.hpp" #include "src/buildtool/storage/garbage_collector.hpp" -#include "src/buildtool/storage/large_object_cas.hpp" #include "src/buildtool/storage/storage.hpp" #include "src/utils/cpp/tmp_dir.hpp" #include "test/utils/hermeticity/test_storage_config.hpp" diff --git a/test/buildtool/system/system_command.test.cpp b/test/buildtool/system/system_command.test.cpp index 5e16d02e..a2fc5d35 100644 --- a/test/buildtool/system/system_command.test.cpp +++ b/test/buildtool/system/system_command.test.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/buildtool/system/system_command.hpp" + #include <cstdlib> #include <filesystem> #include <iostream> @@ -20,7 +22,6 @@ #include "catch2/catch_test_macros.hpp" #include "catch2/matchers/catch_matchers_all.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" -#include "src/buildtool/system/system_command.hpp" namespace { [[nodiscard]] auto GetTestDir() -> std::filesystem::path { diff --git a/test/other_tools/git_operations/git_repo_remote.test.cpp b/test/other_tools/git_operations/git_repo_remote.test.cpp index 0844205d..69cfce34 100644 --- a/test/other_tools/git_operations/git_repo_remote.test.cpp +++ b/test/other_tools/git_operations/git_repo_remote.test.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/other_tools/git_operations/git_repo_remote.hpp" + #include <atomic> #include <cstdlib> #include <filesystem> @@ -27,7 +29,6 @@ #include "src/buildtool/logging/log_level.hpp" #include "src/buildtool/logging/logger.hpp" #include "src/buildtool/storage/config.hpp" -#include "src/other_tools/git_operations/git_repo_remote.hpp" #include "src/utils/cpp/atomic.hpp" #include "test/utils/hermeticity/test_storage_config.hpp" #include "test/utils/shell_quoting.hpp" diff --git a/test/other_tools/just_mr/mirrors.test.cpp b/test/other_tools/just_mr/mirrors.test.cpp index 5e2a6e9e..c7eef60b 100644 --- a/test/other_tools/just_mr/mirrors.test.cpp +++ b/test/other_tools/just_mr/mirrors.test.cpp @@ -12,12 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/other_tools/just_mr/mirrors.hpp" + #include <string> #include <vector> #include "catch2/catch_test_macros.hpp" #include "catch2/matchers/catch_matchers_all.hpp" -#include "src/other_tools/just_mr/mirrors.hpp" TEST_CASE("SortByHostname") { // setup inputs diff --git a/test/other_tools/just_mr/rc_merge.test.cpp b/test/other_tools/just_mr/rc_merge.test.cpp index 98302eae..b40b1b48 100644 --- a/test/other_tools/just_mr/rc_merge.test.cpp +++ b/test/other_tools/just_mr/rc_merge.test.cpp @@ -12,10 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/other_tools/just_mr/rc_merge.hpp" + #include "catch2/catch_test_macros.hpp" #include "src/buildtool/build_engine/expression/configuration.hpp" #include "src/buildtool/build_engine/expression/expression.hpp" -#include "src/other_tools/just_mr/rc_merge.hpp" TEST_CASE("Simple field") { auto conf = Configuration{Expression::FromJson(R"( diff --git a/test/utils/archive/archive_usage.test.cpp b/test/utils/archive/archive_usage.test.cpp index 282c2425..fd33f7e0 100644 --- a/test/utils/archive/archive_usage.test.cpp +++ b/test/utils/archive/archive_usage.test.cpp @@ -109,8 +109,8 @@ std::vector<archive_test_info_t> const kTestScenarios = { .tools = {"7z"}, // 7z comes with its own lzma-type compression .cmd = "/usr/bin/7z x"}}; -[[nodiscard]] auto read_archive(archive* a, std::string const& path) - -> filetree_t { +[[nodiscard]] auto read_archive(archive* a, + std::string const& path) -> filetree_t { filetree_t result{}; REQUIRE(archive_read_open_filename(a, path.c_str(), kBlockSize) == diff --git a/test/utils/cpp/file_locking.test.cpp b/test/utils/cpp/file_locking.test.cpp index 50b4fe63..b5e38a9c 100644 --- a/test/utils/cpp/file_locking.test.cpp +++ b/test/utils/cpp/file_locking.test.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/utils/cpp/file_locking.hpp" + #include <atomic> #include <chrono> #include <cstdlib> @@ -23,7 +25,6 @@ #include "catch2/catch_test_macros.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" #include "src/utils/cpp/atomic.hpp" -#include "src/utils/cpp/file_locking.hpp" namespace { [[nodiscard]] auto GetTestDir() noexcept -> std::filesystem::path { diff --git a/test/utils/cpp/path.test.cpp b/test/utils/cpp/path.test.cpp index 7a0ac1fe..ecfc64c1 100644 --- a/test/utils/cpp/path.test.cpp +++ b/test/utils/cpp/path.test.cpp @@ -12,10 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/utils/cpp/path.hpp" + #include <filesystem> #include "catch2/catch_test_macros.hpp" -#include "src/utils/cpp/path.hpp" TEST_CASE("normalization", "[path]") { CHECK(ToNormalPath(std::filesystem::path{""}) == diff --git a/test/utils/cpp/path_rebase.test.cpp b/test/utils/cpp/path_rebase.test.cpp index 79a13fb5..fe62e0be 100644 --- a/test/utils/cpp/path_rebase.test.cpp +++ b/test/utils/cpp/path_rebase.test.cpp @@ -12,9 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "catch2/catch_test_macros.hpp" #include "src/utils/cpp/path_rebase.hpp" +#include "catch2/catch_test_macros.hpp" + TEST_CASE("rebase", "[path_rebase]") { CHECK(RebasePathStringRelativeTo("work", "work/foo/bar") == "foo/bar"); CHECK(RebasePathStringRelativeTo("work", "work/foo") == "foo"); diff --git a/test/utils/cpp/prefix.test.cpp b/test/utils/cpp/prefix.test.cpp index 3dd092eb..ae47c93d 100644 --- a/test/utils/cpp/prefix.test.cpp +++ b/test/utils/cpp/prefix.test.cpp @@ -12,10 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "src/utils/cpp/prefix.hpp" + #include <filesystem> #include "catch2/catch_test_macros.hpp" -#include "src/utils/cpp/prefix.hpp" TEST_CASE("lines", "[prefix]") { CHECK(PrefixLines("").empty()); |