summaryrefslogtreecommitdiff
path: root/src/buildtool/common/artifact_description.hpp
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2025-03-24 11:34:43 +0100
committerKlaus Aehlig <klaus.aehlig@huawei.com>2025-04-07 13:29:28 +0200
commit19c8f8ac038d77d9f97629504d930d85471e47bb (patch)
tree85e80834af450bf42ca8f3b0b6fedf43fa0f1796 /src/buildtool/common/artifact_description.hpp
parentd56f9705f656f1e81e92abacd14524b45c311d88 (diff)
downloadjustbuild-19c8f8ac038d77d9f97629504d930d85471e47bb.tar.gz
ArtifactDescription: support tree overlays
... that, like trees, are given by their identifier.
Diffstat (limited to 'src/buildtool/common/artifact_description.hpp')
-rw-r--r--src/buildtool/common/artifact_description.hpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/buildtool/common/artifact_description.hpp b/src/buildtool/common/artifact_description.hpp
index 6a4b3b9e..0f600846 100644
--- a/src/buildtool/common/artifact_description.hpp
+++ b/src/buildtool/common/artifact_description.hpp
@@ -35,9 +35,15 @@ class ArtifactDescription final {
using Known =
std::tuple<ArtifactDigest, ObjectType, std::optional<std::string>>;
using Action = std::pair<std::string, std::filesystem::path>;
- using Tree = std::string;
public:
+ struct Tree {
+ std::string tree;
+ };
+ struct TreeOverlay {
+ std::string tree_overlay;
+ };
+
[[nodiscard]] static auto CreateLocal(std::filesystem::path path,
std::string repository) noexcept
-> ArtifactDescription;
@@ -55,6 +61,9 @@ class ArtifactDescription final {
[[nodiscard]] static auto CreateTree(std::string tree_id) noexcept
-> ArtifactDescription;
+ [[nodiscard]] static auto CreateTreeOverlay(
+ std::string tree_overlay_id) noexcept -> ArtifactDescription;
+
[[nodiscard]] auto Id() const& noexcept -> ArtifactIdentifier const& {
return id_;
}
@@ -70,6 +79,10 @@ class ArtifactDescription final {
return std::holds_alternative<Tree>(data_);
}
+ [[nodiscard]] auto IsTreeOverlay() const noexcept -> bool {
+ return std::holds_alternative<TreeOverlay>(data_);
+ }
+
[[nodiscard]] static auto FromJson(HashFunction::Type hash_type,
nlohmann::json const& json) noexcept
-> std::optional<ArtifactDescription>;
@@ -91,7 +104,7 @@ class ArtifactDescription final {
}
private:
- std::variant<Local, Known, Action, Tree> data_;
+ std::variant<Local, Known, Action, Tree, TreeOverlay> data_;
ArtifactIdentifier id_;
template <typename T>