Skip to content

Commit

Permalink
fix(execution): add Executes overload to handle Func<Task<T>> (nuke-b…
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-from-toronto committed Aug 14, 2023
1 parent 3d1f39c commit fa0fe70
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions source/Nuke.Build/Execution/TargetDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ public ITargetDefinition Executes(Func<Task> action)
{
return Executes(() => action().GetAwaiter().GetResult());
}

public ITargetDefinition Executes<T>(Func<Task<T>> action)
{
return Executes(() => action().GetAwaiter().GetResult());
}

public ITargetDefinition DependsOn(params Target[] targets)
{
Expand Down
5 changes: 5 additions & 0 deletions source/Nuke.Build/ITargetDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ public interface ITargetDefinition
/// Adds a <see cref="Task"/> that will be executed for this target.
/// </summary>
ITargetDefinition Executes(Func<Task> action);

/// <summary>
/// Adds a <see cref="Task"/> that will be executed for this target.
/// </summary>
ITargetDefinition Executes<T>(Func<Task<T>> action);

/// <summary>
/// Adds a set of dependent targets that will be executed before this target.
Expand Down

0 comments on commit fa0fe70

Please sign in to comment.