Avoid repeating the first-run message if lzma archive is missing

If the LZMA archive is missing, the first-run message is printed every time.
This commit fixes that.

Split the first-run message into two pieces:

- The first-run (welcome and telemetry) message is printed only once, no matter
  whether the cache was primed or not.

- The cache-priming message is printed only if the cache is avaialble.
  Otherwise skip the cache introduction and the ccache priming operation.
This commit is contained in:
Omair Majid 2017-06-14 12:09:06 -04:00
parent 2180d92d10
commit 34b44b999b
10 changed files with 267 additions and 16 deletions

View file

@ -81,6 +81,7 @@ namespace Microsoft.DotNet.Cli
var lastArg = 0;
var cliFallbackFolderPathCalculator = new CliFallbackFolderPathCalculator();
using (INuGetCacheSentinel nugetCacheSentinel = new NuGetCacheSentinel(cliFallbackFolderPathCalculator))
using (IFirstTimeUseNoticeSentinel firstTimeUseNoticeSentinel = new FirstTimeUseNoticeSentinel(cliFallbackFolderPathCalculator))
{
for (; lastArg < args.Length; lastArg++)
{
@ -112,7 +113,7 @@ namespace Microsoft.DotNet.Cli
}
else
{
ConfigureDotNetForFirstTimeUse(nugetCacheSentinel, cliFallbackFolderPathCalculator);
ConfigureDotNetForFirstTimeUse(nugetCacheSentinel, firstTimeUseNoticeSentinel, cliFallbackFolderPathCalculator);
// It's the command, and we're done!
command = args[lastArg];
@ -168,6 +169,7 @@ namespace Microsoft.DotNet.Cli
private static void ConfigureDotNetForFirstTimeUse(
INuGetCacheSentinel nugetCacheSentinel,
IFirstTimeUseNoticeSentinel firstTimeUseNoticeSentinel,
CliFallbackFolderPathCalculator cliFallbackFolderPathCalculator)
{
using (PerfTrace.Current.CaptureTiming())
@ -184,7 +186,9 @@ namespace Microsoft.DotNet.Cli
var dotnetConfigurer = new DotnetFirstTimeUseConfigurer(
nugetCachePrimer,
nugetCacheSentinel,
environmentProvider);
firstTimeUseNoticeSentinel,
environmentProvider,
Reporter.Output);
dotnetConfigurer.Configure();
}