-
-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test explorer stability: Use test results as main truth source for explorer #1874
Changes from all commits
425764d
fcff548
607d328
2adb235
0077521
d43615c
3614b5d
8fcc22d
1926480
fb8eea1
5330dc4
3fac404
4b8587b
d0f2627
f0a0f98
c3996ad
13cde47
3c1cf86
4261a47
72428a2
d4e8ba7
b7d0d25
e55775c
765b710
5714bf4
e4b0026
01a70cc
80580fb
8e9e4f0
64d0ab7
7b45b7b
a411c12
d279a97
95a2b78
6bbc1a4
6567b12
88c642d
e882c87
61e938c
538f8c6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,79 @@ module MSBuild = | |
| Ok msbuild -> Promise.lift msbuild | ||
| Error msg -> Promise.reject (exn msg)) | ||
|
||
let invokeMSBuildWithCancel project target (cancellationToken: CancellationToken) = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: for follow-up we should see if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah yes. I forgot to follow up with that. |
||
|
||
if cancellationToken.isCancellationRequested then | ||
promise { return { Code = None; Signal = Some "SIGINT" } } | ||
else | ||
let autoshow = | ||
let cfg = workspace.getConfiguration () | ||
cfg.get ("FSharp.msbuildAutoshow", false) | ||
|
||
let command = [ project; $"/t:%s{target}" ] | ||
|
||
let executeWithHost () = | ||
promise { | ||
let! msbuildPath = dotnetBinary () | ||
let cmd = ResizeArray("msbuild" :: command) | ||
logger.Info("invoking msbuild from %s on %s for target %s", msbuildPath, project, target) | ||
|
||
if autoshow then | ||
outputChannel.show (?preserveFocus = None) | ||
|
||
let childProcess = Process.spawnWithNotification msbuildPath cmd outputChannel | ||
|
||
cancellationToken.onCancellationRequested.Invoke(fun _ -> | ||
if (childProcess.connected) then | ||
childProcess.kill ("SIGINT") | ||
|
||
None) | ||
|> ignore | ||
|
||
return! childProcess |> Process.toPromise | ||
} | ||
|
||
let progressOpts = createEmpty<ProgressOptions> | ||
progressOpts.location <- U2.Case1 ProgressLocation.Window | ||
|
||
window.withProgress ( | ||
progressOpts, | ||
(fun p ctok -> | ||
promise { | ||
let pm = | ||
{| message = Some $"Running MSBuild '{target}' target on '{project}'" | ||
increment = None |} | ||
|
||
p.report pm | ||
let! response = executeWithHost () | ||
|
||
match response.Code with | ||
| Some 0 -> | ||
p.report ( | ||
{| message = Some "MSBuild completed successfully" | ||
increment = None |} | ||
) | ||
|
||
return response | ||
| Some code -> | ||
p.report ( | ||
{| message = Some $"MSBuild failed with code %d{code}" | ||
increment = None |} | ||
) | ||
|
||
return response | ||
| None -> | ||
p.report ( | ||
{| message = Some "MSBuild failed with an unknown error" | ||
increment = None |} | ||
) | ||
|
||
return response | ||
} | ||
|> Promise.toThenable) | ||
) | ||
|> Promise.ofThenable | ||
|
||
let invokeMSBuild project target = | ||
let autoshow = | ||
let cfg = workspace.getConfiguration () | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a really great idea!