ProjectInfo.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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.IO;
  6. namespace RepoTasks.ProjectModel
  7. {
  8. internal class ProjectInfo
  9. {
  10. public ProjectInfo(string fullPath,
  11. string projectExtensionsPath,
  12. IReadOnlyList<ProjectFrameworkInfo> frameworks,
  13. IReadOnlyList<DotNetCliReferenceInfo> tools,
  14. bool isPackable,
  15. string packageId,
  16. string packageVersion)
  17. {
  18. if (!Path.IsPathRooted(fullPath))
  19. {
  20. throw new ArgumentException("Path must be absolute", nameof(fullPath));
  21. }
  22. Frameworks = frameworks ?? throw new ArgumentNullException(nameof(frameworks));
  23. Tools = tools ?? throw new ArgumentNullException(nameof(tools));
  24. FullPath = fullPath;
  25. FileName = Path.GetFileName(fullPath);
  26. Directory = Path.GetDirectoryName(FullPath);
  27. ProjectExtensionsPath = projectExtensionsPath ?? Path.Combine(Directory, "obj");
  28. IsPackable = isPackable;
  29. PackageId = packageId;
  30. PackageVersion = packageVersion;
  31. }
  32. public string FullPath { get; }
  33. public string FileName { get; }
  34. public string ProjectExtensionsPath { get; }
  35. public string Directory { get; }
  36. public string PackageId { get; }
  37. public string PackageVersion { get; }
  38. public bool IsPackable { get; }
  39. public IReadOnlyList<ProjectFrameworkInfo> Frameworks { get; }
  40. public IReadOnlyList<DotNetCliReferenceInfo> Tools { get; }
  41. }
  42. }