Remove MSBuildProjectPath property
This commit is contained in:
parent
b7ca1d14bd
commit
8a3ddc9c8a
3 changed files with 12 additions and 31 deletions
|
@ -24,8 +24,6 @@ namespace Microsoft.DotNet.ProjectModel.Server.Models
|
|||
|
||||
public bool Resolved { get; private set; }
|
||||
|
||||
public string MSBuildProjectPath { get; private set; }
|
||||
|
||||
public IEnumerable<DependencyItem> Dependencies { get; private set; }
|
||||
|
||||
public IEnumerable<DiagnosticMessageView> Errors { get; private set; }
|
||||
|
@ -72,13 +70,13 @@ namespace Microsoft.DotNet.ProjectModel.Server.Models
|
|||
Warnings = diagnostics.Where(d => d.Severity == DiagnosticMessageSeverity.Warning)
|
||||
.Select(d => new DiagnosticMessageView(d))
|
||||
};
|
||||
|
||||
|
||||
var msbuildLibrary = library as MSBuildProjectDescription;
|
||||
if (msbuildLibrary != null)
|
||||
{
|
||||
result.MSBuildProjectPath = msbuildLibrary.ProjectLibrary.MSBuildProject;
|
||||
result.Path = msbuildLibrary.MSBuildProjectPath;
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,15 +10,13 @@ namespace Microsoft.DotNet.ProjectModel.Server.Models
|
|||
public FrameworkData Framework { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Path { get; set; }
|
||||
public string MSBuildProjectPath { 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(MSBuildProjectPath, other.MSBuildProjectPath);
|
||||
string.Equals(Path, other.Path);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
|
@ -47,8 +45,7 @@ namespace Microsoft.DotNet.ProjectModel.Server.Models
|
|||
{
|
||||
Framework = library.Framework.ToPayload(),
|
||||
Name = library.Identity.Name,
|
||||
Path = library.Path,
|
||||
MSBuildProjectPath = ((MSBuildProjectDescription)library).ProjectLibrary.MSBuildProject
|
||||
Path = ((MSBuildProjectDescription)library).MSBuildProjectPath,
|
||||
};
|
||||
}
|
||||
else
|
||||
|
|
|
@ -149,8 +149,7 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
|
|||
.AssertJArrayCount(1)
|
||||
.RetrieveArraryElementAs<JObject>(0)
|
||||
.AssertProperty("Name", expectedUnresolvedDependency)
|
||||
.AssertProperty("Path", expectedUnresolvedProjectPath)
|
||||
.AssertProperty<JToken>("MSBuildProjectPath", prop => !prop.HasValues);
|
||||
.AssertProperty("Path", expectedUnresolvedProjectPath);
|
||||
}
|
||||
else if (referenceType == "Package")
|
||||
{
|
||||
|
@ -432,11 +431,12 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
|
|||
|
||||
var classLibraries = new HashSet<string>(new string[] { "ClassLibrary1", "ClassLibrary2", "ClassLibrary3" });
|
||||
var dependencies = messages.RetrieveSingleMessage(MessageTypes.Dependencies);
|
||||
var testProjectRoot = Path.Combine(RepoRoot, "TestAssets", "ProjectModelServer", "MSBuildReferencesProjects", "ValidCase01");
|
||||
foreach (var classLibrary in classLibraries)
|
||||
{
|
||||
{
|
||||
dependencies.RetrieveDependency(classLibrary)
|
||||
.AssertProperty("Type", LibraryType.MSBuildProject.ToString())
|
||||
.AssertProperty("MSBuildProjectPath", AssertPathsEqual(Path.Combine("..", "..", classLibrary, $"{classLibrary}.csproj")))
|
||||
.AssertProperty("Path", NormalizePathString(Path.Combine(testProjectRoot, classLibrary, $"{classLibrary}.csproj")))
|
||||
.AssertProperty<bool>("Resolved", true)
|
||||
.AssertProperty("Name", classLibrary)
|
||||
.AssertProperty<JArray>("Errors", array => array.Count == 0)
|
||||
|
@ -454,8 +454,7 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
|
|||
var name = projectRef["Name"].Value<string>();
|
||||
|
||||
Assert.True(classLibraries.Contains(name));
|
||||
projectRef.AssertProperty<string>("Path", path => path.Contains(Path.Combine("ValidCase01", name)))
|
||||
.AssertProperty("MSBuildProjectPath", AssertPathsEqual(Path.Combine("..", "..", name, $"{name}.csproj")));
|
||||
projectRef.AssertProperty("Path", NormalizePathString(Path.Combine(testProjectRoot, name, $"{name}.csproj")));
|
||||
}
|
||||
|
||||
var fileReferences = references.RetrievePropertyAs<JArray>("FileReferences")
|
||||
|
@ -468,22 +467,9 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
|
|||
}
|
||||
}
|
||||
|
||||
private static Func<string, bool> AssertPathsEqual(string expectedString)
|
||||
private static string NormalizePathString(string original)
|
||||
{
|
||||
return
|
||||
(string t) =>
|
||||
{
|
||||
if (t.Contains('/'))
|
||||
{
|
||||
t = t.Replace('/', Path.DirectorySeparatorChar);
|
||||
}
|
||||
else if (t.Contains('\\'))
|
||||
{
|
||||
t = t.Replace('\\', Path.DirectorySeparatorChar);
|
||||
}
|
||||
|
||||
return string.Equals(t, expectedString);
|
||||
};
|
||||
return original.Replace('/', Path.DirectorySeparatorChar).Replace('\\', Path.DirectorySeparatorChar);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue