зеркало из https://github.com/github/codeql.git
Filter analyzer assemblies from nuget packages
This commit is contained in:
Родитель
8a0dc31ab0
Коммит
09c1c715a3
|
@ -161,6 +161,7 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
|
|||
|
||||
private void RemoveUnnecessaryNugetPackages(bool existsNetCoreRefNugetPackage, bool existsNetFrameworkRefNugetPackage)
|
||||
{
|
||||
RemoveNugetAnalyzerReferences();
|
||||
RemoveRuntimeNugetPackageReferences();
|
||||
|
||||
if (fileContent.IsNewProjectStructureUsed
|
||||
|
@ -181,6 +182,45 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
|
|||
// (if the file names match)
|
||||
}
|
||||
|
||||
private void RemoveNugetAnalyzerReferences()
|
||||
{
|
||||
if (!options.UseNuGet)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var packageFolder = packageDirectory.DirInfo.FullName.ToLowerInvariant();
|
||||
if (packageFolder == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var filename in usedReferences.Keys)
|
||||
{
|
||||
var lowerFilename = filename.ToLowerInvariant();
|
||||
|
||||
if (lowerFilename.StartsWith(packageFolder))
|
||||
{
|
||||
var firstDirectorySeparatorCharIndex = lowerFilename.IndexOf(Path.DirectorySeparatorChar, packageFolder.Length + 1);
|
||||
if (firstDirectorySeparatorCharIndex == -1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
var secondDirectorySeparatorCharIndex = lowerFilename.IndexOf(Path.DirectorySeparatorChar, firstDirectorySeparatorCharIndex + 1);
|
||||
if (secondDirectorySeparatorCharIndex == -1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
var subFolderIndex = secondDirectorySeparatorCharIndex + 1;
|
||||
var isInAnalyzersFolder = lowerFilename.IndexOf("analyzers", subFolderIndex) == subFolderIndex;
|
||||
if (isInAnalyzersFolder)
|
||||
{
|
||||
usedReferences.Remove(filename);
|
||||
progressMonitor.RemovedReference(filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void AddNetFrameworkDlls(List<string> dllDirNames)
|
||||
{
|
||||
var runtime = new Runtime(dotnet);
|
||||
|
@ -240,6 +280,11 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
|
|||
}
|
||||
|
||||
var packageFolder = packageDirectory.DirInfo.FullName.ToLowerInvariant();
|
||||
if (packageFolder == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var packagePathPrefixes = packagePrefixes.Select(p => Path.Combine(packageFolder, p.ToLowerInvariant()));
|
||||
|
||||
foreach (var filename in usedReferences.Keys)
|
||||
|
|
|
@ -8,15 +8,6 @@
|
|||
| /microsoft.netcore.app.ref/6.0.13/ref/net6.0/System.Data.dll |
|
||||
| /microsoft.netcore.app.ref/6.0.13/ref/net6.0/System.Xml.dll |
|
||||
| /microsoft.netcore.app.ref/6.0.13/ref/net6.0/System.dll |
|
||||
| /microsoft.netcore.app.ref/7.0.2/analyzers/dotnet/cs/Microsoft.Interop.JavaScript.JSImportGenerator.dll |
|
||||
| /microsoft.netcore.app.ref/7.0.2/analyzers/dotnet/cs/Microsoft.Interop.LibraryImportGenerator.dll |
|
||||
| /microsoft.netcore.app.ref/7.0.2/analyzers/dotnet/cs/Microsoft.Interop.SourceGeneration.dll |
|
||||
| /microsoft.netcore.app.ref/7.0.2/analyzers/dotnet/cs/System.Text.Json.SourceGeneration.dll |
|
||||
| /microsoft.netcore.app.ref/7.0.2/analyzers/dotnet/cs/System.Text.RegularExpressions.Generator.dll |
|
||||
| /microsoft.netcore.app.ref/7.0.2/analyzers/dotnet/cs/zh-Hant/Microsoft.Interop.LibraryImportGenerator.resources.dll |
|
||||
| /microsoft.netcore.app.ref/7.0.2/analyzers/dotnet/cs/zh-Hant/Microsoft.Interop.SourceGeneration.resources.dll |
|
||||
| /microsoft.netcore.app.ref/7.0.2/analyzers/dotnet/cs/zh-Hant/System.Text.Json.SourceGeneration.resources.dll |
|
||||
| /microsoft.netcore.app.ref/7.0.2/analyzers/dotnet/cs/zh-Hant/System.Text.RegularExpressions.Generator.resources.dll |
|
||||
| /microsoft.netcore.app.ref/7.0.2/ref/net7.0/Microsoft.CSharp.dll |
|
||||
| /microsoft.netcore.app.ref/7.0.2/ref/net7.0/Microsoft.VisualBasic.Core.dll |
|
||||
| /microsoft.netcore.app.ref/7.0.2/ref/net7.0/Microsoft.VisualBasic.dll |
|
||||
|
|
|
@ -8,15 +8,6 @@
|
|||
| /microsoft.netcore.app.ref/6.0.13/ref/net6.0/System.Data.dll |
|
||||
| /microsoft.netcore.app.ref/6.0.13/ref/net6.0/System.Xml.dll |
|
||||
| /microsoft.netcore.app.ref/6.0.13/ref/net6.0/System.dll |
|
||||
| /microsoft.netcore.app.ref/7.0.2/analyzers/dotnet/cs/Microsoft.Interop.JavaScript.JSImportGenerator.dll |
|
||||
| /microsoft.netcore.app.ref/7.0.2/analyzers/dotnet/cs/Microsoft.Interop.LibraryImportGenerator.dll |
|
||||
| /microsoft.netcore.app.ref/7.0.2/analyzers/dotnet/cs/Microsoft.Interop.SourceGeneration.dll |
|
||||
| /microsoft.netcore.app.ref/7.0.2/analyzers/dotnet/cs/System.Text.Json.SourceGeneration.dll |
|
||||
| /microsoft.netcore.app.ref/7.0.2/analyzers/dotnet/cs/System.Text.RegularExpressions.Generator.dll |
|
||||
| /microsoft.netcore.app.ref/7.0.2/analyzers/dotnet/cs/zh-Hant/Microsoft.Interop.LibraryImportGenerator.resources.dll |
|
||||
| /microsoft.netcore.app.ref/7.0.2/analyzers/dotnet/cs/zh-Hant/Microsoft.Interop.SourceGeneration.resources.dll |
|
||||
| /microsoft.netcore.app.ref/7.0.2/analyzers/dotnet/cs/zh-Hant/System.Text.Json.SourceGeneration.resources.dll |
|
||||
| /microsoft.netcore.app.ref/7.0.2/analyzers/dotnet/cs/zh-Hant/System.Text.RegularExpressions.Generator.resources.dll |
|
||||
| /microsoft.netcore.app.ref/7.0.2/ref/net7.0/Microsoft.CSharp.dll |
|
||||
| /microsoft.netcore.app.ref/7.0.2/ref/net7.0/Microsoft.VisualBasic.Core.dll |
|
||||
| /microsoft.netcore.app.ref/7.0.2/ref/net7.0/Microsoft.Win32.Primitives.dll |
|
||||
|
@ -174,10 +165,6 @@
|
|||
| /microsoft.netcore.app.ref/7.0.2/ref/net7.0/System.Xml.XmlSerializer.dll |
|
||||
| /microsoft.netcore.app.ref/7.0.2/ref/net7.0/mscorlib.dll |
|
||||
| /microsoft.netcore.app.ref/7.0.2/ref/net7.0/netstandard.dll |
|
||||
| /microsoft.windowsdesktop.app.ref/7.0.2/analyzers/dotnet/System.Windows.Forms.Analyzers.dll |
|
||||
| /microsoft.windowsdesktop.app.ref/7.0.2/analyzers/dotnet/cs/System.Windows.Forms.Analyzers.CSharp.dll |
|
||||
| /microsoft.windowsdesktop.app.ref/7.0.2/analyzers/dotnet/cs/zh-Hant/System.Windows.Forms.Analyzers.CSharp.resources.dll |
|
||||
| /microsoft.windowsdesktop.app.ref/7.0.2/analyzers/dotnet/zh-Hant/System.Windows.Forms.Analyzers.resources.dll |
|
||||
| /microsoft.windowsdesktop.app.ref/7.0.2/ref/net7.0/Accessibility.dll |
|
||||
| /microsoft.windowsdesktop.app.ref/7.0.2/ref/net7.0/Microsoft.VisualBasic.Forms.dll |
|
||||
| /microsoft.windowsdesktop.app.ref/7.0.2/ref/net7.0/Microsoft.VisualBasic.dll |
|
||||
|
|
Загрузка…
Ссылка в новой задаче