Fixing the location of the sentinel and placing it side by side with the fallback folder.
This commit is contained in:
parent
0c1af8a2fe
commit
347bd4b1fe
3 changed files with 27 additions and 39 deletions
|
@ -17,25 +17,13 @@ namespace Microsoft.DotNet.Configurer
|
|||
|
||||
private string _nugetCachePath;
|
||||
|
||||
private string NuGetCachePath
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(_nugetCachePath))
|
||||
{
|
||||
_nugetCachePath = NuGetPathContext.Create(new NullSettings()).UserPackageFolder;
|
||||
}
|
||||
|
||||
return _nugetCachePath;
|
||||
}
|
||||
}
|
||||
|
||||
private string SentinelPath => Path.Combine(NuGetCachePath, SENTINEL);
|
||||
private string InProgressSentinelPath => Path.Combine(NuGetCachePath, INPROGRESS_SENTINEL);
|
||||
private string SentinelPath => Path.Combine(_nugetCachePath, SENTINEL);
|
||||
private string InProgressSentinelPath => Path.Combine(_nugetCachePath, INPROGRESS_SENTINEL);
|
||||
|
||||
private Stream InProgressSentinel { get; set; }
|
||||
|
||||
public NuGetCacheSentinel() : this(string.Empty, FileSystemWrapper.Default.File)
|
||||
public NuGetCacheSentinel(CLIFallbackFolderPathCalculator cliFallbackFolderPathCalculator) :
|
||||
this(cliFallbackFolderPathCalculator.CLIFallbackFolderPath, FileSystemWrapper.Default.File)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -74,9 +62,9 @@ namespace Microsoft.DotNet.Configurer
|
|||
{
|
||||
try
|
||||
{
|
||||
if(!Directory.Exists(NuGetCachePath))
|
||||
if(!Directory.Exists(_nugetCachePath))
|
||||
{
|
||||
Directory.CreateDirectory(NuGetCachePath);
|
||||
Directory.CreateDirectory(_nugetCachePath);
|
||||
}
|
||||
|
||||
// open an exclusive handle to the in-progress sentinel and mark it for delete on close.
|
||||
|
|
|
@ -79,7 +79,8 @@ namespace Microsoft.DotNet.Cli
|
|||
var success = true;
|
||||
var command = string.Empty;
|
||||
var lastArg = 0;
|
||||
using (INuGetCacheSentinel nugetCacheSentinel = new NuGetCacheSentinel())
|
||||
var cliFallbackFolderPathCalculator = new CLIFallbackFolderPathCalculator();
|
||||
using (INuGetCacheSentinel nugetCacheSentinel = new NuGetCacheSentinel(cliFallbackFolderPathCalculator))
|
||||
{
|
||||
for (; lastArg < args.Length; lastArg++)
|
||||
{
|
||||
|
@ -111,7 +112,7 @@ namespace Microsoft.DotNet.Cli
|
|||
}
|
||||
else
|
||||
{
|
||||
ConfigureDotNetForFirstTimeUse(nugetCacheSentinel);
|
||||
ConfigureDotNetForFirstTimeUse(nugetCacheSentinel, cliFallbackFolderPathCalculator);
|
||||
|
||||
// It's the command, and we're done!
|
||||
command = args[lastArg];
|
||||
|
@ -165,28 +166,27 @@ namespace Microsoft.DotNet.Cli
|
|||
|
||||
}
|
||||
|
||||
private static void ConfigureDotNetForFirstTimeUse(INuGetCacheSentinel nugetCacheSentinel)
|
||||
private static void ConfigureDotNetForFirstTimeUse(
|
||||
INuGetCacheSentinel nugetCacheSentinel,
|
||||
CLIFallbackFolderPathCalculator cliFallbackFolderPathCalculator)
|
||||
{
|
||||
using (PerfTrace.Current.CaptureTiming())
|
||||
{
|
||||
using (var nugetPackagesArchiver = new NuGetPackagesArchiver())
|
||||
{
|
||||
var cliFallbackFolderPathCalculator = new CLIFallbackFolderPathCalculator();
|
||||
var environmentProvider = new EnvironmentProvider();
|
||||
var commandFactory = new DotNetCommandFactory(alwaysRunOutOfProc: true);
|
||||
var nugetConfig = new NuGetConfi(cliFallbackFolderPathCalculator);
|
||||
var nugetCachePrimer = new NuGetCachePrimer(
|
||||
nugetPackagesArchiver,
|
||||
nugetCacheSentinel,
|
||||
nugetConfig,
|
||||
cliFallbackFolderPathCalculator);
|
||||
var dotnetConfigurer = new DotnetFirstTimeUseConfigurer(
|
||||
nugetCachePrimer,
|
||||
nugetCacheSentinel,
|
||||
environmentProvider);
|
||||
var nugetPackagesArchiver = new NuGetPackagesArchiver();
|
||||
var environmentProvider = new EnvironmentProvider();
|
||||
var commandFactory = new DotNetCommandFactory(alwaysRunOutOfProc: true);
|
||||
var nugetConfig = new NuGetConfig(cliFallbackFolderPathCalculator);
|
||||
var nugetCachePrimer = new NuGetCachePrimer(
|
||||
nugetPackagesArchiver,
|
||||
nugetCacheSentinel,
|
||||
nugetConfig,
|
||||
cliFallbackFolderPathCalculator);
|
||||
var dotnetConfigurer = new DotnetFirstTimeUseConfigurer(
|
||||
nugetCachePrimer,
|
||||
nugetCacheSentinel,
|
||||
environmentProvider);
|
||||
|
||||
dotnetConfigurer.Configure();
|
||||
}
|
||||
dotnetConfigurer.Configure();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace Microsoft.DotNet.Tools.MSBuild
|
|||
{
|
||||
public sealed class MSBuildLogger : Logger
|
||||
{
|
||||
private readonly INuGetCacheSentinel _sentinel = new NuGetCacheSentinel();
|
||||
private readonly INuGetCacheSentinel _sentinel = new NuGetCacheSentinel(new CLIFallbackFolderPathCalculator());
|
||||
private readonly ITelemetry _telemetry;
|
||||
|
||||
public MSBuildLogger()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue