@@ -14,6 +14,26 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
14
14
/// </summary>
15
15
internal class NugetPackages
16
16
{
17
+ private readonly string nugetExe ;
18
+ private readonly ProgressMonitor progressMonitor ;
19
+
20
+ /// <summary>
21
+ /// The list of package files.
22
+ /// </summary>
23
+ public FileInfo [ ] PackageFiles { get ; }
24
+
25
+ /// <summary>
26
+ /// The source directory used.
27
+ /// </summary>
28
+ public string SourceDirectory { get ; }
29
+
30
+ /// <summary>
31
+ /// The computed packages directory.
32
+ /// This will be in the Temp location
33
+ /// so as to not trample the source tree.
34
+ /// </summary>
35
+ public TemporaryDirectory PackageDirectory { get ; }
36
+
17
37
/// <summary>
18
38
/// Create the package manager for a specified source tree.
19
39
/// </summary>
@@ -32,47 +52,11 @@ public NugetPackages(string sourceDir, TemporaryDirectory packageDirectory, Prog
32
52
if ( ! File . Exists ( nugetExe ) )
33
53
throw new FileNotFoundException ( string . Format ( "NuGet could not be found at {0}" , nugetExe ) ) ;
34
54
35
- packages = new DirectoryInfo ( SourceDirectory )
55
+ PackageFiles = new DirectoryInfo ( SourceDirectory )
36
56
. EnumerateFiles ( "packages.config" , SearchOption . AllDirectories )
37
57
. ToArray ( ) ;
38
58
}
39
59
40
- // List of package files to download.
41
- private readonly FileInfo [ ] packages ;
42
-
43
- /// <summary>
44
- /// The list of package files.
45
- /// </summary>
46
- public IEnumerable < FileInfo > PackageFiles => packages ;
47
-
48
- /// <summary>
49
- /// Download the packages to the temp folder.
50
- /// </summary>
51
- /// <param name="pm">The progress monitor used for reporting errors etc.</param>
52
- public void InstallPackages ( )
53
- {
54
- foreach ( var package in packages )
55
- {
56
- RestoreNugetPackage ( package . FullName ) ;
57
- }
58
- }
59
-
60
- /// <summary>
61
- /// The source directory used.
62
- /// </summary>
63
- public string SourceDirectory
64
- {
65
- get ;
66
- private set ;
67
- }
68
-
69
- /// <summary>
70
- /// The computed packages directory.
71
- /// This will be in the Temp location
72
- /// so as to not trample the source tree.
73
- /// </summary>
74
- public TemporaryDirectory PackageDirectory { get ; }
75
-
76
60
/// <summary>
77
61
/// Restore all files in a specified package.
78
62
/// </summary>
@@ -133,7 +117,16 @@ private void RestoreNugetPackage(string package)
133
117
}
134
118
}
135
119
136
- private readonly string nugetExe ;
137
- private readonly ProgressMonitor progressMonitor ;
120
+ /// <summary>
121
+ /// Download the packages to the temp folder.
122
+ /// </summary>
123
+ /// <param name="pm">The progress monitor used for reporting errors etc.</param>
124
+ public void InstallPackages ( )
125
+ {
126
+ foreach ( var package in PackageFiles )
127
+ {
128
+ RestoreNugetPackage ( package . FullName ) ;
129
+ }
130
+ }
138
131
}
139
132
}
0 commit comments