Frosting: How to get a behavior similar to ".WithCriteria()"? #2951
-
Hi, just switched from cake script to Frosting and run into an annoying problem. Now I am trying to get a similar behavior with frosting. I understand that it is not possible with attributes as those need to be compile time constant. Is there another way (via the context?) to skip a task when certain criterias are not fulfilled or at least hide it from console output? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
@bergziege You can override the [Dependency(typeof(Build))]
public sealed class MyTask : FrostingTask<Context>
{
public override bool ShouldRun(Context context)
{
// Criteria here
return true;
}
public override void Run(Context context)
{
}
} |
Beta Was this translation helpful? Give feedback.
-
I've created an issue for this here: #3328 |
Beta Was this translation helpful? Give feedback.
@bergziege You can override the
ShouldRun
method in the task to accomplish this.