2015-12-09 09:57:45 -08:00
|
|
|
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
|
|
|
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
|
|
|
|
|
|
|
|
namespace Microsoft.DotNet.ProjectModel.Server.Models
|
|
|
|
|
{
|
|
|
|
|
internal class ProjectReferenceDescription
|
|
|
|
|
{
|
|
|
|
|
private ProjectReferenceDescription() { }
|
|
|
|
|
|
2016-01-02 00:44:59 -08:00
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
public string Path { get; set; }
|
|
|
|
|
public string WrappedProjectPath { get; set; }
|
|
|
|
|
|
|
|
|
|
public override bool Equals(object obj)
|
|
|
|
|
{
|
|
|
|
|
var other = obj as ProjectReferenceDescription;
|
|
|
|
|
return other != null &&
|
|
|
|
|
string.Equals(Name, other.Name) &&
|
|
|
|
|
string.Equals(Path, other.Path) &&
|
|
|
|
|
string.Equals(WrappedProjectPath, other.WrappedProjectPath);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override int GetHashCode()
|
|
|
|
|
{
|
|
|
|
|
return base.GetHashCode();
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-09 09:57:45 -08:00
|
|
|
|
public static ProjectReferenceDescription Create(ProjectDescription description)
|
|
|
|
|
{
|
|
|
|
|
var targetFrameworkInformation = description.TargetFrameworkInfo;
|
|
|
|
|
|
|
|
|
|
string wrappedProjectPath = null;
|
|
|
|
|
if (!string.IsNullOrEmpty(targetFrameworkInformation?.WrappedProject) &&
|
|
|
|
|
description.Project != null)
|
|
|
|
|
{
|
|
|
|
|
wrappedProjectPath = System.IO.Path.Combine(
|
|
|
|
|
description.Project.ProjectDirectory,
|
|
|
|
|
targetFrameworkInformation.WrappedProject);
|
|
|
|
|
|
|
|
|
|
wrappedProjectPath = System.IO.Path.GetFullPath(wrappedProjectPath);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new ProjectReferenceDescription
|
|
|
|
|
{
|
|
|
|
|
Name = description.Identity.Name,
|
|
|
|
|
Path = description.Path,
|
|
|
|
|
WrappedProjectPath = wrappedProjectPath,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|