@@ -21,7 +21,6 @@ function RegisterExtractorPack(id)
21
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 testMatch = false ;
25
24
local dotnetRunNeedsSeparator = false ;
26
25
local dotnetRunInjectionIndex = nil ;
27
26
local argv = compilerArguments .argv
@@ -35,7 +34,7 @@ function RegisterExtractorPack(id)
35
34
-- dotnet options start with either - or / (both are legal)
36
35
local firstCharacter = string.sub (arg , 1 , 1 )
37
36
if not (firstCharacter == ' -' ) and not (firstCharacter == ' /' ) then
38
- if (not match and not testMatch ) then
37
+ if (not match ) then
39
38
Log (1 , ' Dotnet subcommand detected: %s' , arg )
40
39
end
41
40
if arg == ' build' or arg == ' msbuild' or arg == ' publish' or arg == ' pack' then
@@ -50,12 +49,13 @@ function RegisterExtractorPack(id)
50
49
dotnetRunInjectionIndex = i + 1
51
50
end
52
51
if arg == ' test' then
53
- testMatch = true
52
+ match = true
54
53
end
55
- -- for `dotnet test`, we should not append `-p:UseSharedCompilation=false` to the command line
54
+ -- for `dotnet [ test|run] `, we should not append `-p:UseSharedCompilation=false` to the command line
56
55
-- if a library or executable is being provided as an argument.
57
- if testMatch and (arg :match (' %.exe$' ) or arg :match (' %.dll' )) then
58
- testMatch = false
56
+ if arg :match (' %.exe$' ) or arg :match (' %.dll' ) then
57
+ match = false
58
+ break
59
59
end
60
60
end
61
61
-- if we see a separator to `dotnet run`, inject just prior to the existing separator
@@ -71,7 +71,7 @@ function RegisterExtractorPack(id)
71
71
dotnetRunInjectionIndex = i
72
72
end
73
73
end
74
- if match or testMatch then
74
+ if match then
75
75
local injections = { ' -p:UseSharedCompilation=false' , ' -p:EmitCompilerGeneratedFiles=true' }
76
76
if dotnetRunNeedsSeparator then
77
77
table.insert (injections , ' --' )
0 commit comments