Merge pull request #2345 from dotnet/anurse/update-nuget

update nuget to 1160
This commit is contained in:
Eric Erhardt 2016-04-13 21:47:26 -05:00
commit 880dcf2fc8
14 changed files with 67 additions and 49 deletions

View file

@ -48,7 +48,7 @@ namespace Microsoft.DotNet.Cli.Build
return c.Success(); return c.Success();
} }
// Moving PrepareTargets.RestorePackages after PackagePkgProjects because managed code depends on the // Moving PrepareTargets.RestorePackages after PackagePkgProjects because managed code depends on the
// Microsoft.NETCore.App package that is created during PackagePkgProjects. // Microsoft.NETCore.App package that is created during PackagePkgProjects.
[Target(nameof(PrepareTargets.Init), nameof(CompileCoreHost), nameof(PackagePkgProjects), nameof(PrepareTargets.RestorePackages), nameof(CompileStage1), nameof(CompileStage2))] [Target(nameof(PrepareTargets.Init), nameof(CompileCoreHost), nameof(PackagePkgProjects), nameof(PrepareTargets.RestorePackages), nameof(CompileStage1), nameof(CompileStage2))]
public static BuildTargetResult Compile(BuildTargetContext c) public static BuildTargetResult Compile(BuildTargetContext c)
@ -230,7 +230,6 @@ namespace Microsoft.DotNet.Cli.Build
public static BuildTargetResult CompileStage1(BuildTargetContext c) public static BuildTargetResult CompileStage1(BuildTargetContext c)
{ {
CleanBinObj(c, Path.Combine(c.BuildContext.BuildDirectory, "src")); CleanBinObj(c, Path.Combine(c.BuildContext.BuildDirectory, "src"));
CleanBinObj(c, Path.Combine(c.BuildContext.BuildDirectory, "test"));
if (Directory.Exists(Dirs.Stage1)) if (Directory.Exists(Dirs.Stage1))
{ {
@ -258,7 +257,6 @@ namespace Microsoft.DotNet.Cli.Build
var configuration = c.BuildContext.Get<string>("Configuration"); var configuration = c.BuildContext.Get<string>("Configuration");
CleanBinObj(c, Path.Combine(c.BuildContext.BuildDirectory, "src")); CleanBinObj(c, Path.Combine(c.BuildContext.BuildDirectory, "src"));
CleanBinObj(c, Path.Combine(c.BuildContext.BuildDirectory, "test"));
if (Directory.Exists(Dirs.Stage2)) if (Directory.Exists(Dirs.Stage2))
{ {
@ -565,7 +563,7 @@ namespace Microsoft.DotNet.Cli.Build
// in CompileTargets and the one in the shared library project.json match and are updated in lock step, but long term // in CompileTargets and the one in the shared library project.json match and are updated in lock step, but long term
// we need to be able to look at the project.lock.json file and figure out what version of Microsoft.NETCore.Runtime.CoreCLR // we need to be able to look at the project.lock.json file and figure out what version of Microsoft.NETCore.Runtime.CoreCLR
// was used, and then select that version. // was used, and then select that version.
ExecSilent(Crossgen.GetCrossgenPathForVersion(CompileTargets.CoreCLRVersion), ExecSilent(Crossgen.GetCrossgenPathForVersion(CoreCLRVersion),
"-readytorun", "-in", file, "-out", tempPathName, "-platform_assemblies_paths", pathToAssemblies); "-readytorun", "-in", file, "-out", tempPathName, "-platform_assemblies_paths", pathToAssemblies);
File.Delete(file); File.Delete(file);

View file

@ -228,7 +228,7 @@ namespace Microsoft.DotNet.Cli.Build
{ {
var dotnet = DotNetCli.Stage0; var dotnet = DotNetCli.Stage0;
dotnet.Restore("--verbosity", "verbose", "--disable-parallel", "--infer-runtimes", "--fallbacksource", Dirs.Corehost) dotnet.Restore("--verbosity", "verbose", "--disable-parallel", "--fallbacksource", Dirs.Corehost)
.WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "src")) .WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "src"))
.Execute() .Execute()
.EnsureSuccessful(); .EnsureSuccessful();

View file

@ -9,7 +9,7 @@
"Microsoft.CSharp": "4.0.1-rc2-24008", "Microsoft.CSharp": "4.0.1-rc2-24008",
"System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008",
"Microsoft.DotNet.Cli.Build.Framework": "1.0.0-*", "Microsoft.DotNet.Cli.Build.Framework": "1.0.0-*",
"NuGet.Versioning": "3.5.0-beta-1130", "NuGet.Versioning": "3.5.0-beta-1160",
"Newtonsoft.Json": "7.0.1", "Newtonsoft.Json": "7.0.1",
"Octokit": "0.18.0", "Octokit": "0.18.0",
"Microsoft.Net.Http": "2.2.29" "Microsoft.Net.Http": "2.2.29"

View file

@ -19,7 +19,7 @@ namespace Microsoft.DotNet.Cli.Utils
{ {
public class ProjectToolsCommandResolver : ICommandResolver public class ProjectToolsCommandResolver : ICommandResolver
{ {
private static readonly NuGetFramework s_toolPackageFramework = FrameworkConstants.CommonFrameworks.NetStandardApp15; private static readonly NuGetFramework s_toolPackageFramework = FrameworkConstants.CommonFrameworks.NetCoreApp10;
private static readonly CommandResolutionStrategy s_commandResolutionStrategy = private static readonly CommandResolutionStrategy s_commandResolutionStrategy =
CommandResolutionStrategy.ProjectToolsPackage; CommandResolutionStrategy.ProjectToolsPackage;

View file

@ -7,10 +7,10 @@
"dependencies": { "dependencies": {
"Microsoft.DotNet.ProjectModel": "1.0.0-*", "Microsoft.DotNet.ProjectModel": "1.0.0-*",
"Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc2-20459", "Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc2-20459",
"NuGet.Versioning": "3.5.0-beta-1130", "NuGet.Versioning": "3.5.0-beta-1160",
"NuGet.Packaging": "3.5.0-beta-1130", "NuGet.Packaging": "3.5.0-beta-1160",
"NuGet.Frameworks": "3.5.0-beta-1130", "NuGet.Frameworks": "3.5.0-beta-1160",
"NuGet.ProjectModel": "3.5.0-beta-1130" "NuGet.ProjectModel": "3.5.0-beta-1160"
}, },
"frameworks": { "frameworks": {
"net451": { "net451": {

View file

@ -16,8 +16,8 @@
"version": "1.0.0-rc2-20221" "version": "1.0.0-rc2-20221"
}, },
"Newtonsoft.Json": "7.0.1", "Newtonsoft.Json": "7.0.1",
"NuGet.Packaging": "3.5.0-beta-1130", "NuGet.Packaging": "3.5.0-beta-1160",
"NuGet.RuntimeModel": "3.5.0-beta-1130", "NuGet.RuntimeModel": "3.5.0-beta-1160",
"System.Reflection.Metadata": "1.3.0-rc2-24008" "System.Reflection.Metadata": "1.3.0-rc2-24008"
}, },
"frameworks": { "frameworks": {

View file

@ -12,6 +12,7 @@ using Microsoft.DotNet.ProjectModel;
using Microsoft.DotNet.ProjectModel.Utilities; using Microsoft.DotNet.ProjectModel.Utilities;
using Microsoft.DotNet.Tools.Compiler; using Microsoft.DotNet.Tools.Compiler;
using Microsoft.Extensions.PlatformAbstractions; using Microsoft.Extensions.PlatformAbstractions;
using Microsoft.DotNet.ProjectModel.Compilation;
namespace Microsoft.DotNet.Tools.Build namespace Microsoft.DotNet.Tools.Build
{ {
@ -79,7 +80,7 @@ namespace Microsoft.DotNet.Tools.Build
return true; return true;
} }
foreach (var dependency in Sort(_rootProjectDependencies.ProjectDependenciesWithSources)) foreach (var dependency in Sort(_rootProjectDependencies))
{ {
var dependencyProjectContext = ProjectContext.Create(dependency.Path, dependency.Framework, new[] { _rootProject.RuntimeIdentifier }); var dependencyProjectContext = ProjectContext.Create(dependency.Path, dependency.Framework, new[] { _rootProject.RuntimeIdentifier });
@ -514,31 +515,40 @@ namespace Microsoft.DotNet.Tools.Build
executable.MakeCompilationOutputRunnable(); executable.MakeCompilationOutputRunnable();
} }
private static ISet<ProjectDescription> Sort(Dictionary<string, ProjectDescription> projects) private static IEnumerable<ProjectDescription> Sort(ProjectDependenciesFacade dependencies)
{ {
var outputs = new HashSet<ProjectDescription>(); var outputs = new List<ProjectDescription>();
foreach (var pair in projects) foreach (var pair in dependencies.Dependencies)
{ {
Sort(pair.Value, projects, outputs); Sort(pair.Value, dependencies, outputs);
} }
return outputs; return outputs.Distinct(new ProjectComparer());
} }
private static void Sort(ProjectDescription project, Dictionary<string, ProjectDescription> projects, ISet<ProjectDescription> outputs) private static void Sort(LibraryExport node, ProjectDependenciesFacade dependencies, IList<ProjectDescription> outputs)
{ {
// Sorts projects in dependency order so that we only build them once per chain // Sorts projects in dependency order so that we only build them once per chain
foreach (var dependency in project.Dependencies) ProjectDescription projectDependency;
foreach (var dependency in node.Library.Dependencies)
{ {
ProjectDescription projectDependency; // Sort the children
if (projects.TryGetValue(dependency.Name, out projectDependency)) Sort(dependencies.Dependencies[dependency.Name], dependencies, outputs);
{
Sort(projectDependency, projects, outputs);
}
} }
outputs.Add(project); // Add this node to the list if it is a project
if (dependencies.ProjectDependenciesWithSources.TryGetValue(node.Library.Identity.Name, out projectDependency))
{
// Add to the list of projects to build
outputs.Add(projectDependency);
}
}
private class ProjectComparer : IEqualityComparer<ProjectDescription>
{
public bool Equals(ProjectDescription x, ProjectDescription y) => string.Equals(x.Identity.Name, y.Identity.Name, StringComparison.Ordinal);
public int GetHashCode(ProjectDescription obj) => obj.Identity.Name.GetHashCode();
} }
public struct CompilerIO public struct CompilerIO

View file

@ -14,7 +14,7 @@ namespace Microsoft.DotNet.Tools.Build
{ {
// projectName -> ProjectDescription // projectName -> ProjectDescription
public Dictionary<string, ProjectDescription> ProjectDependenciesWithSources { get; } public Dictionary<string, ProjectDescription> ProjectDependenciesWithSources { get; }
public List<LibraryExport> Dependencies { get; } public Dictionary<string, LibraryExport> Dependencies { get; }
public ProjectDependenciesFacade(ProjectContext rootProject, string configValue) public ProjectDependenciesFacade(ProjectContext rootProject, string configValue)
{ {
@ -25,7 +25,7 @@ namespace Microsoft.DotNet.Tools.Build
// Build project references // Build project references
foreach (var dependency in Dependencies) foreach (var dependency in Dependencies)
{ {
var projectDependency = dependency.Library as ProjectDescription; var projectDependency = dependency.Value.Library as ProjectDescription;
if (projectDependency != null && projectDependency.Resolved && projectDependency.Project.Files.SourceFiles.Any()) if (projectDependency != null && projectDependency.Resolved && projectDependency.Project.Files.SourceFiles.Any())
{ {
@ -35,7 +35,7 @@ namespace Microsoft.DotNet.Tools.Build
} }
// todo make extension of ProjectContext? // todo make extension of ProjectContext?
private static List<LibraryExport> GetProjectDependencies(ProjectContext projectContext, string configuration) private static Dictionary<string, LibraryExport> GetProjectDependencies(ProjectContext projectContext, string configuration)
{ {
// Create the library exporter // Create the library exporter
var exporter = projectContext.CreateExporter(configuration); var exporter = projectContext.CreateExporter(configuration);
@ -43,7 +43,7 @@ namespace Microsoft.DotNet.Tools.Build
// Gather exports for the project // Gather exports for the project
var dependencies = exporter.GetDependencies().ToList(); var dependencies = exporter.GetDependencies().ToList();
return dependencies; return dependencies.ToDictionary(d => d.Library.Identity.Name);
} }
} }

View file

@ -17,10 +17,10 @@
], ],
"dependencies": { "dependencies": {
"NuGet.Commands": { "NuGet.Commands": {
"version": "3.5.0-beta-1130", "version": "3.5.0-beta-1160",
"exclude": "compile" "exclude": "compile"
}, },
"NuGet.CommandLine.XPlat": "3.5.0-beta-1130", "NuGet.CommandLine.XPlat": "3.5.0-beta-1160",
"Newtonsoft.Json": "7.0.1", "Newtonsoft.Json": "7.0.1",
"System.Text.Encoding.CodePages": "4.0.1-rc2-24008", "System.Text.Encoding.CodePages": "4.0.1-rc2-24008",
"System.Diagnostics.FileVersionInfo": "4.0.0-rc2-24008", "System.Diagnostics.FileVersionInfo": "4.0.0-rc2-24008",
@ -55,13 +55,13 @@
} }
}, },
"frameworks": { "frameworks": {
"netstandard1.5": { "netcoreapp1.0": {
"imports": [ "imports": [
"dnxcore50", "dnxcore50",
"netstandardapp1.5", "netstandardapp1.5",
"portable-net45+win8", "portable-net45+win8",
"portable-net45+wp80+win8+wpa81+dnxcore50" "portable-net45+wp80+win8+wpa81+dnxcore50"
] ]
} }
} }
} }

View file

@ -28,7 +28,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
{ {
public class GivenAProjectToolsCommandResolver public class GivenAProjectToolsCommandResolver
{ {
private static readonly NuGetFramework s_toolPackageFramework = FrameworkConstants.CommonFrameworks.NetStandardApp15; private static readonly NuGetFramework s_toolPackageFramework = FrameworkConstants.CommonFrameworks.NetCoreApp10;
private static readonly string s_liveProjectDirectory = private static readonly string s_liveProjectDirectory =
Path.Combine(AppContext.BaseDirectory, "TestAssets/TestProjects/AppWithToolDependency"); Path.Combine(AppContext.BaseDirectory, "TestAssets/TestProjects/AppWithToolDependency");

View file

@ -10,10 +10,10 @@
}, },
"System.Diagnostics.TraceSource": "4.0.0-rc2-24008", "System.Diagnostics.TraceSource": "4.0.0-rc2-24008",
"System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008",
"NuGet.Versioning": "3.5.0-beta-1130", "NuGet.Versioning": "3.5.0-beta-1160",
"NuGet.Packaging": "3.5.0-beta-1130", "NuGet.Packaging": "3.5.0-beta-1160",
"NuGet.Frameworks": "3.5.0-beta-1130", "NuGet.Frameworks": "3.5.0-beta-1160",
"NuGet.ProjectModel": "3.5.0-beta-1130", "NuGet.ProjectModel": "3.5.0-beta-1160",
"Microsoft.DotNet.ProjectModel": { "Microsoft.DotNet.ProjectModel": {
"target": "project" "target": "project"
}, },

View file

@ -21,7 +21,7 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
{ {
var testAssetManager = new TestAssetsManager(Path.Combine(RepoRoot, "TestAssets")); var testAssetManager = new TestAssetsManager(Path.Combine(RepoRoot, "TestAssets"));
var testInstance = var testInstance =
testAssetManager.CreateTestInstance("ProjectWithTests", identifier: "ConsoleTests").WithLockFiles(); testAssetManager.CreateTestInstance("ProjectWithTests", identifier: "ConsoleTests");
_projectFilePath = Path.Combine(testInstance.TestRoot, "project.json"); _projectFilePath = Path.Combine(testInstance.TestRoot, "project.json");
var contexts = ProjectContext.CreateContextForEachFramework( var contexts = ProjectContext.CreateContextForEachFramework(
@ -29,6 +29,11 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
null, null,
PlatformServices.Default.Runtime.GetAllCandidateRuntimeIdentifiers()); PlatformServices.Default.Runtime.GetAllCandidateRuntimeIdentifiers());
// Restore the project again in the destination to resolve projects
// Since the lock file has project relative paths in it, those will be broken
// unless we re-restore
new RestoreCommand() { WorkingDirectory = testInstance.TestRoot }.Execute().Should().Pass();
_defaultOutputPath = Path.Combine(testInstance.TestRoot, "bin", "Debug", "netcoreapp1.0"); _defaultOutputPath = Path.Combine(testInstance.TestRoot, "bin", "Debug", "netcoreapp1.0");
} }

View file

@ -20,7 +20,7 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
public GivenThatWeWantToUseDotnetTestE2EInDesignTime() public GivenThatWeWantToUseDotnetTestE2EInDesignTime()
{ {
var testAssetManager = new TestAssetsManager(Path.Combine(RepoRoot, "TestAssets")); var testAssetManager = new TestAssetsManager(Path.Combine(RepoRoot, "TestAssets"));
var testInstance = testAssetManager.CreateTestInstance("ProjectWithTests").WithLockFiles(); var testInstance = testAssetManager.CreateTestInstance("ProjectWithTests");
_projectFilePath = Path.Combine(testInstance.TestRoot, "project.json"); _projectFilePath = Path.Combine(testInstance.TestRoot, "project.json");
var contexts = ProjectContext.CreateContextForEachFramework( var contexts = ProjectContext.CreateContextForEachFramework(
@ -28,6 +28,11 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
null, null,
PlatformServices.Default.Runtime.GetAllCandidateRuntimeIdentifiers()); PlatformServices.Default.Runtime.GetAllCandidateRuntimeIdentifiers());
// Restore the project again in the destination to resolve projects
// Since the lock file has project relative paths in it, those will be broken
// unless we re-restore
new RestoreCommand() { WorkingDirectory = testInstance.TestRoot }.Execute().Should().Pass();
_outputPath = Path.Combine(testInstance.TestRoot, "bin", "Debug", "netcoreapp1.0"); _outputPath = Path.Combine(testInstance.TestRoot, "bin", "Debug", "netcoreapp1.0");
var buildCommand = new BuildCommand(_projectFilePath); var buildCommand = new BuildCommand(_projectFilePath);
var result = buildCommand.Execute(); var result = buildCommand.Execute();

View file

@ -4,8 +4,8 @@
"emitEntryPoint": true "emitEntryPoint": true
}, },
"dependencies": { "dependencies": {
"NuGet.RuntimeModel": "3.5.0-beta-1130", "NuGet.RuntimeModel": "3.5.0-beta-1160",
"NuGet.Versioning": "3.5.0-beta-1130", "NuGet.Versioning": "3.5.0-beta-1160",
"System.CommandLine": "0.1.0-e160119-1", "System.CommandLine": "0.1.0-e160119-1",
"System.Runtime.Serialization.Json": "4.0.2-rc2-24008", "System.Runtime.Serialization.Json": "4.0.2-rc2-24008",
"Microsoft.DotNet.ProjectModel": "1.0.0-*", "Microsoft.DotNet.ProjectModel": "1.0.0-*",