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