/// <summary> /// Starts a new child context. /// </summary> /// <param name="task">The task.</param> /// <returns> /// The new child <see cref="TaskExecutionContext"/>. /// </returns> public virtual TaskExecutionContext StartChild(Task task) { logger.Debug("Starting new task execution context for '{0}'", task.NameOrType); var parameters = new TaskExecutionParameters { XmlWriter = this.writer, FileSystem = this.fileSystem, Clock = this.clock, IntegrationRequest = this.request, Project = this.project, BuildName = this.buildName }; var child = new TaskExecutionContext(parameters) { Parent = this, modificationsSets = this.modificationsSets, modificationsLock = this.modificationsLock }; this.writer.WriteStartElement("task"); if (!string.IsNullOrEmpty(task.Name)) { this.writer.WriteAttributeString("name", task.Name); } this.writer.WriteAttributeString("type", task.GetType().Name); writer.WriteElementString("start", this.clock.Now.ToString("s")); return(child); }
/// <summary> /// Prevents a default instance of the <see cref="TaskExecutionContext"/> class from being created. /// </summary> /// <param name="parameters">The parameters.</param> public TaskExecutionContext(TaskExecutionParameters parameters) { this.writer = parameters.XmlWriter; this.fileSystem = parameters.FileSystem; this.clock = parameters.Clock; this.request = parameters.IntegrationRequest; this.project = parameters.Project; this.buildName = parameters.BuildName; }
/// <summary> /// Starts a new child context. /// </summary> /// <param name="task">The task.</param> /// <returns> /// The new child <see cref="TaskExecutionContext"/>. /// </returns> public virtual TaskExecutionContext StartChild(Task task) { logger.Debug("Starting new task execution context for '{0}'", task.NameOrType); var parameters = new TaskExecutionParameters { XmlWriter = this.writer, FileSystem = this.fileSystem, Clock = this.clock, IntegrationRequest = this.request, Project = this.project, BuildName = this.buildName }; var child = new TaskExecutionContext(parameters) { Parent = this, modificationsSets = this.modificationsSets, modificationsLock = this.modificationsLock }; this.writer.WriteStartElement("task"); if (!string.IsNullOrEmpty(task.Name)) { this.writer.WriteAttributeString("name", task.Name); } this.writer.WriteAttributeString("type", task.GetType().Name); writer.WriteElementString("start", this.clock.Now.ToString("s")); return child; }