This commit is contained in:
Cornelius Riemenschneider 2022-05-17 09:25:06 +00:00 коммит произвёл GitHub
Родитель 629e90f14b
Коммит 3836d1550a
2 изменённых файлов: 31 добавлений и 17 удалений

Просмотреть файл

@ -3,10 +3,14 @@ function RegisterExtractorPack(id)
'Semmle.Extraction.CSharp.Driver' 'Semmle.Extraction.CSharp.Driver'
if OperatingSystem == 'windows' then extractor = extractor .. '.exe' end if OperatingSystem == 'windows' then extractor = extractor .. '.exe' end
local windowsMatchers = { local windowsMatchers = {
CreatePatternMatcher({'^dotnet%.exe$'}, MatchCompilerName, extractor, CreatePatternMatcher({'^dotnet%.exe$'}, MatchCompilerName, extractor, {
{prepend = {'--dotnetexec', '--cil'}}), prepend = {'--dotnetexec', '--cil'},
order = ORDER_BEFORE
}),
CreatePatternMatcher({'^csc.*%.exe$'}, MatchCompilerName, extractor, { CreatePatternMatcher({'^csc.*%.exe$'}, MatchCompilerName, extractor, {
prepend = {'--compiler', '"${compiler}"', '--cil'} prepend = {'--compiler', '"${compiler}"', '--cil'},
order = ORDER_BEFORE
}), }),
CreatePatternMatcher({'^fakes.*%.exe$', 'moles.*%.exe'}, CreatePatternMatcher({'^fakes.*%.exe$', 'moles.*%.exe'},
MatchCompilerName, nil, {trace = false}) MatchCompilerName, nil, {trace = false})
@ -14,23 +18,28 @@ function RegisterExtractorPack(id)
local posixMatchers = { local posixMatchers = {
CreatePatternMatcher({'^mcs%.exe$', '^csc%.exe$'}, MatchCompilerName, CreatePatternMatcher({'^mcs%.exe$', '^csc%.exe$'}, MatchCompilerName,
extractor, { extractor, {
prepend = {'--compiler', '"${compiler}"', '--cil'} prepend = {'--compiler', '"${compiler}"', '--cil'},
order = ORDER_BEFORE
}), }),
CreatePatternMatcher({'^mono', '^dotnet$'}, MatchCompilerName, CreatePatternMatcher({'^mono', '^dotnet$'}, MatchCompilerName,
extractor, {prepend = {'--dotnetexec', '--cil'}}), extractor, {
function(compilerName, compilerPath, compilerArguments, _languageId) prepend = {'--dotnetexec', '--cil'},
order = ORDER_BEFORE
}), function(compilerName, compilerPath, compilerArguments, _languageId)
if MatchCompilerName('^msbuild$', compilerName, compilerPath, if MatchCompilerName('^msbuild$', compilerName, compilerPath,
compilerArguments) or compilerArguments) or
MatchCompilerName('^xbuild$', compilerName, compilerPath, MatchCompilerName('^xbuild$', compilerName, compilerPath,
compilerArguments) then compilerArguments) then
return { return {
replace = true, order = ORDER_REPLACE,
invocations = { invocation = BuildExtractorInvocation(id, compilerPath,
BuildExtractorInvocation(id, compilerPath, compilerPath, compilerPath,
compilerArguments, nil, { compilerArguments,
nil, {
'/p:UseSharedCompilation=false' '/p:UseSharedCompilation=false'
}) })
}
} }
end end
end end

Просмотреть файл

@ -13,8 +13,12 @@ function RegisterExtractorPack(id)
table.remove(compilerArguments.argv, 1) table.remove(compilerArguments.argv, 1)
-- Skip "info" queries in case there is nothing to extract -- Skip "info" queries in case there is nothing to extract
if compilerArguments.argv[1] == '-print-target-info' then return nil end if compilerArguments.argv[1] == '-print-target-info' then
if compilerArguments.argv[1] == '-emit-supported-features' then return nil end return nil
end
if compilerArguments.argv[1] == '-emit-supported-features' then
return nil
end
-- Skip actions in which we cannot extract anything -- Skip actions in which we cannot extract anything
if compilerArguments.argv[1] == '-merge-modules' then return nil end if compilerArguments.argv[1] == '-merge-modules' then return nil end
@ -22,7 +26,8 @@ function RegisterExtractorPack(id)
return { return {
trace = true, trace = true,
replace = false, replace = false,
invocations = {{path = swiftExtractor, arguments = compilerArguments}} order = ORDER_AFTER,
invocation = {path = swiftExtractor, arguments = compilerArguments}
} }
end end
return {SwiftMatcher} return {SwiftMatcher}