Nuke.Cola
Loading...
Searching...
No Matches
PropagateToolExecution.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Threading;
5using System.Threading.Tasks;
6using Nuke.Common.Tooling;
7using Nuke.Common.Utilities;
8using Nuke.Common.Utilities.Collections;
9using Serilog;
10
11namespace Nuke.Cola.Tooling;
12
13/// <summary>
14/// Propagated Tool delegate provider for launch parameter composition.
15/// </summary>
16/// <param name="Target"></param>
17/// <param name="PropagateArguments"></param>
18public record class PropagateToolExecution(Tool Target, ToolArguments? PropagateArguments = null)
19{
20 public IReadOnlyCollection<Output> Execute(
21 ArgumentStringHandler arguments = default,
22 string? workingDirectory = null,
23 IReadOnlyDictionary<string, string>? environmentVariables = null,
24 int? timeout = null,
25 bool? logOutput = null,
26 bool? logInvocation = null,
27 Action<OutputType, string>? logger = null,
28 Action<IProcess>? exitHandler = null
29 ) => Target.ExecuteWith(
30 PropagateArguments | new ToolArguments(
31 arguments.ToStringAndClear(),
32 workingDirectory,
33 environmentVariables,
34 timeout,
35 logOutput,
36 logInvocation,
37 logger,
38 exitHandler
39 )
40 );
41}
record class ToolArguments(string? Arguments=null, string? WorkingDirectory=null, IReadOnlyDictionary< string, string >? EnvironmentVariables=null, int? Timeout=null, bool? LogOutput=null, bool? LogInvocation=null, Action< OutputType, string >? Logger=null, Action< IProcess >? ExitHandler=null)
A record listing Tool delegate parameters and provides a way to meaningfully merge multiple together.
record class PropagateToolExecution(Tool Target, ToolArguments? PropagateArguments=null)
Propagated Tool delegate provider for launch parameter composition.