Repository.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. // Copyright (c) .NET Foundation. All rights reserved.
  2. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Diagnostics;
  6. using System.Linq;
  7. namespace RepoTools.BuildGraph
  8. {
  9. [DebuggerDisplay("{Name}")]
  10. public class Repository : IEquatable<Repository>
  11. {
  12. public Repository(string name)
  13. {
  14. Name = name;
  15. }
  16. public string Name { get; private set; }
  17. public string RootDir { get; set; }
  18. public IList<Project> Projects { get; } = new List<Project>();
  19. public IList<Project> SupportProjects { get; } = new List<Project>();
  20. public IEnumerable<Project> AllProjects => Projects.Concat(SupportProjects);
  21. public bool Equals(Repository other) => string.Equals(Name, other.Name, StringComparison.OrdinalIgnoreCase);
  22. public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Name);
  23. }
  24. }