Replies: 1 comment 1 reply
-
Not exactly a direct answer to your question on accessing public class BuildContext : FrostingContext
{
public bool YAlreadyExecuted { get; set; }
public BuildContext(ICakeContext context)
: base(context)
{
}
} And then share the context across [TaskName("TaskA")]
public sealed class TaskA : FrostingTask<BuildContext>
{
public override void Run(BuildContext context)
{
Steps.X(context);
Steps.Y(context);
Steps.Z(context);
}
}
[TaskName("TaskB")]
public sealed class TaskB : FrostingTask<BuildContext>
{
public override void Run(BuildContext context)
{
// You could check context.YAlreadyExecuted here if you wanted
Steps.Y(context);
}
} Up to you whether you do the check in public static class Steps
{
public static void X(BuildContext context)
{
context.Log.Information("X");
}
public static void Y(BuildContext context)
{
if (context.YAlreadyExecuted)
{
return;
}
context.Log.Information("Y");
context.YAlreadyExecuted = true;
}
public static void Z(BuildContext context)
{
context.Log.Information("Z");
}
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
My quest started here.
I am using Cake Frosting.
I would like to be able to access a list of tasks that are going to be executed.
My use case is, I have two tasks, but only one should be executed. Task A does [XYZ], and task B does only [Y]. So if task A is going to be executed, I don't need to run B. What I am really looking for is a way to skip B if A is going to be executed. The property "TasksToExecute" seems to be a suitable candidate, but I can't figure out how to access it in Cake Frosting.
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions