Esempio n. 1
0
        bool RunUnbatched(Target target, out bool executeOnErrors)
        {
            bool result = true;

            executeOnErrors = false;
            LogTargetStarted(target);
            try {
                if (!BuildTargetNeeded())
                {
                    LogTargetSkipped(target);
                    LogTargetFinished(target, true);
                    return(true);
                }

                foreach (BuildTask bt in target.BuildTasks)
                {
                    TaskBatchingImpl batchingImpl = new TaskBatchingImpl(project);
                    result = batchingImpl.Build(bt, out executeOnErrors);

                    if (!result && !bt.ContinueOnError)
                    {
                        executeOnErrors = true;
                        break;
                    }
                }
            } finally {
                LogTargetFinished(target, result);
            }

            return(result);
        }
Esempio n. 2
0
        bool RunTargetWithBucket(Dictionary <string, BuildItemGroup> bucket, Target target, out bool executeOnErrors)
        {
            bool target_result = true;

            executeOnErrors = false;

            LogTargetStarted(target);
            if (bucket != null)
            {
                project.PushBatch(bucket, commonItemsByName);
            }
            try
            {
                string reason;
                if (!BuildTargetNeeded(out reason))
                {
                    LogTargetSkipped(target, reason);
                    return(true);
                }

                if (!String.IsNullOrEmpty(reason))
                {
                    target.Engine.LogMessage(MessageImportance.Low, reason);
                }

                for (int i = 0; i < target.BuildTasks.Count; i++)
                {
                    //FIXME: parsing attributes repeatedly
                    BuildTask bt = target.BuildTasks [i];

                    TaskBatchingImpl batchingImpl = new TaskBatchingImpl(project);
                    bool             task_result  = batchingImpl.Build(bt, out executeOnErrors);
                    if (task_result)
                    {
                        continue;
                    }

                    // task failed, if ContinueOnError,
                    // ignore failed state for target
                    target_result = bt.ContinueOnError;

                    if (!bt.ContinueOnError)
                    {
                        executeOnErrors = true;
                        return(false);
                    }
                }
            }
            finally
            {
                if (bucket != null)
                {
                    project.PopBatch();
                }
                LogTargetFinished(target, target_result);
            }

            return(target_result);
        }
        bool RunTargetWithBucket(Dictionary <string, BuildItemGroup> bucket, Target target, out bool executeOnErrors)
        {
            bool target_result = true;

            executeOnErrors = false;

            LogTargetStarted(target);

            if (bucket != null)
            {
                project.PushBatch(bucket, commonItemsByName);
            }

            try {
                TaskExecutionMode taskExecutionMode;
                string            reason;
                bool skip_completely;
                if (!BuildTargetNeeded(out reason, out skip_completely))
                {
                    LogTargetSkipped(target, reason);
                    if (skip_completely)
                    {
                        return(true);
                    }

                    taskExecutionMode = TaskExecutionMode.SkipAndSetOutput;
                }
                else
                {
                    taskExecutionMode = TaskExecutionMode.Complete;

                    if (!String.IsNullOrEmpty(reason))
                    {
                        target.Engine.LogMessage(MessageImportance.Low, reason);
                    }
                }

                for (int i = 0; i < target.BuildTasks.Count; i++)
                {
                    //FIXME: parsing attributes repeatedly
                    IBuildTask bt = target.BuildTasks [i];

                    // HACK: need some form of cross references checks
                    var tem = taskExecutionMode;
                    if (tem == TaskExecutionMode.SkipAndSetOutput)
                    {
                        var bti = bt as BuildTask;

                        //
                        // BuildTargetNeeded checks only files timestamps but ignores any metadata dependencies
                        // that way we can end up in the situation when output metadata are populated but from
                        // incomplete dependencies.
                        //
                        // E.g.
                        // <CreateItem Include="$(IntermediateOutputPath)%(_PngImage.LogicalName)" AdditionalMetadata="LogicalName=%(_PngImage.LogicalName)">
                        //		<Output TaskParameter="Include" />
                        // </CreateItem>
                        //
                        if (bti != null && bti.Name == "CreateItem")
                        {
                            tem = TaskExecutionMode.Complete;
                        }
                    }

                    TaskBatchingImpl batchingImpl = new TaskBatchingImpl(project);
                    bool             task_result  = batchingImpl.Build(bt, tem, out executeOnErrors);
                    if (task_result)
                    {
                        continue;
                    }

                    // task failed, if ContinueOnError,
                    // ignore failed state for target
                    target_result = bt.ContinueOnError;

                    if (!bt.ContinueOnError)
                    {
                        executeOnErrors = true;
                        return(false);
                    }
                }
            } finally {
                if (bucket != null)
                {
                    project.PopBatch();
                }

                LogTargetFinished(target, target_result);
            }

            return(target_result);
        }
