summaryrefslogtreecommitdiff
path: root/src/buildtool/execution_engine/dag/dag.cpp
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2025-04-04 12:27:48 +0200
committerKlaus Aehlig <klaus.aehlig@huawei.com>2025-04-07 17:42:26 +0200
commit267195e891c8557b73ef88b6e7bb82afc3c17476 (patch)
tree86c1883f829096d64d7b7553c140eb1bdb9e58f9 /src/buildtool/execution_engine/dag/dag.cpp
parentf5a4fb313e0c4ee5841a699186e4767ad67f407c (diff)
downloadjustbuild-267195e891c8557b73ef88b6e7bb82afc3c17476.tar.gz
dag: be aware of tree-overlays
Diffstat (limited to 'src/buildtool/execution_engine/dag/dag.cpp')
-rw-r--r--src/buildtool/execution_engine/dag/dag.cpp27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/buildtool/execution_engine/dag/dag.cpp b/src/buildtool/execution_engine/dag/dag.cpp
index 83809e6a..13499eab 100644
--- a/src/buildtool/execution_engine/dag/dag.cpp
+++ b/src/buildtool/execution_engine/dag/dag.cpp
@@ -22,9 +22,19 @@ auto DependencyGraph::CreateOutputArtifactNodes(
std::string const& action_id,
std::vector<std::string> const& file_paths,
std::vector<std::string> const& dir_paths,
- bool is_tree_action)
+ bool is_tree_action,
+ bool is_tree_overlay_action)
-> std::pair<std::vector<DependencyGraph::NamedArtifactNodePtr>,
std::vector<DependencyGraph::NamedArtifactNodePtr>> {
+ if (is_tree_overlay_action) { // create tree-overlay artifact
+ auto artifact =
+ ArtifactDescription::CreateTreeOverlay(action_id).ToArtifact();
+ auto const node_id = AddArtifact(std::move(artifact));
+ return std::make_pair(std::vector<NamedArtifactNodePtr>{},
+ std::vector<NamedArtifactNodePtr>{
+ {{}, &(*artifact_nodes_[node_id])}});
+ }
+
if (is_tree_action) { // create tree artifact
auto artifact = ArtifactDescription::CreateTree(action_id).ToArtifact();
auto const node_id = AddArtifact(std::move(artifact));
@@ -71,7 +81,8 @@ auto DependencyGraph::CreateInputArtifactNodes(
auto DependencyGraph::CreateActionNode(Action const& action) noexcept
-> DependencyGraph::ActionNode* {
- if (action.IsTreeAction() or not action.Command().empty()) {
+ if (action.IsTreeAction() or action.IsTreeOverlayAction() or
+ not action.Command().empty()) {
auto const node_id = AddAction(action);
return &(*action_nodes_[node_id]);
}
@@ -133,14 +144,14 @@ auto DependencyGraph::AddArtifact(ArtifactDescription const& description)
}
auto DependencyGraph::AddAction(ActionDescription const& description) -> bool {
- auto output_nodes =
- CreateOutputArtifactNodes(description.Id(),
- description.OutputFiles(),
- description.OutputDirs(),
- description.GraphAction().IsTreeAction());
+ auto output_nodes = CreateOutputArtifactNodes(
+ description.Id(),
+ description.OutputFiles(),
+ description.OutputDirs(),
+ description.GraphAction().IsTreeAction(),
+ description.GraphAction().IsTreeOverlayAction());
auto* action_node = CreateActionNode(description.GraphAction());
auto input_nodes = CreateInputArtifactNodes(description.Inputs());
-
if (action_node == nullptr or not input_nodes.has_value() or
(output_nodes.first.empty() and output_nodes.second.empty())) {
return false;