Skip to content

Commit 0353b3e

Browse files
authored
Merge pull request #10308 from github/rc/3.7
Merge `rc/3.7` into `main`
2 parents b2c38b3 + 9fd9a04 commit 0353b3e

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

csharp/tools/tracing-config.lua

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ function RegisterExtractorPack(id)
1818
-- For now, parse the command line as follows:
1919
-- Everything that starts with `-` (or `/`) will be ignored.
2020
-- The first non-option argument is treated as the command.
21-
-- if that's `build`, we append `/p:UseSharedCompilation=false` to the command line,
21+
-- if that's `build`, we append `-p:UseSharedCompilation=false` to the command line,
2222
-- otherwise we do nothing.
2323
local match = false
24+
local needsSeparator = false;
2425
local argv = compilerArguments.argv
2526
if OperatingSystem == 'windows' then
2627
-- let's hope that this split matches the escaping rules `dotnet` applies to command line arguments
@@ -33,18 +34,30 @@ function RegisterExtractorPack(id)
3334
local firstCharacter = string.sub(arg, 1, 1)
3435
if not (firstCharacter == '-') and not (firstCharacter == '/') then
3536
Log(1, 'Dotnet subcommand detected: %s', arg)
36-
if arg == 'build' or arg == 'msbuild' then match = true end
37+
if arg == 'build' or arg == 'msbuild' or arg == 'publish' or arg == 'pack' or arg == 'test' then
38+
match = true
39+
break
40+
end
41+
if arg == 'run' then
42+
-- for `dotnet run`, we need to make sure that `-p:UseSharedCompilation=false` is
43+
-- not passed in as an argument to the program that is run
44+
match = true
45+
needsSeparator = true
46+
end
47+
end
48+
if arg == '--' then
49+
needsSeparator = false
3750
break
3851
end
3952
end
4053
if match then
54+
local injections = { '-p:UseSharedCompilation=false' }
55+
if needsSeparator then
56+
table.insert(injections, '--')
57+
end
4158
return {
4259
order = ORDER_REPLACE,
43-
invocation = BuildExtractorInvocation(id, compilerPath,
44-
compilerPath,
45-
compilerArguments, nil, {
46-
'/p:UseSharedCompilation=false'
47-
})
60+
invocation = BuildExtractorInvocation(id, compilerPath, compilerPath, compilerArguments, nil, injections)
4861
}
4962
end
5063
return nil

0 commit comments

Comments
 (0)