|
1 | 1 | function RegisterExtractorPack(id)
|
2 |
| - local extractor = GetPlatformToolsDirectory() .. |
3 |
| - 'Semmle.Extraction.CSharp.Driver' |
4 |
| - if OperatingSystem == 'windows' then extractor = extractor .. '.exe' end |
| 2 | + function Exify(path) |
| 3 | + if OperatingSystem == 'windows' then return path .. '.exe' else return path end |
| 4 | + end |
| 5 | + |
| 6 | + local extractor = Exify(GetPlatformToolsDirectory() .. 'Semmle.Extraction.CSharp.Driver') |
5 | 7 |
|
6 | 8 | function DotnetMatcherBuild(compilerName, compilerPath, compilerArguments,
|
7 | 9 | _languageId)
|
@@ -48,10 +50,29 @@ function RegisterExtractorPack(id)
|
48 | 50 | return nil
|
49 | 51 | end
|
50 | 52 |
|
| 53 | + function MsBuildMatcher(compilerName, compilerPath, compilerArguments, _languageId) |
| 54 | + if MatchCompilerName('^' .. Exify('msbuild') .. '$', compilerName, compilerPath, |
| 55 | + compilerArguments) or |
| 56 | + MatchCompilerName('^' .. Exify('xbuild') .. '$', compilerName, compilerPath, |
| 57 | + compilerArguments) then |
| 58 | + return { |
| 59 | + order = ORDER_REPLACE, |
| 60 | + invocation = BuildExtractorInvocation(id, compilerPath, |
| 61 | + compilerPath, |
| 62 | + compilerArguments, |
| 63 | + nil, { |
| 64 | + '/p:UseSharedCompilation=false' |
| 65 | + }) |
| 66 | + |
| 67 | + } |
| 68 | + end |
| 69 | + end |
| 70 | + |
51 | 71 | local windowsMatchers = {
|
52 | 72 | DotnetMatcherBuild,
|
| 73 | + MsBuildMatcher, |
53 | 74 | CreatePatternMatcher({ '^csc.*%.exe$' }, MatchCompilerName, extractor, {
|
54 |
| - prepend = {'--compiler', '"${compiler}"' }, |
| 75 | + prepend = { '--compiler', '"${compiler}"' }, |
55 | 76 | order = ORDER_BEFORE
|
56 | 77 | }),
|
57 | 78 | CreatePatternMatcher({ '^fakes.*%.exe$', 'moles.*%.exe' },
|
@@ -94,23 +115,9 @@ function RegisterExtractorPack(id)
|
94 | 115 | extractor, {
|
95 | 116 | prepend = { '--compiler', '"${compiler}"' },
|
96 | 117 | order = ORDER_BEFORE
|
97 |
| - }), function(compilerName, compilerPath, compilerArguments, _languageId) |
98 |
| - if MatchCompilerName('^msbuild$', compilerName, compilerPath, |
99 |
| - compilerArguments) or |
100 |
| - MatchCompilerName('^xbuild$', compilerName, compilerPath, |
101 |
| - compilerArguments) then |
102 |
| - return { |
103 |
| - order = ORDER_REPLACE, |
104 |
| - invocation = BuildExtractorInvocation(id, compilerPath, |
105 |
| - compilerPath, |
106 |
| - compilerArguments, |
107 |
| - nil, { |
108 |
| - '/p:UseSharedCompilation=false' |
109 |
| - }) |
110 |
| - |
111 |
| - } |
112 |
| - end |
113 |
| - end, function(compilerName, compilerPath, compilerArguments, _languageId) |
| 118 | + }), |
| 119 | + MsBuildMatcher, |
| 120 | + function(compilerName, compilerPath, compilerArguments, _languageId) |
114 | 121 | -- handle cases like `dotnet exec csc.dll <args>` and `mono(-sgen64) csc.exe <args>`
|
115 | 122 | if compilerName ~= 'dotnet' and not compilerName:match('^mono') then
|
116 | 123 | return nil
|
|
0 commit comments