Skip to content

Commit

Permalink
C#: Address review comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelnebel committed Jun 7, 2023
1 parent 4dae7ad commit 2ab5f41
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions csharp/tools/tracing-config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ function RegisterExtractorPack(id)
-- if that's `build`, we append `-p:UseSharedCompilation=false` to the command line,
-- otherwise we do nothing.
local match = false
local matchTest = false;
local libOrExe = false;
local dotnetRunNeedsSeparator = false;
local dotnetRunInjectionIndex = nil;
local libOrExe = false;
local argv = compilerArguments.argv
if OperatingSystem == 'windows' then
-- let's hope that this split matches the escaping rules `dotnet` applies to command line arguments
Expand All @@ -35,7 +36,7 @@ function RegisterExtractorPack(id)
-- dotnet options start with either - or / (both are legal)
local firstCharacter = string.sub(arg, 1, 1)
if not (firstCharacter == '-') and not (firstCharacter == '/') then
if (not match) then
if (not match and not testMatch) then
Log(1, 'Dotnet subcommand detected: %s', arg)
end
if arg == 'build' or arg == 'msbuild' or arg == 'publish' or arg == 'pack' then
Expand All @@ -50,7 +51,7 @@ function RegisterExtractorPack(id)
dotnetRunInjectionIndex = i + 1
end
if arg == 'test' then
match = true
testMatch = true
end
-- for `dotnet test`, we should not append `-p:UseSharedCompilation=false` to the command line
-- if a library or executable is being provided as an argument.
Expand All @@ -71,7 +72,7 @@ function RegisterExtractorPack(id)
dotnetRunInjectionIndex = i
end
end
if match and not libOrExe then
if match or testMatch and not libOrExe then
local injections = { '-p:UseSharedCompilation=false', '-p:EmitCompilerGeneratedFiles=true' }
if dotnetRunNeedsSeparator then
table.insert(injections, '--')
Expand Down

0 comments on commit 2ab5f41

Please sign in to comment.