Introducing a Config object as a input to the FirstRunConfigurer. This allows us to decide what operations we want to
do as part of first run based on whether this is the invoke-reportsuccess from a native installer or a regular command being invoked for the first time. This in turn allows us to ignore the skip first run variable on native installers and expand the cache always in those cases.
This commit is contained in:
parent
da7da0b018
commit
b7a8c6d12f
4 changed files with 161 additions and 74 deletions
|
@ -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,28 @@ namespace Microsoft.DotNet.Cli
|
|||
firstTimeUseNoticeSentinel = new NoOpFirstTimeUseNoticeSentinel();
|
||||
toolPathSentinel = new NoOpFileSentinel();
|
||||
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 = generateAspNetCertificate,
|
||||
PrintTelemetryMessage = printTelemetryMessage,
|
||||
SkipFirstRunExperience = skipFirstRunExperience
|
||||
};
|
||||
|
||||
ConfigureDotNetForFirstTimeUse(
|
||||
nugetCacheSentinel,
|
||||
firstTimeUseNoticeSentinel,
|
||||
aspNetCertificateSentinel,
|
||||
toolPathSentinel,
|
||||
cliFallbackFolderPathCalculator,
|
||||
hasSuperUserAccess);
|
||||
hasSuperUserAccess,
|
||||
dotnetFirstRunConfiguration,
|
||||
environmentProvider);
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -222,15 +244,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 +268,7 @@ namespace Microsoft.DotNet.Cli
|
|||
aspNetCertificateSentinel,
|
||||
aspnetCertificateGenerator,
|
||||
toolPathSentinel,
|
||||
environmentProvider,
|
||||
dotnetFirstRunConfiguration,
|
||||
Reporter.Output,
|
||||
cliFolderPathCalculator.CliFallbackFolderPath,
|
||||
environmentPath);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue