Exemple #1
0
        private void PerformTaskSetup(ICakeContext context, IExecutionStrategy strategy, ICakeTaskInfo task,
                                      bool skipped)
        {
            var taskSetupContext = new TaskSetupContext(context, task);

            PublishEvent(BeforeTaskSetup, new BeforeTaskSetupEventArgs(taskSetupContext));
#pragma warning disable 618
            PublishEvent(TaskSetup, new TaskSetupEventArgs(taskSetupContext));
#pragma warning restore 618
            // Trying to stay consistent with the behavior of script-level Setup & Teardown (if setup fails, don't run the task, but still run the teardown)
            try
            {
                if (_actions.TaskSetup != null)
                {
                    try
                    {
                        strategy.PerformTaskSetup(_actions.TaskSetup, taskSetupContext);
                    }
                    catch (Exception exception)
                    {
                        PerformTaskTeardown(context, strategy, task, TimeSpan.Zero, skipped, exception);
                        throw;
                    }
                }
            }
            finally
            {
                PublishEvent(AfterTaskSetup, new AfterTaskSetupEventArgs(taskSetupContext));
            }
        }
Exemple #2
0
 private void PerformTaskSetup(ICakeContext context, IExecutionStrategy strategy, ICakeTaskInfo task, bool skipped)
 {
     // Trying to stay consistent with the behavior of script-level Setup & Teardown (if setup fails, don't run the task, but still run the teardown)
     if (_taskSetupAction != null)
     {
         try
         {
             var taskSetupContext = new TaskSetupContext(task);
             strategy.PerformTaskSetup(_taskSetupAction, context, taskSetupContext);
         }
         catch
         {
             PerformTaskTeardown(context, strategy, task, TimeSpan.Zero, skipped, true);
             throw;
         }
     }
 }
Exemple #3
0
        public void PerformTaskSetup(ICakeContext context, IExecutionStrategy strategy, CakeTask task, bool skipped)
        {
            var taskSetupContext = new TaskSetupContext(context, task);

            PublishEvent(TaskSetup, new TaskSetupEventArgs(taskSetupContext));

            if (_taskSetupAction != null)
            {
                try
                {
                    strategy.PerformTaskSetup(_taskSetupAction, taskSetupContext);
                }
                catch
                {
                    PerformTaskTeardown(context, strategy, task, TimeSpan.Zero, skipped, true);
                    throw;
                }
            }
        }
 /// <summary>
 /// Performs the specified setup action before each task is invoked.
 /// </summary>
 /// <param name="action">The action.</param>
 /// <param name="taskSetupContext">The context.</param>
 public void PerformTaskSetup(Action <ITaskSetupContext> action, ITaskSetupContext taskSetupContext)
 {
     _default.PerformTaskSetup(action, taskSetupContext);
 }