@@ -18,9 +18,10 @@ function RegisterExtractorPack(id)
18
18
-- For now, parse the command line as follows:
19
19
-- Everything that starts with `-` (or `/`) will be ignored.
20
20
-- 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,
22
22
-- otherwise we do nothing.
23
23
local match = false
24
+ local needsSeparator = false ;
24
25
local argv = compilerArguments .argv
25
26
if OperatingSystem == ' windows' then
26
27
-- let's hope that this split matches the escaping rules `dotnet` applies to command line arguments
@@ -33,18 +34,30 @@ function RegisterExtractorPack(id)
33
34
local firstCharacter = string.sub (arg , 1 , 1 )
34
35
if not (firstCharacter == ' -' ) and not (firstCharacter == ' /' ) then
35
36
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
37
50
break
38
51
end
39
52
end
40
53
if match then
54
+ local injections = { ' -p:UseSharedCompilation=false' }
55
+ if needsSeparator then
56
+ table.insert (injections , ' --' )
57
+ end
41
58
return {
42
59
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 )
48
61
}
49
62
end
50
63
return nil
0 commit comments