// Copyright Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace BuildAgent.Issues
{
///
/// Represents information about a build associated with a particular issue
///
[DataContract]
[DebuggerDisplay("{Change}: {JobName}")]
class IssueBuild : IComparable
{
///
/// The id of this build on the server
///
[DataMember(IsRequired = true)]
public long Id = -1;
///
/// The changelist that this build was run at.
///
[DataMember(IsRequired = true)]
public int Change;
///
/// Name of this job
///
[DataMember(IsRequired = true)]
public string JobName;
///
/// Url for this job
///
[DataMember(IsRequired = true)]
public string JobUrl;
///
/// Name of this job step (typically null for sentinel builds)
///
[DataMember(IsRequired = true)]
public string JobStepName;
///
/// Url for this job step (typically null for sentinel builds)
///
[DataMember(IsRequired = true)]
public string JobStepUrl;
///
/// Url of the first error within this job
///
[DataMember]
public string ErrorUrl;
///
/// Whether this build has been posted to the server or not
///
[DataMember]
public bool bPostedToServer = false;
///
/// Constructor
///
public IssueBuild(int Change, string JobName, string JobUrl, string JobStepName, string JobStepUrl, string ErrorUrl)
{
this.Change = Change;
this.JobName = JobName;
this.JobUrl = JobUrl;
this.JobStepName = JobStepName;
this.JobStepUrl = JobStepUrl;
this.ErrorUrl = ErrorUrl;
}
///
/// Compares this build to another build
///
/// Build to compare to
/// Value indicating how the two builds should be ordered
public int CompareTo(IssueBuild Other)
{
int Delta = Change - Other.Change;
if (Delta == 0)
{
Delta = JobUrl.CompareTo(Other.JobUrl);
if(Delta == 0)
{
Delta = JobStepUrl.CompareTo(Other.JobStepUrl);
}
}
return Delta;
}
}
}