mirror of
https://github.com/github/codeql.git
synced 2026-05-02 12:15:17 +02:00
Revert unneeded changes and simplify code
This commit is contained in:
@@ -157,7 +157,7 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
|
||||
return frameworkLocations;
|
||||
}
|
||||
|
||||
private void RestoreNugetPackages(List<FileInfo> allNonBinaryFiles, List<string> allProjects, List<string> allSolutions, HashSet<string> dllPaths)
|
||||
private void RestoreNugetPackages(List<FileInfo> allNonBinaryFiles, IEnumerable<string> allProjects, IEnumerable<string> allSolutions, HashSet<string> dllPaths)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -719,7 +719,7 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
|
||||
/// Returns a list of projects that are up to date with respect to restore.
|
||||
/// </summary>
|
||||
/// <param name="solutions">A list of paths to solution files.</param>
|
||||
private IEnumerable<string> RestoreSolutions(List<string> solutions, out IEnumerable<string> assets)
|
||||
private IEnumerable<string> RestoreSolutions(IEnumerable<string> solutions, out IEnumerable<string> assets)
|
||||
{
|
||||
var successCount = 0;
|
||||
var assetFiles = new List<string>();
|
||||
@@ -841,21 +841,13 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
|
||||
if (!res.Success)
|
||||
{
|
||||
logger.LogInfo($"Failed to restore nuget package {package}");
|
||||
}
|
||||
else
|
||||
{
|
||||
lock (sync)
|
||||
{
|
||||
successCount++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
lock (sync)
|
||||
{
|
||||
lock (sync)
|
||||
{
|
||||
successCount++;
|
||||
}
|
||||
successCount++;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
|
||||
/// Restore all files in a specified package.
|
||||
/// </summary>
|
||||
/// <param name="package">The package file.</param>
|
||||
private bool RestoreNugetPackage(string package)
|
||||
private bool TryRestoreNugetPackage(string package)
|
||||
{
|
||||
logger.LogInfo($"Restoring file {package}...");
|
||||
|
||||
@@ -157,17 +157,7 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
|
||||
/// </summary>
|
||||
public int InstallPackages()
|
||||
{
|
||||
var success = 0;
|
||||
foreach (var package in packageFiles)
|
||||
{
|
||||
var result = RestoreNugetPackage(package.FullName);
|
||||
if (result)
|
||||
{
|
||||
success++;
|
||||
}
|
||||
}
|
||||
|
||||
return success;
|
||||
return packageFiles.Count(package => TryRestoreNugetPackage(package.FullName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user