Beispiel #1
0
		bool Run (IBuildTask buildTask, out bool executeOnErrors)
		{
			executeOnErrors = false;

			// Run the task in batches
			bool retval = true;
			if (buckets.Count == 0) {
				// batched mode, but no values in the corresponding items!
				if (ConditionParser.ParseAndEvaluate (buildTask.Condition, project)) {
					retval = buildTask.Execute ();
					if (!retval && !buildTask.ContinueOnError)
						executeOnErrors = true;
				}

				return retval;
			}

			// batched
			foreach (Dictionary<string, BuildItemGroup> bucket in buckets) {
				project.PushBatch (bucket, commonItemsByName);
				try {
					if (ConditionParser.ParseAndEvaluate (buildTask.Condition, project)) {
						 retval = buildTask.Execute ();
						 if (!retval && !buildTask.ContinueOnError) {
							executeOnErrors = true;
							break;
						 }
					}
				} finally {
					project.PopBatch ();
				}
			}

			return retval;
		}
Beispiel #2
0
		public bool Build (IBuildTask buildTask, out bool executeOnErrors)
		{
			executeOnErrors = false;
			try {
				Init ();

				// populate list of referenced items and metadata
				ParseTaskAttributes (buildTask);
				if (consumedMetadataReferences.Count == 0) {
					// No batching required
					if (ConditionParser.ParseAndEvaluate (buildTask.Condition, project))
						return buildTask.Execute ();
					else // skipped, it should be logged
						return true;
				}

				BatchAndPrepareBuckets ();
				return Run (buildTask, out executeOnErrors);
			} finally {
				consumedItemsByName = null;
				consumedMetadataReferences = null;
				consumedQMetadataReferences = null;
				consumedUQMetadataReferences = null;
				batchedItemsByName = null;
				commonItemsByName = null;
			}
		}
Beispiel #3
0
        public bool Build(IBuildTask buildTask, out bool executeOnErrors)
        {
            executeOnErrors = false;
            try {
                Init();

                // populate list of referenced items and metadata
                ParseTaskAttributes(buildTask);
                if (consumedMetadataReferences.Count == 0)
                {
                    // No batching required
                    if (ConditionParser.ParseAndEvaluate(buildTask.Condition, project))
                    {
                        return(buildTask.Execute());
                    }
                    else                     // skipped, it should be logged
                    {
                        return(true);
                    }
                }

                BatchAndPrepareBuckets();
                return(Run(buildTask, out executeOnErrors));
            } finally {
                consumedItemsByName          = null;
                consumedMetadataReferences   = null;
                consumedQMetadataReferences  = null;
                consumedUQMetadataReferences = null;
                batchedItemsByName           = null;
                commonItemsByName            = null;
            }
        }
Beispiel #4
0
        bool Run(IBuildTask buildTask, out bool executeOnErrors)
        {
            executeOnErrors = false;

            // Run the task in batches
            bool retval = true;

            if (buckets.Count == 0)
            {
                // batched mode, but no values in the corresponding items!
                if (ConditionParser.ParseAndEvaluate(buildTask.Condition, project))
                {
                    retval = buildTask.Execute();
                    if (!retval && !buildTask.ContinueOnError)
                    {
                        executeOnErrors = true;
                    }
                }

                return(retval);
            }

            // batched
            foreach (Dictionary <string, BuildItemGroup> bucket in buckets)
            {
                project.PushBatch(bucket, commonItemsByName);
                try {
                    if (ConditionParser.ParseAndEvaluate(buildTask.Condition, project))
                    {
                        retval = buildTask.Execute();
                        if (!retval && !buildTask.ContinueOnError)
                        {
                            executeOnErrors = true;
                            break;
                        }
                    }
                } finally {
                    project.PopBatch();
                }
            }

            return(retval);
        }
Beispiel #5
0
        private BuildTaskResult ExecuteBuildTask(IBuildTask buildTask,
                                                 string taskSignature,
                                                 ImmutableArray <BuildTaskResult> dependenciesResults)
        {
            var taskOutputDir = Combine(PerTaskOutputDir, taskSignature);

            if (!Exists(taskOutputDir))
            {
                var partialTaskOutputDir = Combine(PerTaskPartialOutputDir, taskSignature);
                CreateDirectory(partialTaskOutputDir);
                buildTask.Execute(SourceDir, partialTaskOutputDir, dependenciesResults);
                Move(partialTaskOutputDir, taskOutputDir);
            }
            return(new BuildTaskResult(buildTask, taskSignature, taskOutputDir, dependenciesResults));
        }
        bool Execute(IBuildTask buildTask, TaskExecutionMode taskExecutionMode)
        {
            if (ConditionParser.ParseAndEvaluate(buildTask.Condition, project))
            {
                switch (taskExecutionMode)
                {
                case TaskExecutionMode.Complete:
                    return(buildTask.Execute());

                case TaskExecutionMode.SkipAndSetOutput:
                    return(buildTask.ResolveOutputItems());

                default:
                    throw new NotImplementedException();
                }
            }

            return(true);
        }
Beispiel #7
0
		bool Execute (IBuildTask buildTask, TaskExecutionMode taskExecutionMode)
		{
			if (ConditionParser.ParseAndEvaluate (buildTask.Condition, project)) {
				switch (taskExecutionMode) {
				case TaskExecutionMode.Complete:
					return buildTask.Execute ();
				case TaskExecutionMode.SkipAndSetOutput:
					return buildTask.ResolveOutputItems ();
				default:
					throw new NotImplementedException ();
				}
			}

			return true;
		}