cake-build / cake-build/cake

Clear the Actions list through CakeTaskBuilder

Open
#2,269 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
4.2k
Forks
778
Avg merge
1h 15m
Merged PRs (30d)
19

Description

### What You Are Seeing?
The only way to clear Actions from a `CakeTaskBuilder` is not cast its `ICakeTaskInfo` to `CakeTask`.

### What is Expected?
I need to clean the actions from a Task. I have the `CakeTaskBuilder` which builds that task. I expect to be able to clear `Actions` without casting to exact type.

```
CakeTaskBuilder exampleTaskBuilder = Task("Example.Task")
.Does(()=>
{
// Some code
});

((CakeTask)exampleTaskBuilder .Task).Actions.Clear();
```

Possible solutions came to my mind:
* `ICakeTaskInfo` might contains a List> Actions { get; } method
* Or a specific `ClearActions()` method to clean the actions list.
* If `ICakeTaskInfo` should be read-only then maybe the CakeTaskBuilder could have a funcion to clear the previously added tasks.

Contributor guide

Open the contributing guide

Research direction

Start by tracing CakeTaskBuilder, ICakeTaskInfo, and CakeTask to understand how actions are stored and exposed. Decide on and implement an API that lets a builder clear previously added actions without casting, then verify that the resulting task has no actions and that existing behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.