//This is a recursive method that will keep on driling a build // configuration one after the other in the workflow private void DrillDependency(TcBuildConfiguration drillPoint, TcProjects tcProjects) { var dependentBuilds = tcProjects.FindAllBuildConfigurationsDependentOnBuildConfigurationId(drillPoint.Id); drillPoint.SnapshotDependency.ForEach(sd => { var desc = String.Format("{0} will wait for this to complete successfully",drillPoint.Name); finalString += FormatString(tcProjects, drillPoint, tcProjects.FindBuildConfigurationById(sd),desc); }); if (drillPoint.HasArtifactsDependency) { drillPoint.ArtifactsDependency.ForEach(ad => { var desc = string.Format("Get {0} artifacts", ad.ArtifactFile); finalString += FormatStringForArtifacts(tcProjects, drillPoint, tcProjects.FindBuildConfigurationById (ad.BuildConfigurationId), desc); }); } if (drillPoint.HasSnapshotDependency) { finalString += FormatString(tcProjects, drillPoint, drillPoint, string.Format("After successful completion of all, {0} will complete",drillPoint.Name)); } if (dependentBuilds.Count != 0) dependentBuilds.ForEach(db => { finalString += FormatString(tcProjects, drillPoint, db, "On completion of " + drillPoint.Name); }); if (dependentBuilds.Count != 0) dependentBuilds.ForEach(db => DrillDependency(db, tcProjects)); return ; }
private string FormatStringForArtifacts(TcProjects tcProjects, TcBuildConfiguration drillPoint, TcBuildConfiguration db, string desc) { return string.Format("{0}-{1}-->{2}-{3}:{4}#", tcProjects.FindProjectByBuildConfigurationId(drillPoint.Id).ProjectName, drillPoint.Name, tcProjects.FindProjectByBuildConfigurationId(db.Id).ProjectName, db.Name, desc ?? string.Empty); }