Repository navigation
Update ResolvePackageDependencies task to support Dependencies node Plus Tests - #103
Conversation
…cies. Filter out _._ files, and make lockfile a field to facilitate testing.
… that points to the containing package and its parent targets.
| using Microsoft.Build.Utilities; | ||
| using NuGet.Configuration; | ||
| using NuGet.ProjectModel; | ||
| using System.Linq; |
There was a problem hiding this comment.
System [](start = 6, length = 6)
sort usings #Resolved
what about $"{deps.Id}/{deps.VersionRange.MinVersion.ToString()}"; here too? #Resolved Refers to: src/Tasks/Microsoft.NETCore.Build.Tasks/ResolvePackageDependencies.cs:321 in 39eea51. [](commit_id = 39eea51, deletion_comment = False) |
| var filePathList = fileGroup.GetFilePathListFor(package); | ||
| foreach (var filePath in filePathList) | ||
| { | ||
| if (Path.GetFileName(filePath) == "_._") continue; |
There was a problem hiding this comment.
continue [](start = 61, length = 8)
brackets around continue? #Resolved
| [Theory] | ||
| [InlineData("dotnet.new")] | ||
| [InlineData("simple.dependencies")] | ||
| public void ItsAssignsValidParentTargetsAndPackages(string projectName) |
There was a problem hiding this comment.
ItsAssignsValidParentTargetsAndPackages [](start = 20, length = 39)
It #Resolved
| { MetadataKeys.ResolvedPath, "some resolved path" }, | ||
| { MetadataKeys.Type, "Unknown" }, | ||
| { MetadataKeys.Type, "AnalyzerAssembly" }, | ||
| { MetadataKeys.Analyzer, "true" }, |
There was a problem hiding this comment.
{ MetadataKeys.Analyzer, "true" }, [](start = 15, length = 39)
Remove this line #Resolved
| ReportException($"Lock file {ProjectLockFile} couldn't be found. Run a NuGet package restore to generate this file."); | ||
| } | ||
|
|
||
| _lockFile = new LockFileCache(BuildEngine4).GetLockFile(ProjectLockFile); |
There was a problem hiding this comment.
What happens if ProjectLockFile is deleted between check and here? As general best practice, we should probably handle FileNotFoundException same as !File.Exists.
|
I'll go ahead and optimistically merge this in to unblock some customer demos this afternoon, but I'll keep taking feedback and open another PR shortly with more scenario tests (I'll keep #28 open to track this). |
|
Modulo @abpiskunov's comments about the tests, the product changes look fine to me. |
Fix a number of issues in ResolvePackageDependencies task to better support Dependencies node in solution explorer, including:
AnalyzerAssembly_._filesAlso add unit tests to exercise general ResolvePackageDependencies requirements. Fixes #28. To facilitate testing, make lockfile a field and provide constructors for dependency injection.
/cc @abpiskunov @eerhardt @dotnet/project-system