using System; using System.Collections.Generic; using System.ComponentModel; using System.Runtime.Serialization; namespace GitHub.DistributedTask.Pipelines { [DataContract] [EditorBrowsable(EditorBrowsableState.Never)] public class ContinuousIntegrationTrigger : PipelineTrigger { public ContinuousIntegrationTrigger() : base(PipelineTriggerType.ContinuousIntegration) { Enabled = true; } [DataMember(EmitDefaultValue = true)] public Boolean Enabled { get; set; } /// /// Indicates whether changes should be batched while another CI pipeline is running. /// /// /// If this is true, then changes submitted while a CI pipeline is running will be batched and built in one new CI pipeline when the current pipeline finishes. /// If this is false, then a new CI pipeline will be triggered for each change to the repository. /// [DataMember(EmitDefaultValue = false)] public Boolean BatchChanges { get; set; } /// /// A list of filters that describe which branches will trigger pipelines. /// public IList BranchFilters { get { if (m_branchFilters == null) { m_branchFilters = new List(); } return m_branchFilters; } } /// /// A list of filters that describe which paths will trigger pipelines. /// public IList PathFilters { get { if (m_pathFilters == null) { m_pathFilters = new List(); } return m_pathFilters; } } [OnSerializing] private void OnSerializing(StreamingContext context) { if (m_branchFilters?.Count == 0) { m_branchFilters = null; } if (m_pathFilters?.Count == 0) { m_pathFilters = null; } } [DataMember(Name = "BranchFilters", EmitDefaultValue = false)] private List m_branchFilters; [DataMember(Name = "PathFilters", EmitDefaultValue = false)] private List m_pathFilters; } }