Fixed erroneous warning about mismatched dependencies

- Fixed lock files parsing issues
- Did some cleanup as well
This commit is contained in:
David Fowler 2015-10-17 07:20:56 -07:00
parent 357242f7b6
commit 58de7c4793
6 changed files with 13 additions and 40 deletions

View file

@ -88,7 +88,6 @@ namespace Microsoft.Extensions.ProjectModel.Graph
{
return range.MinVersion.ToString();
}
var sb = new StringBuilder();
sb.Append(">= ");
switch (range?.Float?.FloatBehavior)
@ -98,22 +97,19 @@ namespace Microsoft.Extensions.ProjectModel.Graph
sb.Append(range.MinVersion);
break;
case NuGetVersionFloatBehavior.Prerelease:
sb.AppendFormat("{0}-*", range.MinVersion);
// 1.0.*
// Work around nuget bug: https://github.com/NuGet/Home/issues/1598
// sb.AppendFormat("{0}-*", range.MinVersion);
sb.Append($"{range.MinVersion.Version.Major}.{range.MinVersion.Version.Minor}.{range.MinVersion.Version.Build}-*");
break;
case NuGetVersionFloatBehavior.Revision:
sb.AppendFormat("{0}.{1}.{2}.*",
range.MinVersion.Version.Major,
range.MinVersion.Version.Minor,
range.MinVersion.Version.Build);
sb.Append($"{range.MinVersion.Version.Major}.{range.MinVersion.Version.Minor}.{range.MinVersion.Version.Build}.*");
break;
case NuGetVersionFloatBehavior.Patch:
sb.AppendFormat("{0}.{1}.*",
range.MinVersion.Version.Major,
range.MinVersion.Version.Minor);
sb.Append($"{range.MinVersion.Version.Major}.{range.MinVersion.Version.Minor}.*");
break;
case NuGetVersionFloatBehavior.Minor:
sb.AppendFormat("{0}.{1}.*",
range.MinVersion.Version.Major);
sb.AppendFormat($"{range.MinVersion.Version.Major}.*");
break;
case NuGetVersionFloatBehavior.Major:
sb.AppendFormat("*");

View file

@ -173,7 +173,7 @@ namespace Microsoft.Extensions.ProjectModel.Graph
private static ProjectFileDependencyGroup ReadProjectFileDependencyGroup(string property, JsonValue json)
{
return new ProjectFileDependencyGroup(
NuGetFramework.Parse(property),
string.IsNullOrEmpty(property) ? null : NuGetFramework.Parse(property),
ReadArray(json, ReadString));
}

View file

@ -5,9 +5,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Versioning;
using Microsoft.Extensions.ProjectModel.Compilation;
using Microsoft.Extensions.ProjectModel.Graph;
using Microsoft.Extensions.ProjectModel.Resolution;
using NuGet.Frameworks;
@ -16,7 +14,6 @@ namespace Microsoft.Extensions.ProjectModel
// NOTE(anurse): Copied from ApplicationHostContext in DNX. This name seemed more appropriate for this :)
public class ProjectContext
{
public GlobalSettings GlobalSettings { get; }
public ProjectDescription RootProject { get; }
@ -33,8 +30,6 @@ namespace Microsoft.Extensions.ProjectModel
public string PackagesDirectory { get; }
public FrameworkReferenceResolver FrameworkResolver { get; }
public LibraryManager LibraryManager { get; }
internal ProjectContext(
@ -43,7 +38,6 @@ namespace Microsoft.Extensions.ProjectModel
NuGetFramework targetFramework,
string runtimeIdentifier,
string packagesDirectory,
FrameworkReferenceResolver frameworkResolver,
LibraryManager libraryManager)
{
GlobalSettings = globalSettings;
@ -51,7 +45,6 @@ namespace Microsoft.Extensions.ProjectModel
TargetFramework = targetFramework;
RuntimeIdentifier = runtimeIdentifier;
PackagesDirectory = packagesDirectory;
FrameworkResolver = frameworkResolver;
LibraryManager = libraryManager;
}

View file

@ -100,7 +100,6 @@ namespace Microsoft.Extensions.ProjectModel
TargetFramework,
target?.RuntimeIdentifier,
PackagesDirectory,
frameworkReferenceResolver,
libraryManager);
}

View file

@ -54,7 +54,7 @@ namespace Microsoft.Extensions.ProjectModel
{
try
{
var buildVersion = Environment.GetEnvironmentVariable("DNX_BUILD_VERSION");
var buildVersion = Environment.GetEnvironmentVariable("DOETNET_BUILD_VERSION");
project.Version = SpecifySnapshot(version, buildVersion);
}
catch (Exception ex)
@ -63,7 +63,7 @@ namespace Microsoft.Extensions.ProjectModel
}
}
var fileVersion = Environment.GetEnvironmentVariable("DNX_ASSEMBLY_FILE_VERSION");
var fileVersion = Environment.GetEnvironmentVariable("DOTNET_ASSEMBLY_FILE_VERSION");
if (string.IsNullOrWhiteSpace(fileVersion))
{
project.AssemblyFileVersion = project.Version.Version;
@ -94,9 +94,9 @@ namespace Microsoft.Extensions.ProjectModel
project.LicenseUrl = rawProject.ValueAsString("licenseUrl");
project.IconUrl = rawProject.ValueAsString("iconUrl");
project.Authors = rawProject.ValueAsStringArray("authors") ?? new string[] { };
project.Owners = rawProject.ValueAsStringArray("owners") ?? new string[] { };
project.Tags = rawProject.ValueAsStringArray("tags") ?? new string[] { };
project.Authors = rawProject.ValueAsStringArray("authors") ?? Array.Empty<string>();
project.Owners = rawProject.ValueAsStringArray("owners") ?? Array.Empty<string>();
project.Tags = rawProject.ValueAsStringArray("tags") ?? Array.Empty<string>();
project.Language = rawProject.ValueAsString("language");
project.ReleaseNotes = rawProject.ValueAsString("releaseNotes");

View file

@ -2,9 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using Microsoft.Extensions.ProjectModel.Graph;
using Microsoft.Extensions.ProjectModel.Utilities;
using NuGet.Packaging;
using NuGet.Versioning;
@ -102,18 +100,5 @@ namespace Microsoft.Extensions.ProjectModel.Resolution
// TODO(anurse): This should migrate to the NuGet packages directory
return Path.Combine(profileDirectory, ".dnx", "packages");
}
private static IEnumerable<VersionFolderPathResolver> GetCacheResolvers()
{
var packageCachePathValue = Environment.GetEnvironmentVariable(EnvironmentNames.PackagesCache);
if (string.IsNullOrEmpty(packageCachePathValue))
{
return Enumerable.Empty<VersionFolderPathResolver>();
}
return packageCachePathValue.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries)
.Select(path => new VersionFolderPathResolver(path));
}
}
}