mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Merge pull request #20663 from michaelnebel/csharp/dotnet10rc2traced
C#: Tracer support for invoking `csc` directly.
This commit is contained in:
@@ -74,7 +74,9 @@ namespace Semmle.Extraction.CSharp
|
|||||||
specifiedFramework = compilerDir;
|
specifiedFramework = compilerDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
var versionInfo = FileVersionInfo.GetVersionInfo(SpecifiedCompiler);
|
// If csc is specified as compiler name, then attempt to read the version information from csc.dll
|
||||||
|
var compilerBinaryName = Path.GetFileName(SpecifiedCompiler) == "csc" ? $"{SpecifiedCompiler}.dll" : SpecifiedCompiler;
|
||||||
|
var versionInfo = FileVersionInfo.GetVersionInfo(File.Exists(compilerBinaryName) ? compilerBinaryName : SpecifiedCompiler);
|
||||||
if (!knownCompilerNames.TryGetValue(versionInfo.OriginalFilename ?? string.Empty, out var vendor))
|
if (!knownCompilerNames.TryGetValue(versionInfo.OriginalFilename ?? string.Empty, out var vendor))
|
||||||
{
|
{
|
||||||
SkipExtractionBecause("the compiler name is not recognised");
|
SkipExtractionBecause("the compiler name is not recognised");
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
Console.WriteLine($"<arguments>{string.Join(",", args)}</arguments>");
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"sdk": {
|
||||||
|
"version": "10.0.100-rc.2.25502.107"
|
||||||
|
}
|
||||||
|
}
|
||||||
6
csharp/ql/integration-tests/linux/dotnet_10_rc2/test.py
Normal file
6
csharp/ql/integration-tests/linux/dotnet_10_rc2/test.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import os
|
||||||
|
import runs_on
|
||||||
|
|
||||||
|
@runs_on.linux
|
||||||
|
def test(codeql, csharp):
|
||||||
|
codeql.database.create()
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Console.WriteLine($"<arguments>{string.Join(",", args)}</arguments>");
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"sdk": {
|
||||||
|
"version": "10.0.100-rc.2.25502.107"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
import os
|
||||||
|
import runs_on
|
||||||
|
|
||||||
|
@runs_on.windows
|
||||||
|
def test(codeql, csharp):
|
||||||
|
codeql.database.create()
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
category: minorAnalysis
|
||||||
|
---
|
||||||
|
* Added tracer support for macOS and Linux when the .NET CLI (`dotnet`) directly invokes the C# compiler (`csc`). This enhancement provides basic tracing and extraction capabilities for .NET 10 RC2 on these platforms.
|
||||||
@@ -221,9 +221,9 @@ function RegisterExtractorPack(id)
|
|||||||
}
|
}
|
||||||
local posixMatchers = {
|
local posixMatchers = {
|
||||||
DotnetMatcherBuild,
|
DotnetMatcherBuild,
|
||||||
CreatePatternMatcher({ '^mcs%.exe$', '^csc%.exe$' }, MatchCompilerName,
|
CreatePatternMatcher({ '^mcs%.exe$', '^csc%.exe$', '^csc$' }, MatchCompilerName,
|
||||||
extractor, {
|
extractor, {
|
||||||
prepend = { '--compiler', '"${compiler}"' },
|
prepend = { '--compiler', '${compiler}' },
|
||||||
order = ORDER_BEFORE
|
order = ORDER_BEFORE
|
||||||
}),
|
}),
|
||||||
MsBuildMatcher,
|
MsBuildMatcher,
|
||||||
|
|||||||
Reference in New Issue
Block a user