Merge pull request #9265 from livarcocc/first_run_native_intallers
Always execute cache expansion on native installers.
This commit is contained in:
commit
8f8770be8a
5 changed files with 187 additions and 79 deletions
|
@ -0,0 +1,24 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Configurer
|
||||||
|
{
|
||||||
|
public class DotnetFirstRunConfiguration
|
||||||
|
{
|
||||||
|
public bool GenerateAspNetCertificate { get; }
|
||||||
|
|
||||||
|
public bool PrintTelemetryMessage { get; }
|
||||||
|
|
||||||
|
public bool SkipFirstRunExperience { get; }
|
||||||
|
|
||||||
|
public DotnetFirstRunConfiguration(
|
||||||
|
bool generateAspNetCertificate,
|
||||||
|
bool printTelemetryMessage,
|
||||||
|
bool skipFirstRunExperience)
|
||||||
|
{
|
||||||
|
GenerateAspNetCertificate = generateAspNetCertificate;
|
||||||
|
PrintTelemetryMessage = printTelemetryMessage;
|
||||||
|
SkipFirstRunExperience = skipFirstRunExperience;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -12,7 +12,7 @@ namespace Microsoft.DotNet.Configurer
|
||||||
public class DotnetFirstTimeUseConfigurer
|
public class DotnetFirstTimeUseConfigurer
|
||||||
{
|
{
|
||||||
private IReporter _reporter;
|
private IReporter _reporter;
|
||||||
private IEnvironmentProvider _environmentProvider;
|
private DotnetFirstRunConfiguration _dotnetFirstRunConfiguration;
|
||||||
private INuGetCachePrimer _nugetCachePrimer;
|
private INuGetCachePrimer _nugetCachePrimer;
|
||||||
private INuGetCacheSentinel _nugetCacheSentinel;
|
private INuGetCacheSentinel _nugetCacheSentinel;
|
||||||
private IFirstTimeUseNoticeSentinel _firstTimeUseNoticeSentinel;
|
private IFirstTimeUseNoticeSentinel _firstTimeUseNoticeSentinel;
|
||||||
|
@ -29,7 +29,7 @@ namespace Microsoft.DotNet.Configurer
|
||||||
IAspNetCertificateSentinel aspNetCertificateSentinel,
|
IAspNetCertificateSentinel aspNetCertificateSentinel,
|
||||||
IAspNetCoreCertificateGenerator aspNetCoreCertificateGenerator,
|
IAspNetCoreCertificateGenerator aspNetCoreCertificateGenerator,
|
||||||
IFileSentinel toolPathSentinel,
|
IFileSentinel toolPathSentinel,
|
||||||
IEnvironmentProvider environmentProvider,
|
DotnetFirstRunConfiguration dotnetFirstRunConfiguration,
|
||||||
IReporter reporter,
|
IReporter reporter,
|
||||||
string cliFallbackFolderPath,
|
string cliFallbackFolderPath,
|
||||||
IEnvironmentPath pathAdder)
|
IEnvironmentPath pathAdder)
|
||||||
|
@ -40,7 +40,7 @@ namespace Microsoft.DotNet.Configurer
|
||||||
_aspNetCertificateSentinel = aspNetCertificateSentinel;
|
_aspNetCertificateSentinel = aspNetCertificateSentinel;
|
||||||
_aspNetCoreCertificateGenerator = aspNetCoreCertificateGenerator;
|
_aspNetCoreCertificateGenerator = aspNetCoreCertificateGenerator;
|
||||||
_toolPathSentinel = toolPathSentinel;
|
_toolPathSentinel = toolPathSentinel;
|
||||||
_environmentProvider = environmentProvider;
|
_dotnetFirstRunConfiguration = dotnetFirstRunConfiguration;
|
||||||
_reporter = reporter;
|
_reporter = reporter;
|
||||||
_cliFallbackFolderPath = cliFallbackFolderPath;
|
_cliFallbackFolderPath = cliFallbackFolderPath;
|
||||||
_pathAdder = pathAdder ?? throw new ArgumentNullException(nameof(pathAdder));
|
_pathAdder = pathAdder ?? throw new ArgumentNullException(nameof(pathAdder));
|
||||||
|
@ -93,11 +93,8 @@ namespace Microsoft.DotNet.Configurer
|
||||||
#if EXCLUDE_ASPNETCORE
|
#if EXCLUDE_ASPNETCORE
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
var generateAspNetCertificate =
|
|
||||||
_environmentProvider.GetEnvironmentVariableAsBool("DOTNET_GENERATE_ASPNET_CERTIFICATE", true);
|
|
||||||
|
|
||||||
return ShouldRunFirstRunExperience() &&
|
return ShouldRunFirstRunExperience() &&
|
||||||
generateAspNetCertificate &&
|
_dotnetFirstRunConfiguration.GenerateAspNetCertificate &&
|
||||||
!_aspNetCertificateSentinel.Exists();
|
!_aspNetCertificateSentinel.Exists();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -116,11 +113,8 @@ namespace Microsoft.DotNet.Configurer
|
||||||
|
|
||||||
private bool ShouldPrintFirstTimeUseNotice()
|
private bool ShouldPrintFirstTimeUseNotice()
|
||||||
{
|
{
|
||||||
var showFirstTimeUseNotice =
|
|
||||||
_environmentProvider.GetEnvironmentVariableAsBool("DOTNET_PRINT_TELEMETRY_MESSAGE", true);
|
|
||||||
|
|
||||||
return ShouldRunFirstRunExperience() &&
|
return ShouldRunFirstRunExperience() &&
|
||||||
showFirstTimeUseNotice &&
|
_dotnetFirstRunConfiguration.PrintTelemetryMessage &&
|
||||||
!_firstTimeUseNoticeSentinel.Exists();
|
!_firstTimeUseNoticeSentinel.Exists();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,10 +151,7 @@ namespace Microsoft.DotNet.Configurer
|
||||||
|
|
||||||
private bool ShouldRunFirstRunExperience()
|
private bool ShouldRunFirstRunExperience()
|
||||||
{
|
{
|
||||||
var skipFirstTimeExperience =
|
return !_dotnetFirstRunConfiguration.SkipFirstRunExperience;
|
||||||
_environmentProvider.GetEnvironmentVariableAsBool("DOTNET_SKIP_FIRST_TIME_EXPERIENCE", false);
|
|
||||||
|
|
||||||
return !skipFirstTimeExperience;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,6 +141,15 @@ namespace Microsoft.DotNet.Cli
|
||||||
command = "help";
|
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);
|
topLevelCommandParserResult = new TopLevelCommandParserResult(command);
|
||||||
var hasSuperUserAccess = false;
|
var hasSuperUserAccess = false;
|
||||||
if (IsDotnetBeingInvokedFromNativeInstaller(topLevelCommandParserResult))
|
if (IsDotnetBeingInvokedFromNativeInstaller(topLevelCommandParserResult))
|
||||||
|
@ -149,15 +158,26 @@ namespace Microsoft.DotNet.Cli
|
||||||
firstTimeUseNoticeSentinel = new NoOpFirstTimeUseNoticeSentinel();
|
firstTimeUseNoticeSentinel = new NoOpFirstTimeUseNoticeSentinel();
|
||||||
toolPathSentinel = new NoOpFileSentinel(exists: false);
|
toolPathSentinel = new NoOpFileSentinel(exists: false);
|
||||||
hasSuperUserAccess = true;
|
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(
|
ConfigureDotNetForFirstTimeUse(
|
||||||
nugetCacheSentinel,
|
nugetCacheSentinel,
|
||||||
firstTimeUseNoticeSentinel,
|
firstTimeUseNoticeSentinel,
|
||||||
aspNetCertificateSentinel,
|
aspNetCertificateSentinel,
|
||||||
toolPathSentinel,
|
toolPathSentinel,
|
||||||
cliFallbackFolderPathCalculator,
|
cliFallbackFolderPathCalculator,
|
||||||
hasSuperUserAccess);
|
hasSuperUserAccess,
|
||||||
|
dotnetFirstRunConfiguration,
|
||||||
|
environmentProvider);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -222,15 +242,17 @@ namespace Microsoft.DotNet.Cli
|
||||||
IAspNetCertificateSentinel aspNetCertificateSentinel,
|
IAspNetCertificateSentinel aspNetCertificateSentinel,
|
||||||
IFileSentinel toolPathSentinel,
|
IFileSentinel toolPathSentinel,
|
||||||
CliFolderPathCalculator cliFolderPathCalculator,
|
CliFolderPathCalculator cliFolderPathCalculator,
|
||||||
bool hasSuperUserAccess)
|
bool hasSuperUserAccess,
|
||||||
|
DotnetFirstRunConfiguration dotnetFirstRunConfiguration,
|
||||||
|
IEnvironmentProvider environmentProvider)
|
||||||
{
|
{
|
||||||
var environmentProvider = new EnvironmentProvider();
|
|
||||||
|
|
||||||
using (PerfTrace.Current.CaptureTiming())
|
using (PerfTrace.Current.CaptureTiming())
|
||||||
{
|
{
|
||||||
var nugetPackagesArchiver = new NuGetPackagesArchiver();
|
var nugetPackagesArchiver = new NuGetPackagesArchiver();
|
||||||
var environmentPath =
|
var environmentPath = EnvironmentPathFactory.CreateEnvironmentPath(
|
||||||
EnvironmentPathFactory.CreateEnvironmentPath(cliFolderPathCalculator, hasSuperUserAccess, environmentProvider);
|
cliFolderPathCalculator,
|
||||||
|
hasSuperUserAccess,
|
||||||
|
environmentProvider);
|
||||||
var commandFactory = new DotNetCommandFactory(alwaysRunOutOfProc: true);
|
var commandFactory = new DotNetCommandFactory(alwaysRunOutOfProc: true);
|
||||||
var nugetCachePrimer = new NuGetCachePrimer(
|
var nugetCachePrimer = new NuGetCachePrimer(
|
||||||
nugetPackagesArchiver,
|
nugetPackagesArchiver,
|
||||||
|
@ -244,7 +266,7 @@ namespace Microsoft.DotNet.Cli
|
||||||
aspNetCertificateSentinel,
|
aspNetCertificateSentinel,
|
||||||
aspnetCertificateGenerator,
|
aspnetCertificateGenerator,
|
||||||
toolPathSentinel,
|
toolPathSentinel,
|
||||||
environmentProvider,
|
dotnetFirstRunConfiguration,
|
||||||
Reporter.Output,
|
Reporter.Output,
|
||||||
cliFolderPathCalculator.CliFallbackFolderPath,
|
cliFolderPathCalculator.CliFallbackFolderPath,
|
||||||
environmentPath);
|
environmentPath);
|
||||||
|
|
|
@ -21,7 +21,6 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
||||||
private Mock<IAspNetCertificateSentinel> _aspNetCertificateSentinelMock;
|
private Mock<IAspNetCertificateSentinel> _aspNetCertificateSentinelMock;
|
||||||
private Mock<IAspNetCoreCertificateGenerator> _aspNetCoreCertificateGeneratorMock;
|
private Mock<IAspNetCoreCertificateGenerator> _aspNetCoreCertificateGeneratorMock;
|
||||||
private Mock<IFileSentinel> _toolPathSentinelMock;
|
private Mock<IFileSentinel> _toolPathSentinelMock;
|
||||||
private Mock<IEnvironmentProvider> _environmentProviderMock;
|
|
||||||
private Mock<IReporter> _reporterMock;
|
private Mock<IReporter> _reporterMock;
|
||||||
private Mock<IEnvironmentPath> _pathAdderMock;
|
private Mock<IEnvironmentPath> _pathAdderMock;
|
||||||
|
|
||||||
|
@ -33,16 +32,8 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
||||||
_aspNetCertificateSentinelMock = new Mock<IAspNetCertificateSentinel>();
|
_aspNetCertificateSentinelMock = new Mock<IAspNetCertificateSentinel>();
|
||||||
_aspNetCoreCertificateGeneratorMock = new Mock<IAspNetCoreCertificateGenerator>();
|
_aspNetCoreCertificateGeneratorMock = new Mock<IAspNetCoreCertificateGenerator>();
|
||||||
_toolPathSentinelMock = new Mock<IFileSentinel>();
|
_toolPathSentinelMock = new Mock<IFileSentinel>();
|
||||||
_environmentProviderMock = new Mock<IEnvironmentProvider>();
|
|
||||||
_reporterMock = new Mock<IReporter>();
|
_reporterMock = new Mock<IReporter>();
|
||||||
_pathAdderMock = new Mock<IEnvironmentPath>();
|
_pathAdderMock = new Mock<IEnvironmentPath>();
|
||||||
|
|
||||||
_environmentProviderMock
|
|
||||||
.Setup(e => e.GetEnvironmentVariableAsBool("DOTNET_SKIP_FIRST_TIME_EXPERIENCE", false))
|
|
||||||
.Returns(false);
|
|
||||||
_environmentProviderMock
|
|
||||||
.Setup(e => e.GetEnvironmentVariableAsBool("DOTNET_PRINT_TELEMETRY_MESSAGE", true))
|
|
||||||
.Returns(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
@ -57,7 +48,12 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
||||||
_aspNetCertificateSentinelMock.Object,
|
_aspNetCertificateSentinelMock.Object,
|
||||||
_aspNetCoreCertificateGeneratorMock.Object,
|
_aspNetCoreCertificateGeneratorMock.Object,
|
||||||
_toolPathSentinelMock.Object,
|
_toolPathSentinelMock.Object,
|
||||||
_environmentProviderMock.Object,
|
new DotnetFirstRunConfiguration
|
||||||
|
(
|
||||||
|
generateAspNetCertificate: true,
|
||||||
|
printTelemetryMessage: true,
|
||||||
|
skipFirstRunExperience: false
|
||||||
|
),
|
||||||
_reporterMock.Object,
|
_reporterMock.Object,
|
||||||
CliFallbackFolderPath,
|
CliFallbackFolderPath,
|
||||||
_pathAdderMock.Object);
|
_pathAdderMock.Object);
|
||||||
|
@ -72,9 +68,6 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
||||||
public void It_does_not_print_the_first_time_use_notice_when_the_user_has_set_the_DOTNET_SKIP_FIRST_TIME_EXPERIENCE_environemnt_variable()
|
public void It_does_not_print_the_first_time_use_notice_when_the_user_has_set_the_DOTNET_SKIP_FIRST_TIME_EXPERIENCE_environemnt_variable()
|
||||||
{
|
{
|
||||||
_firstTimeUseNoticeSentinelMock.Setup(n => n.Exists()).Returns(false);
|
_firstTimeUseNoticeSentinelMock.Setup(n => n.Exists()).Returns(false);
|
||||||
_environmentProviderMock
|
|
||||||
.Setup(e => e.GetEnvironmentVariableAsBool("DOTNET_SKIP_FIRST_TIME_EXPERIENCE", false))
|
|
||||||
.Returns(true);
|
|
||||||
|
|
||||||
var dotnetFirstTimeUseConfigurer = new DotnetFirstTimeUseConfigurer(
|
var dotnetFirstTimeUseConfigurer = new DotnetFirstTimeUseConfigurer(
|
||||||
_nugetCachePrimerMock.Object,
|
_nugetCachePrimerMock.Object,
|
||||||
|
@ -83,7 +76,12 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
||||||
_aspNetCertificateSentinelMock.Object,
|
_aspNetCertificateSentinelMock.Object,
|
||||||
_aspNetCoreCertificateGeneratorMock.Object,
|
_aspNetCoreCertificateGeneratorMock.Object,
|
||||||
_toolPathSentinelMock.Object,
|
_toolPathSentinelMock.Object,
|
||||||
_environmentProviderMock.Object,
|
new DotnetFirstRunConfiguration
|
||||||
|
(
|
||||||
|
generateAspNetCertificate: true,
|
||||||
|
printTelemetryMessage: true,
|
||||||
|
skipFirstRunExperience: true
|
||||||
|
),
|
||||||
_reporterMock.Object,
|
_reporterMock.Object,
|
||||||
CliFallbackFolderPath,
|
CliFallbackFolderPath,
|
||||||
_pathAdderMock.Object);
|
_pathAdderMock.Object);
|
||||||
|
@ -98,9 +96,6 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
||||||
public void It_does_not_print_the_first_time_use_notice_when_the_user_has_set_the_DOTNET_PRINT_TELEMETRY_MESSAGE_environemnt_variable()
|
public void It_does_not_print_the_first_time_use_notice_when_the_user_has_set_the_DOTNET_PRINT_TELEMETRY_MESSAGE_environemnt_variable()
|
||||||
{
|
{
|
||||||
_firstTimeUseNoticeSentinelMock.Setup(n => n.Exists()).Returns(false);
|
_firstTimeUseNoticeSentinelMock.Setup(n => n.Exists()).Returns(false);
|
||||||
_environmentProviderMock
|
|
||||||
.Setup(e => e.GetEnvironmentVariableAsBool("DOTNET_PRINT_TELEMETRY_MESSAGE", true))
|
|
||||||
.Returns(false);
|
|
||||||
|
|
||||||
var dotnetFirstTimeUseConfigurer = new DotnetFirstTimeUseConfigurer(
|
var dotnetFirstTimeUseConfigurer = new DotnetFirstTimeUseConfigurer(
|
||||||
_nugetCachePrimerMock.Object,
|
_nugetCachePrimerMock.Object,
|
||||||
|
@ -109,7 +104,12 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
||||||
_aspNetCertificateSentinelMock.Object,
|
_aspNetCertificateSentinelMock.Object,
|
||||||
_aspNetCoreCertificateGeneratorMock.Object,
|
_aspNetCoreCertificateGeneratorMock.Object,
|
||||||
_toolPathSentinelMock.Object,
|
_toolPathSentinelMock.Object,
|
||||||
_environmentProviderMock.Object,
|
new DotnetFirstRunConfiguration
|
||||||
|
(
|
||||||
|
generateAspNetCertificate: true,
|
||||||
|
printTelemetryMessage: false,
|
||||||
|
skipFirstRunExperience: false
|
||||||
|
),
|
||||||
_reporterMock.Object,
|
_reporterMock.Object,
|
||||||
CliFallbackFolderPath,
|
CliFallbackFolderPath,
|
||||||
_pathAdderMock.Object);
|
_pathAdderMock.Object);
|
||||||
|
@ -132,7 +132,12 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
||||||
_aspNetCertificateSentinelMock.Object,
|
_aspNetCertificateSentinelMock.Object,
|
||||||
_aspNetCoreCertificateGeneratorMock.Object,
|
_aspNetCoreCertificateGeneratorMock.Object,
|
||||||
_toolPathSentinelMock.Object,
|
_toolPathSentinelMock.Object,
|
||||||
_environmentProviderMock.Object,
|
new DotnetFirstRunConfiguration
|
||||||
|
(
|
||||||
|
generateAspNetCertificate: true,
|
||||||
|
printTelemetryMessage: true,
|
||||||
|
skipFirstRunExperience: false
|
||||||
|
),
|
||||||
_reporterMock.Object,
|
_reporterMock.Object,
|
||||||
CliFallbackFolderPath,
|
CliFallbackFolderPath,
|
||||||
_pathAdderMock.Object);
|
_pathAdderMock.Object);
|
||||||
|
@ -155,7 +160,12 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
||||||
_aspNetCertificateSentinelMock.Object,
|
_aspNetCertificateSentinelMock.Object,
|
||||||
_aspNetCoreCertificateGeneratorMock.Object,
|
_aspNetCoreCertificateGeneratorMock.Object,
|
||||||
_toolPathSentinelMock.Object,
|
_toolPathSentinelMock.Object,
|
||||||
_environmentProviderMock.Object,
|
new DotnetFirstRunConfiguration
|
||||||
|
(
|
||||||
|
generateAspNetCertificate: true,
|
||||||
|
printTelemetryMessage: true,
|
||||||
|
skipFirstRunExperience: false
|
||||||
|
),
|
||||||
_reporterMock.Object,
|
_reporterMock.Object,
|
||||||
CliFallbackFolderPath,
|
CliFallbackFolderPath,
|
||||||
_pathAdderMock.Object);
|
_pathAdderMock.Object);
|
||||||
|
@ -177,7 +187,12 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
||||||
_aspNetCertificateSentinelMock.Object,
|
_aspNetCertificateSentinelMock.Object,
|
||||||
_aspNetCoreCertificateGeneratorMock.Object,
|
_aspNetCoreCertificateGeneratorMock.Object,
|
||||||
_toolPathSentinelMock.Object,
|
_toolPathSentinelMock.Object,
|
||||||
_environmentProviderMock.Object,
|
new DotnetFirstRunConfiguration
|
||||||
|
(
|
||||||
|
generateAspNetCertificate: true,
|
||||||
|
printTelemetryMessage: true,
|
||||||
|
skipFirstRunExperience: false
|
||||||
|
),
|
||||||
_reporterMock.Object,
|
_reporterMock.Object,
|
||||||
CliFallbackFolderPath,
|
CliFallbackFolderPath,
|
||||||
_pathAdderMock.Object);
|
_pathAdderMock.Object);
|
||||||
|
@ -199,7 +214,12 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
||||||
_aspNetCertificateSentinelMock.Object,
|
_aspNetCertificateSentinelMock.Object,
|
||||||
_aspNetCoreCertificateGeneratorMock.Object,
|
_aspNetCoreCertificateGeneratorMock.Object,
|
||||||
_toolPathSentinelMock.Object,
|
_toolPathSentinelMock.Object,
|
||||||
_environmentProviderMock.Object,
|
new DotnetFirstRunConfiguration
|
||||||
|
(
|
||||||
|
generateAspNetCertificate: true,
|
||||||
|
printTelemetryMessage: true,
|
||||||
|
skipFirstRunExperience: false
|
||||||
|
),
|
||||||
_reporterMock.Object,
|
_reporterMock.Object,
|
||||||
CliFallbackFolderPath,
|
CliFallbackFolderPath,
|
||||||
_pathAdderMock.Object);
|
_pathAdderMock.Object);
|
||||||
|
@ -210,12 +230,9 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void It_does_not_prime_the_cache_if_the_sentinel_exists_but_the_user_has_set_the_DOTNET_SKIP_FIRST_TIME_EXPERIENCE_environemnt_variable()
|
public void It_does_not_prime_the_cache_if_the_sentinel_does_not_exist_but_the_user_has_set_the_DOTNET_SKIP_FIRST_TIME_EXPERIENCE_environment_variable()
|
||||||
{
|
{
|
||||||
_nugetCacheSentinelMock.Setup(n => n.Exists()).Returns(false);
|
_nugetCacheSentinelMock.Setup(n => n.Exists()).Returns(false);
|
||||||
_environmentProviderMock
|
|
||||||
.Setup(e => e.GetEnvironmentVariableAsBool("DOTNET_SKIP_FIRST_TIME_EXPERIENCE", false))
|
|
||||||
.Returns(true);
|
|
||||||
|
|
||||||
var dotnetFirstTimeUseConfigurer = new DotnetFirstTimeUseConfigurer(
|
var dotnetFirstTimeUseConfigurer = new DotnetFirstTimeUseConfigurer(
|
||||||
_nugetCachePrimerMock.Object,
|
_nugetCachePrimerMock.Object,
|
||||||
|
@ -224,7 +241,12 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
||||||
_aspNetCertificateSentinelMock.Object,
|
_aspNetCertificateSentinelMock.Object,
|
||||||
_aspNetCoreCertificateGeneratorMock.Object,
|
_aspNetCoreCertificateGeneratorMock.Object,
|
||||||
_toolPathSentinelMock.Object,
|
_toolPathSentinelMock.Object,
|
||||||
_environmentProviderMock.Object,
|
new DotnetFirstRunConfiguration
|
||||||
|
(
|
||||||
|
generateAspNetCertificate: true,
|
||||||
|
printTelemetryMessage: true,
|
||||||
|
skipFirstRunExperience: true
|
||||||
|
),
|
||||||
_reporterMock.Object,
|
_reporterMock.Object,
|
||||||
CliFallbackFolderPath,
|
CliFallbackFolderPath,
|
||||||
_pathAdderMock.Object);
|
_pathAdderMock.Object);
|
||||||
|
@ -246,7 +268,12 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
||||||
_aspNetCertificateSentinelMock.Object,
|
_aspNetCertificateSentinelMock.Object,
|
||||||
_aspNetCoreCertificateGeneratorMock.Object,
|
_aspNetCoreCertificateGeneratorMock.Object,
|
||||||
_toolPathSentinelMock.Object,
|
_toolPathSentinelMock.Object,
|
||||||
_environmentProviderMock.Object,
|
new DotnetFirstRunConfiguration
|
||||||
|
(
|
||||||
|
generateAspNetCertificate: true,
|
||||||
|
printTelemetryMessage: true,
|
||||||
|
skipFirstRunExperience: false
|
||||||
|
),
|
||||||
_reporterMock.Object,
|
_reporterMock.Object,
|
||||||
CliFallbackFolderPath,
|
CliFallbackFolderPath,
|
||||||
_pathAdderMock.Object);
|
_pathAdderMock.Object);
|
||||||
|
@ -269,7 +296,12 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
||||||
_aspNetCertificateSentinelMock.Object,
|
_aspNetCertificateSentinelMock.Object,
|
||||||
_aspNetCoreCertificateGeneratorMock.Object,
|
_aspNetCoreCertificateGeneratorMock.Object,
|
||||||
_toolPathSentinelMock.Object,
|
_toolPathSentinelMock.Object,
|
||||||
_environmentProviderMock.Object,
|
new DotnetFirstRunConfiguration
|
||||||
|
(
|
||||||
|
generateAspNetCertificate: true,
|
||||||
|
printTelemetryMessage: true,
|
||||||
|
skipFirstRunExperience: false
|
||||||
|
),
|
||||||
_reporterMock.Object,
|
_reporterMock.Object,
|
||||||
CliFallbackFolderPath,
|
CliFallbackFolderPath,
|
||||||
_pathAdderMock.Object);
|
_pathAdderMock.Object);
|
||||||
|
@ -295,7 +327,12 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
||||||
_aspNetCertificateSentinelMock.Object,
|
_aspNetCertificateSentinelMock.Object,
|
||||||
_aspNetCoreCertificateGeneratorMock.Object,
|
_aspNetCoreCertificateGeneratorMock.Object,
|
||||||
_toolPathSentinelMock.Object,
|
_toolPathSentinelMock.Object,
|
||||||
_environmentProviderMock.Object,
|
new DotnetFirstRunConfiguration
|
||||||
|
(
|
||||||
|
generateAspNetCertificate: true,
|
||||||
|
printTelemetryMessage: true,
|
||||||
|
skipFirstRunExperience: false
|
||||||
|
),
|
||||||
_reporterMock.Object,
|
_reporterMock.Object,
|
||||||
CliFallbackFolderPath,
|
CliFallbackFolderPath,
|
||||||
_pathAdderMock.Object);
|
_pathAdderMock.Object);
|
||||||
|
@ -322,7 +359,12 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
||||||
_aspNetCertificateSentinelMock.Object,
|
_aspNetCertificateSentinelMock.Object,
|
||||||
_aspNetCoreCertificateGeneratorMock.Object,
|
_aspNetCoreCertificateGeneratorMock.Object,
|
||||||
_toolPathSentinelMock.Object,
|
_toolPathSentinelMock.Object,
|
||||||
_environmentProviderMock.Object,
|
new DotnetFirstRunConfiguration
|
||||||
|
(
|
||||||
|
generateAspNetCertificate: true,
|
||||||
|
printTelemetryMessage: true,
|
||||||
|
skipFirstRunExperience: false
|
||||||
|
),
|
||||||
_reporterMock.Object,
|
_reporterMock.Object,
|
||||||
CliFallbackFolderPath,
|
CliFallbackFolderPath,
|
||||||
_pathAdderMock.Object);
|
_pathAdderMock.Object);
|
||||||
|
@ -345,7 +387,12 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
||||||
_aspNetCertificateSentinelMock.Object,
|
_aspNetCertificateSentinelMock.Object,
|
||||||
_aspNetCoreCertificateGeneratorMock.Object,
|
_aspNetCoreCertificateGeneratorMock.Object,
|
||||||
_toolPathSentinelMock.Object,
|
_toolPathSentinelMock.Object,
|
||||||
_environmentProviderMock.Object,
|
new DotnetFirstRunConfiguration
|
||||||
|
(
|
||||||
|
generateAspNetCertificate: true,
|
||||||
|
printTelemetryMessage: true,
|
||||||
|
skipFirstRunExperience: false
|
||||||
|
),
|
||||||
_reporterMock.Object,
|
_reporterMock.Object,
|
||||||
CliFallbackFolderPath,
|
CliFallbackFolderPath,
|
||||||
_pathAdderMock.Object);
|
_pathAdderMock.Object);
|
||||||
|
@ -368,7 +415,12 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
||||||
_aspNetCertificateSentinelMock.Object,
|
_aspNetCertificateSentinelMock.Object,
|
||||||
_aspNetCoreCertificateGeneratorMock.Object,
|
_aspNetCoreCertificateGeneratorMock.Object,
|
||||||
_toolPathSentinelMock.Object,
|
_toolPathSentinelMock.Object,
|
||||||
_environmentProviderMock.Object,
|
new DotnetFirstRunConfiguration
|
||||||
|
(
|
||||||
|
generateAspNetCertificate: true,
|
||||||
|
printTelemetryMessage: true,
|
||||||
|
skipFirstRunExperience: false
|
||||||
|
),
|
||||||
_reporterMock.Object,
|
_reporterMock.Object,
|
||||||
CliFallbackFolderPath,
|
CliFallbackFolderPath,
|
||||||
_pathAdderMock.Object);
|
_pathAdderMock.Object);
|
||||||
|
@ -398,7 +450,12 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
||||||
_aspNetCertificateSentinelMock.Object,
|
_aspNetCertificateSentinelMock.Object,
|
||||||
_aspNetCoreCertificateGeneratorMock.Object,
|
_aspNetCoreCertificateGeneratorMock.Object,
|
||||||
_toolPathSentinelMock.Object,
|
_toolPathSentinelMock.Object,
|
||||||
_environmentProviderMock.Object,
|
new DotnetFirstRunConfiguration
|
||||||
|
(
|
||||||
|
generateAspNetCertificate: true,
|
||||||
|
printTelemetryMessage: true,
|
||||||
|
skipFirstRunExperience: false
|
||||||
|
),
|
||||||
_reporterMock.Object,
|
_reporterMock.Object,
|
||||||
CliFallbackFolderPath,
|
CliFallbackFolderPath,
|
||||||
_pathAdderMock.Object);
|
_pathAdderMock.Object);
|
||||||
|
@ -420,7 +477,12 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
||||||
_aspNetCertificateSentinelMock.Object,
|
_aspNetCertificateSentinelMock.Object,
|
||||||
_aspNetCoreCertificateGeneratorMock.Object,
|
_aspNetCoreCertificateGeneratorMock.Object,
|
||||||
_toolPathSentinelMock.Object,
|
_toolPathSentinelMock.Object,
|
||||||
_environmentProviderMock.Object,
|
new DotnetFirstRunConfiguration
|
||||||
|
(
|
||||||
|
generateAspNetCertificate: true,
|
||||||
|
printTelemetryMessage: true,
|
||||||
|
skipFirstRunExperience: false
|
||||||
|
),
|
||||||
_reporterMock.Object,
|
_reporterMock.Object,
|
||||||
CliFallbackFolderPath,
|
CliFallbackFolderPath,
|
||||||
_pathAdderMock.Object);
|
_pathAdderMock.Object);
|
||||||
|
@ -435,9 +497,6 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
||||||
public void It_does_not_generate_the_aspnet_https_development_certificate_when_the_user_has_set_the_DOTNET_SKIP_FIRST_TIME_EXPERIENCE_environment_variable()
|
public void It_does_not_generate_the_aspnet_https_development_certificate_when_the_user_has_set_the_DOTNET_SKIP_FIRST_TIME_EXPERIENCE_environment_variable()
|
||||||
{
|
{
|
||||||
_aspNetCertificateSentinelMock.Setup(n => n.Exists()).Returns(false);
|
_aspNetCertificateSentinelMock.Setup(n => n.Exists()).Returns(false);
|
||||||
_environmentProviderMock
|
|
||||||
.Setup(e => e.GetEnvironmentVariableAsBool("DOTNET_SKIP_FIRST_TIME_EXPERIENCE", false))
|
|
||||||
.Returns(true);
|
|
||||||
|
|
||||||
var dotnetFirstTimeUseConfigurer = new DotnetFirstTimeUseConfigurer(
|
var dotnetFirstTimeUseConfigurer = new DotnetFirstTimeUseConfigurer(
|
||||||
_nugetCachePrimerMock.Object,
|
_nugetCachePrimerMock.Object,
|
||||||
|
@ -446,7 +505,12 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
||||||
_aspNetCertificateSentinelMock.Object,
|
_aspNetCertificateSentinelMock.Object,
|
||||||
_aspNetCoreCertificateGeneratorMock.Object,
|
_aspNetCoreCertificateGeneratorMock.Object,
|
||||||
_toolPathSentinelMock.Object,
|
_toolPathSentinelMock.Object,
|
||||||
_environmentProviderMock.Object,
|
new DotnetFirstRunConfiguration
|
||||||
|
(
|
||||||
|
generateAspNetCertificate: true,
|
||||||
|
printTelemetryMessage: true,
|
||||||
|
skipFirstRunExperience: true
|
||||||
|
),
|
||||||
_reporterMock.Object,
|
_reporterMock.Object,
|
||||||
CliFallbackFolderPath,
|
CliFallbackFolderPath,
|
||||||
_pathAdderMock.Object);
|
_pathAdderMock.Object);
|
||||||
|
@ -461,9 +525,6 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
||||||
public void It_does_not_generate_the_aspnet_https_development_certificate_when_the_user_has_set_the_DOTNET_GENERATE_ASPNET_CERTIFICATE_environment_variable()
|
public void It_does_not_generate_the_aspnet_https_development_certificate_when_the_user_has_set_the_DOTNET_GENERATE_ASPNET_CERTIFICATE_environment_variable()
|
||||||
{
|
{
|
||||||
_aspNetCertificateSentinelMock.Setup(n => n.Exists()).Returns(false);
|
_aspNetCertificateSentinelMock.Setup(n => n.Exists()).Returns(false);
|
||||||
_environmentProviderMock
|
|
||||||
.Setup(e => e.GetEnvironmentVariableAsBool("DOTNET_GENERATE_ASPNET_CERTIFICATE", true))
|
|
||||||
.Returns(false);
|
|
||||||
|
|
||||||
var dotnetFirstTimeUseConfigurer = new DotnetFirstTimeUseConfigurer(
|
var dotnetFirstTimeUseConfigurer = new DotnetFirstTimeUseConfigurer(
|
||||||
_nugetCachePrimerMock.Object,
|
_nugetCachePrimerMock.Object,
|
||||||
|
@ -472,7 +533,12 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
||||||
_aspNetCertificateSentinelMock.Object,
|
_aspNetCertificateSentinelMock.Object,
|
||||||
_aspNetCoreCertificateGeneratorMock.Object,
|
_aspNetCoreCertificateGeneratorMock.Object,
|
||||||
_toolPathSentinelMock.Object,
|
_toolPathSentinelMock.Object,
|
||||||
_environmentProviderMock.Object,
|
new DotnetFirstRunConfiguration
|
||||||
|
(
|
||||||
|
generateAspNetCertificate: false,
|
||||||
|
printTelemetryMessage: true,
|
||||||
|
skipFirstRunExperience: false
|
||||||
|
),
|
||||||
_reporterMock.Object,
|
_reporterMock.Object,
|
||||||
CliFallbackFolderPath,
|
CliFallbackFolderPath,
|
||||||
_pathAdderMock.Object);
|
_pathAdderMock.Object);
|
||||||
|
@ -487,8 +553,6 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
||||||
public void It_generates_the_aspnet_https_development_certificate_if_the_sentinel_does_not_exist()
|
public void It_generates_the_aspnet_https_development_certificate_if_the_sentinel_does_not_exist()
|
||||||
{
|
{
|
||||||
_aspNetCertificateSentinelMock.Setup(n => n.Exists()).Returns(false);
|
_aspNetCertificateSentinelMock.Setup(n => n.Exists()).Returns(false);
|
||||||
_environmentProviderMock.Setup(e => e.GetEnvironmentVariableAsBool("DOTNET_GENERATE_ASPNET_CERTIFICATE", true))
|
|
||||||
.Returns(true);
|
|
||||||
|
|
||||||
var dotnetFirstTimeUseConfigurer = new DotnetFirstTimeUseConfigurer(
|
var dotnetFirstTimeUseConfigurer = new DotnetFirstTimeUseConfigurer(
|
||||||
_nugetCachePrimerMock.Object,
|
_nugetCachePrimerMock.Object,
|
||||||
|
@ -497,7 +561,12 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
||||||
_aspNetCertificateSentinelMock.Object,
|
_aspNetCertificateSentinelMock.Object,
|
||||||
_aspNetCoreCertificateGeneratorMock.Object,
|
_aspNetCoreCertificateGeneratorMock.Object,
|
||||||
_toolPathSentinelMock.Object,
|
_toolPathSentinelMock.Object,
|
||||||
_environmentProviderMock.Object,
|
new DotnetFirstRunConfiguration
|
||||||
|
(
|
||||||
|
generateAspNetCertificate: true,
|
||||||
|
printTelemetryMessage: true,
|
||||||
|
skipFirstRunExperience: false
|
||||||
|
),
|
||||||
_reporterMock.Object,
|
_reporterMock.Object,
|
||||||
CliFallbackFolderPath,
|
CliFallbackFolderPath,
|
||||||
_pathAdderMock.Object);
|
_pathAdderMock.Object);
|
||||||
|
@ -520,7 +589,12 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
||||||
_aspNetCertificateSentinelMock.Object,
|
_aspNetCertificateSentinelMock.Object,
|
||||||
_aspNetCoreCertificateGeneratorMock.Object,
|
_aspNetCoreCertificateGeneratorMock.Object,
|
||||||
_toolPathSentinelMock.Object,
|
_toolPathSentinelMock.Object,
|
||||||
_environmentProviderMock.Object,
|
new DotnetFirstRunConfiguration
|
||||||
|
(
|
||||||
|
generateAspNetCertificate: true,
|
||||||
|
printTelemetryMessage: true,
|
||||||
|
skipFirstRunExperience: false
|
||||||
|
),
|
||||||
_reporterMock.Object,
|
_reporterMock.Object,
|
||||||
CliFallbackFolderPath,
|
CliFallbackFolderPath,
|
||||||
_pathAdderMock.Object);
|
_pathAdderMock.Object);
|
||||||
|
@ -533,10 +607,6 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
||||||
[Fact]
|
[Fact]
|
||||||
public void It_does_not_add_the_tool_path_to_the_environment_if_the_first_run_experience_is_skipped()
|
public void It_does_not_add_the_tool_path_to_the_environment_if_the_first_run_experience_is_skipped()
|
||||||
{
|
{
|
||||||
_environmentProviderMock
|
|
||||||
.Setup(e => e.GetEnvironmentVariableAsBool("DOTNET_SKIP_FIRST_TIME_EXPERIENCE", false))
|
|
||||||
.Returns(true);
|
|
||||||
|
|
||||||
var dotnetFirstTimeUseConfigurer = new DotnetFirstTimeUseConfigurer(
|
var dotnetFirstTimeUseConfigurer = new DotnetFirstTimeUseConfigurer(
|
||||||
_nugetCachePrimerMock.Object,
|
_nugetCachePrimerMock.Object,
|
||||||
_nugetCacheSentinelMock.Object,
|
_nugetCacheSentinelMock.Object,
|
||||||
|
@ -544,7 +614,12 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
||||||
_aspNetCertificateSentinelMock.Object,
|
_aspNetCertificateSentinelMock.Object,
|
||||||
_aspNetCoreCertificateGeneratorMock.Object,
|
_aspNetCoreCertificateGeneratorMock.Object,
|
||||||
_toolPathSentinelMock.Object,
|
_toolPathSentinelMock.Object,
|
||||||
_environmentProviderMock.Object,
|
new DotnetFirstRunConfiguration
|
||||||
|
(
|
||||||
|
generateAspNetCertificate: true,
|
||||||
|
printTelemetryMessage: true,
|
||||||
|
skipFirstRunExperience: true
|
||||||
|
),
|
||||||
_reporterMock.Object,
|
_reporterMock.Object,
|
||||||
CliFallbackFolderPath,
|
CliFallbackFolderPath,
|
||||||
_pathAdderMock.Object);
|
_pathAdderMock.Object);
|
||||||
|
|
|
@ -13,9 +13,5 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\src\Microsoft.DotNet.Cli.Utils\Microsoft.DotNet.Cli.Utils.csproj" />
|
<ProjectReference Include="..\..\src\Microsoft.DotNet.Cli.Utils\Microsoft.DotNet.Cli.Utils.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="NETStandard.Library" Version="2.0.0" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
Loading…
Reference in a new issue