public async Task <int> DispatchAsync(CliHost <BuildArgs> host, BuildArgs args) { var stepsToRun = (host.IsSet(RunOnlyFlag) ? host[RunOnlyFlag].Split('|', StringSplitOptions.RemoveEmptyEntries) : _steps.Select(step => step.Flag)).ToList(); host.Log.Info($"Enabled steps: {stepsToRun.JoinString()}"); foreach (var buildStep in _steps) { await TryDispatchAsync(buildStep, stepsToRun, host, args).ConfigureAwait(false); } return(0); }
public async Task <int> TryDispatchAsync(BuildStep step, IEnumerable <string> stepsToRun, CliHost <BuildArgs> host, BuildArgs args) { if (!ShouldRun(step.Flag, stepsToRun)) { return(0); } host.Log.Info(GetBuildStart(step.Flag, args.SolutionDir.Name)); var exitCode = await step.RunAsync(args, host.Log).ConfigureAwait(false); if (exitCode != 0) { throw new CliException($"{step.Flag} FAILED. See log for details", exitCode); } return(exitCode); }