Skip to content

Commit bf0e32a

Browse files
authored
C#: Port the existing compiler-tracing.spec files to Lua.
1 parent b8ec225 commit bf0e32a

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

csharp/tools/tracing-config.lua

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
function RegisterExtractorPack()
2+
local extractor = GetPlatformToolsDirectory() ..
3+
'Semmle.Extraction.CSharp.Driver'
4+
if OperatingSystem == 'windows' then
5+
extractor = GetPlatformToolsDirectory() ..
6+
'Semmle.Extraction.CSharp.Driver.exe'
7+
end
8+
local windowsMatchers = {
9+
CreatePatternMatcher({'^dotnet%.exe$'}, MatchCompilerName, extractor,
10+
{prepend = {'--dotnetexec', '--cil'}}),
11+
CreatePatternMatcher({'^csc.*%.exe$'}, MatchCompilerName, extractor, {
12+
prepend = {'--compiler', '"${compiler}"', '--cil'}
13+
}),
14+
CreatePatternMatcher({'^fakes.*%.exe$', 'moles.*%.exe'},
15+
MatchCompilerName, nil, {trace = false})
16+
}
17+
local posixMatchers = {
18+
CreatePatternMatcher({'^mcs%.exe$', '^csc%.exe$'}, MatchCompilerName,
19+
extractor, {
20+
prepend = {'--compiler', '"${compiler}"', '--cil'}
21+
}),
22+
CreatePatternMatcher({'^mono', '^dotnet$'}, MatchCompilerName,
23+
extractor, {prepend = {'--dotnetexec', '--cil'}}),
24+
function(compilerName, compilerPath, compilerArguments, _languageId)
25+
if MatchCompilerName('^msbuild$', compilerName, compilerPath,
26+
compilerArguments) or
27+
MatchCompilerName('^xbuild$', compilerName, compilerPath,
28+
compilerArguments) then
29+
return {
30+
replace = true,
31+
invocations = {
32+
{
33+
path = compilerPath,
34+
transformedArguments = {
35+
nativeArgumentPointer = compilerArguments['nativeArgumentPointer'],
36+
append = {'/p:UseSharedCompilation=false'},
37+
prepend = {}
38+
}
39+
}
40+
}
41+
}
42+
end
43+
end
44+
}
45+
if OperatingSystem == 'windows' then
46+
return windowsMatchers
47+
else
48+
return posixMatchers
49+
end
50+
51+
end
52+
53+
-- Return a list of minimum supported versions of the configuration file format
54+
-- return one entry per supported major version.
55+
function GetCompatibleVersions() return {'1.0.0'} end

0 commit comments

Comments
 (0)