@@ -19,31 +19,25 @@ internal class NugetPackages
19
19
/// <summary>
20
20
/// The list of package files.
21
21
/// </summary>
22
- public FileInfo [ ] PackageFiles { get ; }
23
-
24
- /// <summary>
25
- /// The source directory used.
26
- /// </summary>
27
- public string SourceDirectory { get ; }
22
+ private readonly FileInfo [ ] packageFiles ;
28
23
29
24
/// <summary>
30
25
/// The computed packages directory.
31
26
/// This will be in the Temp location
32
27
/// so as to not trample the source tree.
33
28
/// </summary>
34
- public TemporaryDirectory PackageDirectory { get ; }
29
+ private readonly TemporaryDirectory packageDirectory ;
35
30
36
31
/// <summary>
37
32
/// Create the package manager for a specified source tree.
38
33
/// </summary>
39
34
public NugetPackages ( string sourceDir , TemporaryDirectory packageDirectory , ProgressMonitor progressMonitor )
40
35
{
41
- SourceDirectory = sourceDir ;
42
- PackageDirectory = packageDirectory ;
36
+ this . packageDirectory = packageDirectory ;
43
37
this . progressMonitor = progressMonitor ;
44
38
45
39
nugetExe = ResolveNugetExe ( sourceDir ) ;
46
- PackageFiles = new DirectoryInfo ( SourceDirectory )
40
+ packageFiles = new DirectoryInfo ( sourceDir )
47
41
. EnumerateFiles ( "packages.config" , SearchOption . AllDirectories )
48
42
. ToArray ( ) ;
49
43
}
@@ -63,7 +57,7 @@ private string ResolveNugetExe(string sourceDir)
63
57
var nuget = Path . Combine ( directory , "nuget" , "nuget.exe" ) ;
64
58
if ( File . Exists ( nuget ) )
65
59
{
66
- progressMonitor . LogInfo ( $ "Found nuget.exe at { nuget } " ) ;
60
+ progressMonitor . FoundNuGet ( nuget ) ;
67
61
return nuget ;
68
62
}
69
63
else
@@ -81,7 +75,7 @@ private string DownloadNugetExe(string sourceDir)
81
75
// Nuget.exe already exists in the .nuget directory.
82
76
if ( File . Exists ( nuget ) )
83
77
{
84
- progressMonitor . LogInfo ( $ "Found nuget.exe at { nuget } " ) ;
78
+ progressMonitor . FoundNuGet ( nuget ) ;
85
79
return nuget ;
86
80
}
87
81
@@ -118,12 +112,12 @@ private void RestoreNugetPackage(string package)
118
112
if ( Util . Win32 . IsWindows ( ) )
119
113
{
120
114
exe = nugetExe ;
121
- args = string . Format ( "install -OutputDirectory {0} {1}" , PackageDirectory , package ) ;
115
+ args = string . Format ( "install -OutputDirectory {0} {1}" , packageDirectory , package ) ;
122
116
}
123
117
else
124
118
{
125
119
exe = "mono" ;
126
- args = string . Format ( "{0} install -OutputDirectory {1} {2}" , nugetExe , PackageDirectory , package ) ;
120
+ args = string . Format ( "{0} install -OutputDirectory {1} {2}" , nugetExe , packageDirectory , package ) ;
127
121
}
128
122
129
123
var pi = new ProcessStartInfo ( exe , args )
@@ -164,7 +158,7 @@ private void RestoreNugetPackage(string package)
164
158
/// </summary>
165
159
public void InstallPackages ( )
166
160
{
167
- foreach ( var package in PackageFiles )
161
+ foreach ( var package in packageFiles )
168
162
{
169
163
RestoreNugetPackage ( package . FullName ) ;
170
164
}
0 commit comments