From 1470ab60d2cca994bf418889a951fed3602f607d Mon Sep 17 00:00:00 2001 From: David Fowler Date: Sun, 8 Nov 2015 07:38:42 -0800 Subject: [PATCH] Fix dependency issues - Normal behaviors things were being shown as warnings. Cousin dependencies always get version bumped. --- .../ProjectContextBuilder.cs | 2 +- .../Resolution/LibraryManager.cs | 21 +++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.DotNet.ProjectModel/ProjectContextBuilder.cs b/src/Microsoft.DotNet.ProjectModel/ProjectContextBuilder.cs index 2f1979fed..7ec9658e9 100644 --- a/src/Microsoft.DotNet.ProjectModel/ProjectContextBuilder.cs +++ b/src/Microsoft.DotNet.ProjectModel/ProjectContextBuilder.cs @@ -204,7 +204,7 @@ namespace Microsoft.Extensions.ProjectModel } // Create a library manager - var libraryManager = new LibraryManager(libraries.Values.ToList(), diagnostics); + var libraryManager = new LibraryManager(libraries.Values.ToList(), diagnostics, Project.ProjectFilePath); return new ProjectContext( GlobalSettings, diff --git a/src/Microsoft.DotNet.ProjectModel/Resolution/LibraryManager.cs b/src/Microsoft.DotNet.ProjectModel/Resolution/LibraryManager.cs index 4dec99180..dfffbe9f3 100644 --- a/src/Microsoft.DotNet.ProjectModel/Resolution/LibraryManager.cs +++ b/src/Microsoft.DotNet.ProjectModel/Resolution/LibraryManager.cs @@ -11,12 +11,15 @@ namespace Microsoft.Extensions.ProjectModel.Resolution { private readonly IList _libraries; private readonly IList _diagnostics; + private readonly string _projectPath; public LibraryManager(IList libraries, - IList diagnostics) + IList diagnostics, + string projectPath) { _libraries = libraries; _diagnostics = diagnostics; + _projectPath = projectPath; } public IList GetLibraries() @@ -62,11 +65,19 @@ namespace Microsoft.Extensions.ProjectModel.Resolution foreach (var range in library.RequestedRanges) { // Skip libraries that aren't specified in a project.json + // Only report problems for this project if (string.IsNullOrEmpty(range.SourceFilePath)) { continue; } + // We only care about things requested in this project + if (!string.Equals(_projectPath, range.SourceFilePath)) + { + continue; + } + + if (range.VersionRange == null) { // TODO: Show errors/warnings for things without versions @@ -116,6 +127,12 @@ namespace Microsoft.Extensions.ProjectModel.Resolution // A (in project.json) -> B (unresolved) (not in project.json) foreach (var source in GetRangesWithSourceLocations(library).Distinct()) { + // We only care about things requested in this project + if (!string.Equals(_projectPath, source.SourceFilePath)) + { + continue; + } + messages.Add( new DiagnosticMessage( errorCode, @@ -130,7 +147,7 @@ namespace Microsoft.Extensions.ProjectModel.Resolution } private IEnumerable GetRangesWithSourceLocations(LibraryDescription library) - { + { foreach (var range in library.RequestedRanges) { if (!string.IsNullOrEmpty(range.SourceFilePath))