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(); return range.MinVersion.ToString();
} }
var sb = new StringBuilder(); var sb = new StringBuilder();
sb.Append(">= "); sb.Append(">= ");
switch (range?.Float?.FloatBehavior) switch (range?.Float?.FloatBehavior)
@ -98,22 +97,19 @@ namespace Microsoft.Extensions.ProjectModel.Graph
sb.Append(range.MinVersion); sb.Append(range.MinVersion);
break; break;
case NuGetVersionFloatBehavior.Prerelease: 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; break;
case NuGetVersionFloatBehavior.Revision: case NuGetVersionFloatBehavior.Revision:
sb.AppendFormat("{0}.{1}.{2}.*", sb.Append($"{range.MinVersion.Version.Major}.{range.MinVersion.Version.Minor}.{range.MinVersion.Version.Build}.*");
range.MinVersion.Version.Major,
range.MinVersion.Version.Minor,
range.MinVersion.Version.Build);
break; break;
case NuGetVersionFloatBehavior.Patch: case NuGetVersionFloatBehavior.Patch:
sb.AppendFormat("{0}.{1}.*", sb.Append($"{range.MinVersion.Version.Major}.{range.MinVersion.Version.Minor}.*");
range.MinVersion.Version.Major,
range.MinVersion.Version.Minor);
break; break;
case NuGetVersionFloatBehavior.Minor: case NuGetVersionFloatBehavior.Minor:
sb.AppendFormat("{0}.{1}.*", sb.AppendFormat($"{range.MinVersion.Version.Major}.*");
range.MinVersion.Version.Major);
break; break;
case NuGetVersionFloatBehavior.Major: case NuGetVersionFloatBehavior.Major:
sb.AppendFormat("*"); sb.AppendFormat("*");

View file

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

View file

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

View file

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

View file

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

View file

@ -2,9 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reflection;
using Microsoft.Extensions.ProjectModel.Graph; using Microsoft.Extensions.ProjectModel.Graph;
using Microsoft.Extensions.ProjectModel.Utilities;
using NuGet.Packaging; using NuGet.Packaging;
using NuGet.Versioning; using NuGet.Versioning;
@ -102,18 +100,5 @@ namespace Microsoft.Extensions.ProjectModel.Resolution
// TODO(anurse): This should migrate to the NuGet packages directory // TODO(anurse): This should migrate to the NuGet packages directory
return Path.Combine(profileDirectory, ".dnx", "packages"); 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));
}
} }
} }