Skip to content
Browse files

Merge remote-tracking branch 'obones/Issue46'

  • Loading branch information...
2 parents ec16481 + fc30ded commit fe4801b047eb450c0123f6b04ca7c9d577fbbba5 @dhommel dhommel committed Jan 9, 2012
Showing with 61 additions and 3 deletions.
  1. +41 −3 project/core/tasks/SequentialTask.cs
  2. +20 −0 project/core/util/BuildProgressInformation.cs
View
44 project/core/tasks/SequentialTask.cs
@@ -68,6 +68,38 @@ public override ITask[] Tasks
#endregion
#endregion
+ private class _RunningSubTaskDetails
+ {
+ private int _Index;
+ private IIntegrationResult _ParentResult;
+
+ public _RunningSubTaskDetails(int Index, IIntegrationResult ParentResult)
+ {
+ _Index = Index;
+ _ParentResult = ParentResult;
+ }
+
+ public int Index { get { return _Index; } }
+ public IIntegrationResult ParentResult { get { return _ParentResult; } }
+ }
+
+ private string _getStatusInformation(string runningSubTaskStartupInfo, _RunningSubTaskDetails Details)
+ {
+ string Value = !string.IsNullOrEmpty(Description)
+ ? Description
+ : string.Format("Running sequential tasks ({0} task(s))", Tasks.Length);
+
+ if (Details != null)
+ Value += string.Format(": [{0}] {1}",
+ Details.Index,
+ !string.IsNullOrEmpty(runningSubTaskStartupInfo)
+ ? runningSubTaskStartupInfo
+ : "No information");
+
+ return Value;
+ }
+
+
#region Protected methods
#region Execute()
/// <summary>
@@ -79,9 +111,7 @@ protected override bool Execute(IIntegrationResult result)
// Initialise the task
var logger = Logger ?? new DefaultLogger();
var numberOfTasks = Tasks.Length;
- result.BuildProgressInformation.SignalStartRunTask(!string.IsNullOrEmpty(Description)
- ? Description
- : string.Format(System.Globalization.CultureInfo.CurrentCulture,"Running sequential tasks ({0} task(s))", numberOfTasks));
+ result.BuildProgressInformation.SignalStartRunTask(_getStatusInformation("", null));
logger.Info("Starting sequential task with {0} sub-task(s)", numberOfTasks);
// Launch each task
@@ -95,6 +125,8 @@ protected override bool Execute(IIntegrationResult result)
{
// Start the actual task
var taskResult = result.Clone();
+ taskResult.BuildProgressInformation.OnStartupInformationUpdatedUserObject = new _RunningSubTaskDetails(loop, result);
+ taskResult.BuildProgressInformation.OnStartupInformationUpdated = SubTaskStartupInformationUpdated;
var task = Tasks[loop];
RunTask(task, taskResult);
result.Merge(taskResult);
@@ -126,5 +158,11 @@ protected override bool Execute(IIntegrationResult result)
}
#endregion
#endregion
+
+ private void SubTaskStartupInformationUpdated(string information, object UserObject)
+ {
+ _RunningSubTaskDetails Details = (_RunningSubTaskDetails)UserObject;
+ Details.ParentResult.BuildProgressInformation.UpdateStartupInformation(_getStatusInformation(information, Details));
+ }
}
}
View
20 project/core/util/BuildProgressInformation.cs
@@ -18,6 +18,15 @@ public class BuildProgressInformation
private readonly object lockObject = new object();
private System.Collections.Generic.List<BuildProgressInformationData> Progress;
private const Int32 MaxItemsInQueue = 10;
+ private OnStartupInformationUpdatedDelegate _OnStartupInformationUpdated = null;
+
+
+ private void DoStartupInformationUpdated(string information)
+ {
+ this._lastTimeQueried = DateTime.Now.AddYears(-10);
+ if (_OnStartupInformationUpdated != null)
+ OnStartupInformationUpdated(information, OnStartupInformationUpdatedUserObject);
+ }
/// <summary>
@@ -56,9 +65,13 @@ public virtual void SignalStartRunTask(string information)
this._buildInformation = GetQueueDataAsXml();
this._lastTimeQueried = DateTime.Now.AddYears(-10);
+ DoStartupInformationUpdated(information);
}
}
+ public delegate void OnStartupInformationUpdatedDelegate(string information, object UserObject);
+ public OnStartupInformationUpdatedDelegate OnStartupInformationUpdated { get { return _OnStartupInformationUpdated; } set { _OnStartupInformationUpdated += value; } }
+ public object OnStartupInformationUpdatedUserObject { get; set; }
/// <summary>
/// Adds the task information.
@@ -74,6 +87,13 @@ public virtual void AddTaskInformation(string information)
}
+ public void UpdateStartupInformation(string information)
+ {
+ Progress[0] = new BuildProgressInformationData(information);
+
+ DoStartupInformationUpdated(information);
+ }
+
/// <summary>
/// Gets the build progress information.
/// </summary>

0 comments on commit fe4801b

Please sign in to comment.
Something went wrong with that request. Please try again.