Merge pull request #9265 from livarcocc/first_run_native_intallers

Always execute cache expansion on native installers.
This commit is contained in:
Livar 2018-05-22 13:17:55 -07:00 committed by GitHub
commit 8f8770be8a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 187 additions and 79 deletions

View file

@ -141,6 +141,15 @@ namespace Microsoft.DotNet.Cli
command = "help";
}
var environmentProvider = new EnvironmentProvider();
bool generateAspNetCertificate =
environmentProvider.GetEnvironmentVariableAsBool("DOTNET_GENERATE_ASPNET_CERTIFICATE", true);
bool printTelemetryMessage =
environmentProvider.GetEnvironmentVariableAsBool("DOTNET_PRINT_TELEMETRY_MESSAGE", true);
bool skipFirstRunExperience =
environmentProvider.GetEnvironmentVariableAsBool("DOTNET_SKIP_FIRST_TIME_EXPERIENCE", false);
topLevelCommandParserResult = new TopLevelCommandParserResult(command);
var hasSuperUserAccess = false;
if (IsDotnetBeingInvokedFromNativeInstaller(topLevelCommandParserResult))
@ -149,15 +158,26 @@ namespace Microsoft.DotNet.Cli
firstTimeUseNoticeSentinel = new NoOpFirstTimeUseNoticeSentinel();
toolPathSentinel = new NoOpFileSentinel(exists: false);
hasSuperUserAccess = true;
// When running through a native installer, we want the cache expansion to happen, so
// we need to override this.
skipFirstRunExperience = false;
}
var dotnetFirstRunConfiguration = new DotnetFirstRunConfiguration(
generateAspNetCertificate,
printTelemetryMessage,
skipFirstRunExperience);
ConfigureDotNetForFirstTimeUse(
nugetCacheSentinel,
firstTimeUseNoticeSentinel,
aspNetCertificateSentinel,
toolPathSentinel,
cliFallbackFolderPathCalculator,
hasSuperUserAccess);
hasSuperUserAccess,
dotnetFirstRunConfiguration,
environmentProvider);
break;
}
@ -222,15 +242,17 @@ namespace Microsoft.DotNet.Cli
IAspNetCertificateSentinel aspNetCertificateSentinel,
IFileSentinel toolPathSentinel,
CliFolderPathCalculator cliFolderPathCalculator,
bool hasSuperUserAccess)
bool hasSuperUserAccess,
DotnetFirstRunConfiguration dotnetFirstRunConfiguration,
IEnvironmentProvider environmentProvider)
{
var environmentProvider = new EnvironmentProvider();
using (PerfTrace.Current.CaptureTiming())
{
var nugetPackagesArchiver = new NuGetPackagesArchiver();
var environmentPath =
EnvironmentPathFactory.CreateEnvironmentPath(cliFolderPathCalculator, hasSuperUserAccess, environmentProvider);
var environmentPath = EnvironmentPathFactory.CreateEnvironmentPath(
cliFolderPathCalculator,
hasSuperUserAccess,
environmentProvider);
var commandFactory = new DotNetCommandFactory(alwaysRunOutOfProc: true);
var nugetCachePrimer = new NuGetCachePrimer(
nugetPackagesArchiver,
@ -244,7 +266,7 @@ namespace Microsoft.DotNet.Cli
aspNetCertificateSentinel,
aspnetCertificateGenerator,
toolPathSentinel,
environmentProvider,
dotnetFirstRunConfiguration,
Reporter.Output,
cliFolderPathCalculator.CliFallbackFolderPath,
environmentPath);