Esempio n. 4
0
		bool RunTargetWithBucket (Dictionary<string, BuildItemGroup> bucket, Target target, out bool executeOnErrors)
		{
			bool target_result = true;
			executeOnErrors = false;

			LogTargetStarted (target);

			if (bucket != null)
				project.PushBatch (bucket, commonItemsByName);

			try {
				TaskExecutionMode taskExecutionMode;
				string reason;
				bool skip_completely;
				if (!BuildTargetNeeded (out reason, out skip_completely)) {
					LogTargetSkipped (target, reason);
					if (skip_completely)
						return true;

					taskExecutionMode = TaskExecutionMode.SkipAndSetOutput;
				} else {
					taskExecutionMode = TaskExecutionMode.Complete;

					if (!String.IsNullOrEmpty (reason))
						target.Engine.LogMessage (MessageImportance.Low, reason);
				}

				for (int i = 0; i < target.BuildTasks.Count; i ++) {
					//FIXME: parsing attributes repeatedly
					IBuildTask bt = target.BuildTasks [i];

					// HACK: need some form of cross references checks
					var tem = taskExecutionMode;
					if (tem == TaskExecutionMode.SkipAndSetOutput) {
						var bti = bt as BuildTask;

						//
						// BuildTargetNeeded checks only files timestamps but ignores any metadata dependencies
						// that way we can end up in the situation when output metadata are populated but from
						// incomplete dependencies.
						//
						// E.g.
						// <CreateItem Include="$(IntermediateOutputPath)%(_PngImage.LogicalName)" AdditionalMetadata="LogicalName=%(_PngImage.LogicalName)">
						//		<Output TaskParameter="Include" />
						// </CreateItem>
						//
						if (bti != null && bti.Name == "CreateItem")
							tem = TaskExecutionMode.Complete;
					}

					TaskBatchingImpl batchingImpl = new TaskBatchingImpl (project);
					bool task_result = batchingImpl.Build (bt, tem, out executeOnErrors);
					if (task_result)
						continue;

					// task failed, if ContinueOnError,
					// ignore failed state for target
					target_result = bt.ContinueOnError;

					if (!bt.ContinueOnError) {
						executeOnErrors = true;
						return false;
					}

				}
			} finally {
				if (bucket != null)
					project.PopBatch ();

				LogTargetFinished (target, target_result);
			}

			return target_result;
		}
Esempio n. 5
0
		bool RunTargetWithBucket (Dictionary<string, BuildItemGroup> bucket, Target target, out bool executeOnErrors)
		{
			bool target_result = true;
			executeOnErrors = false;

			LogTargetStarted (target);
			if (bucket != null)
				project.PushBatch (bucket, commonItemsByName);
			try {
				string reason;
				if (!BuildTargetNeeded (out reason)) {
					LogTargetSkipped (target, reason);
					return true;
				}

				if (!String.IsNullOrEmpty (reason))
					target.Engine.LogMessage (MessageImportance.Low, reason);

				for (int i = 0; i < target.BuildTasks.Count; i ++) {
					//FIXME: parsing attributes repeatedly
					BuildTask bt = target.BuildTasks [i];

					TaskBatchingImpl batchingImpl = new TaskBatchingImpl (project);
					bool task_result = batchingImpl.Build (bt, out executeOnErrors);
					if (task_result)
						continue;

					// task failed, if ContinueOnError,
					// ignore failed state for target
					target_result = bt.ContinueOnError;

					if (!bt.ContinueOnError) {
						executeOnErrors = true;
						return false;
					}

				}
			} finally {
				if (bucket != null)
					project.PopBatch ();
				LogTargetFinished (target, target_result);
			}

			return target_result;
		}
		bool RunUnbatched (Target target, out bool executeOnErrors)
		{
			bool result = true;
			executeOnErrors = false;
			LogTargetStarted (target);
			try {
				if (!BuildTargetNeeded ()) {
					LogTargetSkipped (target);
					LogTargetFinished (target, true);
					return true;
				}

				foreach (BuildTask bt in target.BuildTasks) {
					TaskBatchingImpl batchingImpl = new TaskBatchingImpl (project);
					result = batchingImpl.Build (bt, out executeOnErrors);

					if (!result && !bt.ContinueOnError) {
						executeOnErrors = true;
						break;
					}
				}
			} finally {
				LogTargetFinished (target, result);
			}

			return result;
		}