summaryrefslogtreecommitdiff
path: root/src/marlin.core/models/plan
diff options
context:
space:
mode:
Diffstat (limited to 'src/marlin.core/models/plan')
-rw-r--r--src/marlin.core/models/plan/CommandRole.cs3
-rw-r--r--src/marlin.core/models/plan/ExecutionCommand.cs1
-rw-r--r--src/marlin.core/models/plan/ExecutionPlan.cs15
3 files changed, 9 insertions, 10 deletions
diff --git a/src/marlin.core/models/plan/CommandRole.cs b/src/marlin.core/models/plan/CommandRole.cs
index 8005532..f47b51e 100644
--- a/src/marlin.core/models/plan/CommandRole.cs
+++ b/src/marlin.core/models/plan/CommandRole.cs
@@ -3,6 +3,5 @@ namespace marlin.core.models.plan;
public enum CommandRole
{
Step = 0,
- ArtifactHandler = 1,
- Cleanup = 2
+ Cleanup = 1
} \ No newline at end of file
diff --git a/src/marlin.core/models/plan/ExecutionCommand.cs b/src/marlin.core/models/plan/ExecutionCommand.cs
index 4bf19c3..9649eec 100644
--- a/src/marlin.core/models/plan/ExecutionCommand.cs
+++ b/src/marlin.core/models/plan/ExecutionCommand.cs
@@ -9,6 +9,7 @@ public class ExecutionCommand
public required string Command;
public required CommandRole Role;
public required bool Deferred;
+ public required IReadOnlyDictionary<string, string> Artifacts;
public CommandResultSelector? ResultSelector;
public required FailBehavior FailBehavior;
diff --git a/src/marlin.core/models/plan/ExecutionPlan.cs b/src/marlin.core/models/plan/ExecutionPlan.cs
index 24c40e4..fa84634 100644
--- a/src/marlin.core/models/plan/ExecutionPlan.cs
+++ b/src/marlin.core/models/plan/ExecutionPlan.cs
@@ -1,20 +1,19 @@
namespace marlin.core.models.plan;
+using System.Collections.ObjectModel;
using meta;
using util;
public class ExecutionPlan
{
- public IEnumerable<ExecutionCommand> Components => [..this._commands, ..this._deferredArtifactHandler, ..this._deferredCleanup];
+ public IEnumerable<ExecutionCommand> Components => [..this._commands, ..this._deferredCleanup];
private readonly List<ExecutionCommand> _commands;
- private readonly List<ExecutionCommand> _deferredArtifactHandler;
private readonly List<ExecutionCommand> _deferredCleanup;
public ExecutionPlan()
{
this._commands = new();
- this._deferredArtifactHandler = new();
this._deferredCleanup = new();
}
@@ -31,10 +30,6 @@ public class ExecutionPlan
this._deferredCleanup.Add(command);
break;
- case CommandRole.ArtifactHandler:
- this._deferredArtifactHandler.Add(command);
- break;
-
default:
throw new InvalidOperationException($"Cannot defer {command.Role}");
}
@@ -117,6 +112,10 @@ public class ExecutionPlan
run = VariableExpander.Expand(run, args);
+ IReadOnlyDictionary<string, string> artifacts = step is RecipeStep rs
+ ? rs.Artifacts
+ : ReadOnlyDictionary<string, string>.Empty;
+
ExecutionCommand stepCommand = new ExecutionCommand
{
Id = step.Id,
@@ -124,12 +123,12 @@ public class ExecutionPlan
Command = run,
Role = step switch
{
- ArtifactHandlerStep => CommandRole.ArtifactHandler,
RecipeStep => CommandRole.Step,
CleanupStep => CommandRole.Cleanup,
_ => throw new ArgumentOutOfRangeException()
},
FailBehavior = fail.Value,
+ Artifacts = artifacts,
Deferred = defer
};