cake icon indicating copy to clipboard operation
cake copied to clipboard

Cake Frosting WithCriteria Description

Open tstewart65 opened this issue 7 months ago • 2 comments

Prerequisites

  • [x] I have written a descriptive issue title
  • [x] I have searched issues to ensure it has not already been reported

Cake runner

Cake Frosting

Cake version

5.0

Operating system

Windows

Operating system architecture

x64

CI Server

No response

What are you seeing?

The fix implemented in #4027 does not seem to work as implemented. The SkippedMessage property was added to IFrostingTask and it was also implemented there to return an empty string. IFrostingTask is implemented in FrostingTask but it has nothing in there to allow you to change the SkippedMessage property. This is the only level where you can change the SkippedMessage property and have it picked up when trying to reference it using IFrostingTask. I added a SkippedMessage property to my CleanTask I was creating and the message was not used when the following is called in FrostingEngine

// Is the criteria method overridden?
if (task.IsShouldRunOverridden(_context))
{
      cakeTask.WithCriteria(task.ShouldRun, task.SkippedMessage);
}

I made a small test project to verify this. Unless I am missing something I think this needs changed.

What is expected?

Want to be able to set the skipped message for the WithCriteria like you can when using Cake Tool.

Steps to Reproduce

Just try to set the SkippedMessage so it can be used when using the ShouldRun override.

Output log

No error log to show the message does not show up.

tstewart65 avatar Jun 06 '25 20:06 tstewart65

I will have a pull request for this tomorrow. It kind of is a moot point right now though since Cake.Frosting does not support the Spectre Console Output. I also changed how it works a little. The current implementation if it would have worked would have only allowed for one Skipped Message. You could have multiple criteria for skipping a task in the ShouldRun overide.

tstewart65 avatar Jun 17 '25 04:06 tstewart65

@devlead have you had a chance to look at this one?

Thank You

tstewart65 avatar Aug 26 '25 15:08 tstewart65