Example #1
0
        public void GetRequirements(TaskExecutionContext context, IRequirementSink sink)
        {
            var feature = new Lazy<string>(() => string.Format("Feature '{0}'", context.Feature.Name));

            foreach (var kvp in mTaskDefinition.Requirements)
            {
                var v = CreateVerifier(kvp.Key);
                foreach (var val in kvp.Value)
                {
                    var arg = val;
                    sink.Add(feature.Value, () => v.Verify(context, arg));
                }
            }
        }
 public ExecutionNode(ITask task, TaskExecutionContext context)
     : this(new TaskExecutionTransform(task, context))
 {
 }
Example #3
0
        private StateHash ExecuteCore(TaskExecutionContext context, StateHash hash, bool execute)
        {
            RecipeConfig recipe;
            if (!mTaskDefinition.Commands.TryGetRecipe(context.Context.Action, out recipe))
                return hash;

            if (execute)
                context.Log.LogFormat("Running task '{0}'", Name);

            using (context.IndentScope())
            {
                foreach (var taskConfig in recipe)
                {
                    var task = mManager.CreateTask(taskConfig);

                    if (execute)
                        context.Log.LogFormat("Running sub-task '{0}'", task.Name);

                    using (context.IndentScope())
                    {
                        var ctx = new TaskExecutionContext(context.Context, context.Feature, taskConfig, context.Replacer.WithSubTask(mTaskDefinition, taskConfig));
                        if (execute)
                            task.Execute(ctx, ref hash);
                        else
                            task.Simulate(ctx, ref hash);
                    }
                }
            }

            return hash;
        }
Example #4
0
 public void Simulate(TaskExecutionContext context, ref StateHash hash)
 {
     hash = ExecuteCore(context, hash, false);
 }
Example #5
0
 public void Execute(TaskExecutionContext context, ref StateHash hash)
 {
     hash = ExecuteCore(context, hash, true);
 }
Example #6
0
 public Tuple<bool, string> Verify(TaskExecutionContext context, string arg)
 {
     var dir = new DirectoryInfo(context.Replacer.ReplaceVariables(arg));
     return dir.Exists ?
         Tuple.Create(true, string.Format("Directory '{0}' exists", dir.FullName)) :
         Tuple.Create(false, string.Format("Directory '{0}' does not exist", dir.FullName));
 }
 public ExecutionNode(ITask task, TaskExecutionContext taskContext)
 {
     mTask = task;
     mTaskContext = taskContext;
 }