C#: Integrate the assets parsing and fetching in the dependency manager.

This commit is contained in:
Michael Nebel
2023-10-12 09:55:41 +02:00
parent f8d427336e
commit 4cebb7e848
2 changed files with 92 additions and 79 deletions

View File

@@ -159,6 +159,16 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
return false;
}
}
public static IEnumerable<string> GetCompilationDependencies(ProgressMonitor progressMonitor, IEnumerable<string> assets)
{
var parser = new Assets(progressMonitor);
return assets.SelectMany(asset =>
{
var json = File.ReadAllText(asset);
return parser.TryParse(json, out var dependencies) ? dependencies : Array.Empty<string>();
});
}
}
internal static class JsonExtensions