mirror of
https://github.com/github/codeql.git
synced 2025-12-18 01:33:15 +01:00
C#: Fix /p:UseSharedCompilation=false tracer injection for dotnet run
This commit is contained in:
@@ -19,6 +19,7 @@ function RegisterExtractorPack(id)
|
|||||||
-- if that's `build`, we append `/p:UseSharedCompilation=false` to the command line,
|
-- if that's `build`, we append `/p:UseSharedCompilation=false` to the command line,
|
||||||
-- otherwise we do nothing.
|
-- otherwise we do nothing.
|
||||||
local match = false
|
local match = false
|
||||||
|
local needsSeparator = false;
|
||||||
local argv = compilerArguments.argv
|
local argv = compilerArguments.argv
|
||||||
if OperatingSystem == 'windows' then
|
if OperatingSystem == 'windows' then
|
||||||
-- let's hope that this split matches the escaping rules `dotnet` applies to command line arguments
|
-- let's hope that this split matches the escaping rules `dotnet` applies to command line arguments
|
||||||
@@ -31,19 +32,30 @@ function RegisterExtractorPack(id)
|
|||||||
local firstCharacter = string.sub(arg, 1, 1)
|
local firstCharacter = string.sub(arg, 1, 1)
|
||||||
if not (firstCharacter == '-') and not (firstCharacter == '/') then
|
if not (firstCharacter == '-') and not (firstCharacter == '/') then
|
||||||
Log(1, 'Dotnet subcommand detected: %s', arg)
|
Log(1, 'Dotnet subcommand detected: %s', arg)
|
||||||
if arg == 'build' or arg == 'msbuild' or arg == 'publish' or arg == 'pack' or arg == 'test' or
|
if arg == 'build' or arg == 'msbuild' or arg == 'publish' or arg == 'pack' or arg == 'test' then
|
||||||
arg == 'run' then match = true end
|
match = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
if arg == 'run' then
|
||||||
|
-- for `dotnet run`, we need to make sure that `/p:UseSharedCompilation=false` is
|
||||||
|
-- not passed in as an argument to the program that is run
|
||||||
|
match = true
|
||||||
|
needsSeparator = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if arg == '--' then
|
||||||
|
needsSeparator = false
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if match then
|
if match then
|
||||||
|
local injections = { '/p:UseSharedCompilation=false' }
|
||||||
|
if needsSeparator then
|
||||||
|
table.insert(injections, '--')
|
||||||
|
end
|
||||||
return {
|
return {
|
||||||
order = ORDER_REPLACE,
|
order = ORDER_REPLACE,
|
||||||
invocation = BuildExtractorInvocation(id, compilerPath,
|
invocation = BuildExtractorInvocation(id, compilerPath, compilerPath, compilerArguments, nil, injections)
|
||||||
compilerPath,
|
|
||||||
compilerArguments, nil, {
|
|
||||||
'/p:UseSharedCompilation=false'
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user