Adding the configurer to dotnet.

This commit is contained in:
Livar Cunha 2016-06-06 15:41:14 -07:00
parent 461c26b78d
commit 4c5f097d67
6 changed files with 39 additions and 8 deletions

View file

@ -119,6 +119,8 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Configurer
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Configurer.UnitTests", "test\Microsoft.DotNet.Configurer.UnitTests\Microsoft.DotNet.Configurer.UnitTests.xproj", "{4C3B06D5-B6D5-4E5B-A44F-3EBE52A1C759}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Archive", "src\Microsoft.DotNet.Archive\Microsoft.DotNet.Archive.xproj", "{35B19F22-B8C0-4849-9C35-3F809B7588B8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -883,6 +885,22 @@ Global
{4C3B06D5-B6D5-4E5B-A44F-3EBE52A1C759}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
{4C3B06D5-B6D5-4E5B-A44F-3EBE52A1C759}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
{4C3B06D5-B6D5-4E5B-A44F-3EBE52A1C759}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
{35B19F22-B8C0-4849-9C35-3F809B7588B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{35B19F22-B8C0-4849-9C35-3F809B7588B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{35B19F22-B8C0-4849-9C35-3F809B7588B8}.Debug|x64.ActiveCfg = Debug|Any CPU
{35B19F22-B8C0-4849-9C35-3F809B7588B8}.Debug|x64.Build.0 = Debug|Any CPU
{35B19F22-B8C0-4849-9C35-3F809B7588B8}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
{35B19F22-B8C0-4849-9C35-3F809B7588B8}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
{35B19F22-B8C0-4849-9C35-3F809B7588B8}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
{35B19F22-B8C0-4849-9C35-3F809B7588B8}.MinSizeRel|x64.Build.0 = Debug|Any CPU
{35B19F22-B8C0-4849-9C35-3F809B7588B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{35B19F22-B8C0-4849-9C35-3F809B7588B8}.Release|Any CPU.Build.0 = Release|Any CPU
{35B19F22-B8C0-4849-9C35-3F809B7588B8}.Release|x64.ActiveCfg = Release|Any CPU
{35B19F22-B8C0-4849-9C35-3F809B7588B8}.Release|x64.Build.0 = Release|Any CPU
{35B19F22-B8C0-4849-9C35-3F809B7588B8}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
{35B19F22-B8C0-4849-9C35-3F809B7588B8}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
{35B19F22-B8C0-4849-9C35-3F809B7588B8}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
{35B19F22-B8C0-4849-9C35-3F809B7588B8}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -940,5 +958,6 @@ Global
{5DF6C9DA-6909-4EC0-909E-6913580BB4A4} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
{E5ED47EF-BF25-4DA9-A7FE-290C642CBF0F} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
{4C3B06D5-B6D5-4E5B-A44F-3EBE52A1C759} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
{35B19F22-B8C0-4849-9C35-3F809B7588B8} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
EndGlobalSection
EndGlobal

View file

@ -165,12 +165,14 @@ namespace Microsoft.DotNet.Cli.Utils
public ICommand CaptureStdErr()
{
throw new NotImplementedException();
_stdErr.Capture();
return this;
}
public ICommand CaptureStdOut()
{
throw new NotImplementedException();
_stdOut.Capture();
return this;
}
public ICommand EnvironmentVariable(string name, string value)

View file

@ -22,6 +22,7 @@ namespace Microsoft.DotNet.Configurer
{
if(ShouldPrimeNugetCache())
{
Reporter.Output.WriteLine("Configuring dotnet CLI for first time use.");
_nugetCachePrimer.PrimeCache();
}
}

View file

@ -63,13 +63,13 @@ namespace Microsoft.DotNet.Configurer
private bool CreateTemporaryProject(string workingDirectory)
{
return RunCommand("dotnet new", Enumerable.Empty<string>(), workingDirectory);
return RunCommand("new", Enumerable.Empty<string>(), workingDirectory);
}
private bool RestoreTemporaryProject(string pathToPackagesArchive, string workingDirectory)
{
return RunCommand(
"dotnet restore",
"restore",
new[] {NUGET_SOURCE_PARAMETER, $"{pathToPackagesArchive}"},
workingDirectory);
}

View file

@ -8,6 +8,7 @@ using System.Linq;
using System.Runtime.Loader;
using System.Text;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.Configurer;
using Microsoft.DotNet.InternalAbstractions;
using Microsoft.DotNet.ProjectModel.Server;
using Microsoft.DotNet.Tools.Build;
@ -56,6 +57,14 @@ namespace Microsoft.DotNet.Cli
{
using (PerfTrace.Current.CaptureTiming())
{
var nugetCacheSentinel = new NuGetCacheSentinel();
var nugetPackagesArchiver = new NuGetPackagesArchiver();
var commandFactory = new DotNetCommandFactory();
var nugetCachePrimer = new NuGetCachePrimer(commandFactory, nugetPackagesArchiver, nugetCacheSentinel);
var dotnetConfigurer = new DotnetFirstTimeUseConfigurer(nugetCachePrimer, nugetCacheSentinel);
dotnetConfigurer.Configure();
return ProcessArgs(args, new Telemetry());
}
}

View file

@ -58,14 +58,14 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_dotnetNewCommandMock = new Mock<ICommand>();
SetupCommandMock(_dotnetNewCommandMock);
commandFactoryMock
.Setup(c => c.Create("dotnet new", Enumerable.Empty<string>(), null, Constants.DefaultConfiguration))
.Setup(c => c.Create("new", Enumerable.Empty<string>(), null, Constants.DefaultConfiguration))
.Returns(_dotnetNewCommandMock.Object);
_dotnetRestoreCommandMock = new Mock<ICommand>();
SetupCommandMock(_dotnetRestoreCommandMock);
commandFactoryMock
.Setup(c => c.Create(
"dotnet restore",
"restore",
It.IsAny<IEnumerable<string>>(),
null,
Constants.DefaultConfiguration))
@ -118,7 +118,7 @@ namespace Microsoft.DotNet.Configurer.UnitTests
{
_commandFactoryMock.Verify(
c => c.Create(
"dotnet restore",
"restore",
new [] {"-s", $"{PACKAGES_ARCHIVE_PATH}"},
null,
Constants.DefaultConfiguration),
@ -141,7 +141,7 @@ namespace Microsoft.DotNet.Configurer.UnitTests
commandFactoryMock.Verify(
c => c.Create(
"dotnet restore",
"restore",
It.IsAny<IEnumerable<string>>(),
It.IsAny<NuGetFramework>(),
It.IsAny<string>()),