summaryrefslogtreecommitdiff
path: root/src/buildtool/file_system/file_root.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildtool/file_system/file_root.hpp')
-rw-r--r--src/buildtool/file_system/file_root.hpp87
1 files changed, 2 insertions, 85 deletions
diff --git a/src/buildtool/file_system/file_root.hpp b/src/buildtool/file_system/file_root.hpp
index e47b68f5..cabd2aae 100644
--- a/src/buildtool/file_system/file_root.hpp
+++ b/src/buildtool/file_system/file_root.hpp
@@ -16,7 +16,6 @@
#define INCLUDED_SRC_BUILDTOOL_FILE_SYSTEM_FILE_ROOT_HPP
#include <algorithm>
-#include <compare>
#include <cstddef>
#include <exception>
#include <filesystem>
@@ -47,7 +46,6 @@
#include "src/buildtool/logging/logger.hpp"
#include "src/utils/cpp/concepts.hpp"
#include "src/utils/cpp/expected.hpp"
-#include "src/utils/cpp/hash_combine.hpp"
// Keep it to ensure fmt::format works on JSON objects
#include "src/utils/cpp/json.hpp" // IWYU pragma: keep
@@ -114,52 +112,10 @@ class FileRoot {
gsl::not_null<GitTreePtr> tree;
};
- public:
- struct ComputedRoot {
- std::string repository;
- std::string target_module;
- std::string target_name;
- nlohmann::json config;
-
- [[nodiscard]] auto operator==(
- ComputedRoot const& other) const noexcept {
- return (repository == other.repository) and
- (target_module == other.target_module) and
- (target_name == other.target_name) and
- (config == other.config);
- }
-
- [[nodiscard]] auto operator<(ComputedRoot const& other) const noexcept {
- if (auto const res = repository <=> other.repository; res != 0) {
- return res < 0;
- }
- if (auto const res = target_module <=> other.target_module;
- res != 0) {
- return res < 0;
- }
- if (auto const res = target_name <=> other.target_name; res != 0) {
- return res < 0;
- }
- return config < other.config;
- }
-
- [[nodiscard]] auto ToString() const -> std::string {
- return fmt::format("([\"@\", {}, {}, {}], {})",
- nlohmann::json(repository).dump(),
- nlohmann::json(target_module).dump(),
- nlohmann::json(target_name).dump(),
- config.dump());
- }
- };
-
- private:
// absent roots are defined by a tree hash with no witnessing repository
using absent_root_t = std::string;
- using root_t = std::variant<fs_root_t,
- RootGit,
- absent_root_t,
- ComputedRoot,
- PrecomputedRoot>;
+ using root_t =
+ std::variant<fs_root_t, RootGit, absent_root_t, PrecomputedRoot>;
public:
static constexpr auto kGitTreeMarker = "git tree";
@@ -383,14 +339,6 @@ class FileRoot {
gsl::not_null<GitTreePtr> const& tree,
bool ignore_special = false) noexcept
: root_{RootGit{cas, tree}}, ignore_special_{ignore_special} {}
- FileRoot(std::string repository,
- std::string target_module,
- std::string target_name,
- nlohmann::json config) noexcept
- : root_{ComputedRoot{std::move(repository),
- std::move(target_module),
- std::move(target_name),
- std::move(config)}} {}
explicit FileRoot(PrecomputedRoot precomputed)
: root_{std::move(precomputed)} {}
@@ -705,22 +653,6 @@ class FileRoot {
return std::nullopt;
}
- [[nodiscard]] auto IsComputed() const noexcept -> bool {
- return std::holds_alternative<ComputedRoot>(root_);
- }
-
- [[nodiscard]] auto GetComputedDescription() const noexcept
- -> std::optional<ComputedRoot> {
- if (std::holds_alternative<ComputedRoot>(root_)) {
- try {
- return std::get<ComputedRoot>(root_);
- } catch (...) {
- return std::nullopt;
- }
- }
- return std::nullopt;
- }
-
[[nodiscard]] auto IgnoreSpecial() const noexcept -> bool {
return ignore_special_;
}
@@ -854,19 +786,4 @@ class FileRoot {
bool ignore_special_{};
};
-namespace std {
-template <>
-struct hash<FileRoot::ComputedRoot> {
- [[nodiscard]] auto operator()(FileRoot::ComputedRoot const& cr) const
- -> std::size_t {
- size_t seed{};
- hash_combine<std::string>(&seed, cr.repository);
- hash_combine<std::string>(&seed, cr.target_module);
- hash_combine<std::string>(&seed, cr.target_name);
- hash_combine<nlohmann::json>(&seed, cr.config);
- return seed;
- }
-};
-} // namespace std
-
#endif // INCLUDED_SRC_BUILDTOOL_FILE_SYSTEM_FILE_ROOT_HPP