Fix dependency issues

- Normal behaviors things were being shown as warnings. Cousin dependencies
always get version bumped.
This commit is contained in:
David Fowler 2015-11-08 07:38:42 -08:00
parent 41516f5a37
commit 1470ab60d2
2 changed files with 20 additions and 3 deletions

View file

@ -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,

View file

@ -11,12 +11,15 @@ namespace Microsoft.Extensions.ProjectModel.Resolution
{
private readonly IList<LibraryDescription> _libraries;
private readonly IList<DiagnosticMessage> _diagnostics;
private readonly string _projectPath;
public LibraryManager(IList<LibraryDescription> libraries,
IList<DiagnosticMessage> diagnostics)
IList<DiagnosticMessage> diagnostics,
string projectPath)
{
_libraries = libraries;
_diagnostics = diagnostics;
_projectPath = projectPath;
}
public IList<LibraryDescription> 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<LibraryRange> GetRangesWithSourceLocations(LibraryDescription library)
{
{
foreach (var range in library.RequestedRanges)
{
if (!string.IsNullOrEmpty(range.SourceFilePath))