/// <summary> /// Add a statistic to the build if its Include property is true. /// </summary> /// <param name="statistic">The name of the statistic.</param> /// <remarks> /// If the statistic's <see cref="StatisticBase.Include"/> property /// is false, this method may actually remove it from the list! /// </remarks> internal void Add(StatisticBase statistic) { if (!logStatistics.Contains(statistic)) { logStatistics.Add(statistic); } else { int indexOf = logStatistics.IndexOf(statistic); logStatistics.Remove(statistic); if (statistic.Include) { logStatistics.Insert(indexOf, statistic); } } }
/// <summary> /// Add a statistic to the build if its Include property is true. /// </summary> /// <param name="statistic">The name of the statistic.</param> /// <remarks> /// If the statistic's <see cref="StatisticBase.Include"/> property /// is false, this method may actually remove it from the list! /// </remarks> internal void Add(StatisticBase statistic) { if (!logStatistics.Contains(statistic)) { logStatistics.Add(statistic); } else { int indexOf = logStatistics.IndexOf(statistic); logStatistics.Remove(statistic); if (statistic.Include) { logStatistics.Insert(indexOf, statistic); } } }
/// <summary> /// Publish the statistics for this build. /// </summary> /// <param name="integrationResult">The results of the build.</param> protected override bool Execute(IIntegrationResult integrationResult) { StatisticsBuilder builder = new StatisticsBuilder(); for (int i = 0; i < ConfiguredStatistics.Length; i++) { StatisticBase statistic = ConfiguredStatistics[i]; builder.Add(statistic); // Note: This may actually remove the statistic if include=false. } StatisticsResults stats = builder.ProcessBuildResults(integrationResult); UpdateXmlFile(stats, integrationResult); //commented out because this does not work //ChartGenerator(builder.Statistics).Process(xmlDocument, integrationResult.ArtifactDirectory); UpdateCsvFile(stats, builder.Statistics, integrationResult); return(true); }