@@ -16,9 +16,10 @@ function RegisterExtractorPack(id)
16
16
-- For now, parse the command line as follows:
17
17
-- Everything that starts with `-` (or `/`) will be ignored.
18
18
-- The first non-option argument is treated as the command.
19
- -- if that's `build`, we append `/ p:UseSharedCompilation=false` to the command line,
19
+ -- if that's `build`, we append `- p:UseSharedCompilation=false` to the command line,
20
20
-- otherwise we do nothing.
21
21
local match = false
22
+ local needsSeparator = false ;
22
23
local argv = compilerArguments .argv
23
24
if OperatingSystem == ' windows' then
24
25
-- let's hope that this split matches the escaping rules `dotnet` applies to command line arguments
@@ -31,18 +32,30 @@ function RegisterExtractorPack(id)
31
32
local firstCharacter = string.sub (arg , 1 , 1 )
32
33
if not (firstCharacter == ' -' ) and not (firstCharacter == ' /' ) then
33
34
Log (1 , ' Dotnet subcommand detected: %s' , arg )
34
- if arg == ' build' or arg == ' msbuild' then match = true end
35
+ if arg == ' build' or arg == ' msbuild' or arg == ' publish' or arg == ' pack' or arg == ' test' then
36
+ match = true
37
+ break
38
+ end
39
+ if arg == ' run' then
40
+ -- for `dotnet run`, we need to make sure that `-p:UseSharedCompilation=false` is
41
+ -- not passed in as an argument to the program that is run
42
+ match = true
43
+ needsSeparator = true
44
+ end
45
+ end
46
+ if arg == ' --' then
47
+ needsSeparator = false
35
48
break
36
49
end
37
50
end
38
51
if match then
52
+ local injections = { ' -p:UseSharedCompilation=false' }
53
+ if needsSeparator then
54
+ table.insert (injections , ' --' )
55
+ end
39
56
return {
40
57
order = ORDER_REPLACE ,
41
- invocation = BuildExtractorInvocation (id , compilerPath ,
42
- compilerPath ,
43
- compilerArguments , nil , {
44
- ' /p:UseSharedCompilation=false'
45
- })
58
+ invocation = BuildExtractorInvocation (id , compilerPath , compilerPath , compilerArguments , nil , injections )
46
59
}
47
60
end
48
61
return nil
0 commit comments