/// <summary> /// Executes the specified task asynchronously. /// </summary> /// <param name="task">The task to execute.</param> /// <param name="context">The context.</param> public async Task ExecuteAsync(CakeTask task, ICakeContext context) { if (task != null) { _log.Information(string.Empty); _log.Information("========================================"); _log.Information(task.Name); _log.Information("========================================"); _log.Verbose("Executing task: {0}", task.Name); await Task.Run(() => task.Execute(context)); _log.Verbose("Finished executing task: {0}", task.Name); } }
/// <summary> /// Executes the specified task. /// </summary> /// <param name="task">The task to execute.</param> /// <param name="context">The context.</param> public void Execute(CakeTask task, ICakeContext context) { if (task != null) { _log.Information(string.Empty); _log.Information("========================================"); _log.Information(task.Name); _log.Information("========================================"); _log.Verbose("Executing task: {0}", task.Name); task.Execute(context); _log.Verbose("Finished executing task: {0}", task.Name); } }
private void ExecuteTask(Stopwatch stopWatch, CakeTask task, CakeReport report) { // Reset the stop watch. stopWatch.Reset(); stopWatch.Start(); try { // Execute the task. task.Execute(this); } catch (Exception ex) { _log.Error("An error occured in task {0}.", ex.Message); if (!task.ContinueOnError) { throw; } } // Add the task results to the report. report.Add(task.Name, stopWatch.Elapsed); }