Esempio n. 1
0
File: Target.cs Progetto: 3F/IeXod
        /// <summary>
        /// Executes a task within a target. This method initializes a task engine for the given task, and then executes the task
        /// using the engine.
        /// </summary>
        /// <param name="taskNode"></param>
        /// <param name="hostObject"></param>
        /// <returns>true, if successful</returns>
        internal bool ExecuteOneTask(XmlElement taskNode, ITaskHost hostObject)
        {
            bool taskExecutedSuccessfully = false;

            string            projectFileOfTaskNode   = XmlUtilities.GetXmlNodeFile(taskNode, parentProject.FullFileName);
            BuildEventContext targetBuildEventContext = new BuildEventContext
                                                        (
                ParentProject.ProjectBuildEventContext.NodeId,
                this.id,
                ParentProject.ProjectBuildEventContext.ProjectContextId,
                ParentProject.ProjectBuildEventContext.TaskId
                                                        );
            int handleId = parentEngine.EngineCallback.CreateTaskContext(ParentProject, this, null, taskNode,
                                                                         EngineCallback.inProcNode, targetBuildEventContext);
            TaskExecutionModule taskExecutionModule = parentEngine.NodeManager.TaskExecutionModule;
            TaskEngine          taskEngine          = new TaskEngine(taskNode, hostObject, parentProject.FullFileName, projectFileOfTaskNode, parentEngine.LoggingServices, handleId, taskExecutionModule, targetBuildEventContext);

            taskExecutedSuccessfully =
                taskEngine.ExecuteTask
                (
                    TaskExecutionMode.ExecuteTaskAndGatherOutputs,
                    new Lookup(parentProject.evaluatedItemsByName, parentProject.evaluatedProperties, ParentProject.ItemDefinitionLibrary)
                );

            return(taskExecutedSuccessfully);
        }
Esempio n. 2
0
 /// <summary>
 /// Since we could not derrive from TaskEngine and have no Interface, we need to overide the method in here and
 /// replace the calls when testing the class because of the calls to TaskEngine. If at a future time we get a mock task
 /// engine, Interface or a non sealed TaskEngine these methods can disappear.
 /// </summary>
 /// <returns></returns>
 virtual internal bool TaskEngineExecuteTask(
     TaskEngine taskEngine,
     TaskExecutionMode howTaskShouldBeExecuted,
     Lookup lookup
     )
 {
     return(taskEngine.ExecuteTask
            (
                howTaskShouldBeExecuted,
                lookup
            ));
 }