Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ProjectInfo.cs « ProjectModel « tasks « build - github.com/dotnet/aspnetcore.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1dd433918581db1e84c80256f53225c51f65c2c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Collections.Generic;
using System.IO;

namespace RepoTasks.ProjectModel
{
    internal class ProjectInfo
    {
        public ProjectInfo(string fullPath,
            string projectExtensionsPath,
            IReadOnlyList<ProjectFrameworkInfo> frameworks,
            IReadOnlyList<DotNetCliReferenceInfo> tools,
            bool isPackable,
            string packageId,
            string packageVersion)
        {
            if (!Path.IsPathRooted(fullPath))
            {
                throw new ArgumentException("Path must be absolute", nameof(fullPath));
            }

            Frameworks = frameworks ?? throw new ArgumentNullException(nameof(frameworks));
            Tools = tools ?? throw new ArgumentNullException(nameof(tools));

            FullPath = fullPath;
            FileName = Path.GetFileName(fullPath);
            Directory = Path.GetDirectoryName(FullPath);
            ProjectExtensionsPath = projectExtensionsPath ?? Path.Combine(Directory, "obj");
            IsPackable = isPackable;
            PackageId = packageId;
            PackageVersion = packageVersion;
        }

        public string FullPath { get; }
        public string FileName { get; }
        public string ProjectExtensionsPath { get; }
        public string Directory { get; }
        public string PackageId { get; }
        public string PackageVersion { get; }
        public bool IsPackable { get; }

        public IReadOnlyList<ProjectFrameworkInfo> Frameworks { get; }
        public IReadOnlyList<DotNetCliReferenceInfo> Tools { get; }
    }
}