Skip to content

Commit 907e113

Browse files
KevinRansomdsyme
authored andcommitted
Fix In IDE Build logging. (#3609)
* Fix in ide build logging. * Fix in ide build logging.
1 parent 966bd7f commit 907e113

File tree

2 files changed

+44
-40
lines changed

2 files changed

+44
-40
lines changed

src/fsharp/FSharp.Build/Fsc.fs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ type [<Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:Iden
158158
let mutable subsystemVersion : string = null
159159
let mutable tailcalls : bool = true
160160
let mutable targetProfile : string = null
161-
let mutable targetType : string = null
161+
let mutable targetType : string = null
162162
let mutable toolExe : string = "fsc.exe"
163163
let mutable toolPath : string =
164164
let locationOfThisDll =
@@ -277,7 +277,7 @@ type [<Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:Iden
277277
| "WINEXE" -> "winexe"
278278
| "MODULE" -> "module"
279279
| _ -> null)
280-
280+
281281
// NoWarn
282282
match disabledWarnings with
283283
| null -> ()
@@ -418,7 +418,7 @@ type [<Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:Iden
418418
// --noframework
419419
member fsc.NoFramework
420420
with get() = noFramework
421-
and set(b) = noFramework <- b
421+
and set(b) = noFramework <- b
422422

423423
// --optimize
424424
member fsc.Optimize
@@ -543,7 +543,7 @@ type [<Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:Iden
543543
member fsc.Win32ManifestFile
544544
with get() = win32manifest
545545
and set(m) = win32manifest <- m
546-
546+
547547
// For specifying the warning level (0-4)
548548
member fsc.WarningLevel
549549
with get() = warningLevel
@@ -552,7 +552,7 @@ type [<Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:Iden
552552
member fsc.WarningsAsErrors
553553
with get() = warningsAsErrors
554554
and set(s) = warningsAsErrors <- s
555-
555+
556556
member fsc.VisualStudioStyleErrors
557557
with get() = vserrors
558558
and set(p) = vserrors <- p
@@ -581,6 +581,9 @@ type [<Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:Iden
581581
override fsc.GenerateFullPathToTool() =
582582
if toolPath = "" then raise (new System.InvalidOperationException(FSBuild.SR.toolpathUnknown()))
583583
System.IO.Path.Combine(toolPath, fsc.ToolExe)
584+
override fsc.LogToolCommand (message:string) =
585+
fsc.Log.LogMessageFromText(message, MessageImportance.Normal) |>ignore
586+
584587
member internal fsc.InternalGenerateFullPathToTool() = fsc.GenerateFullPathToTool() // expose for unit testing
585588
member internal fsc.BaseExecuteTool(pathToTool, responseFileCommands, commandLineCommands) = // F# does not allow protected members to be captured by lambdas, this is the standard workaround
586589
base.ExecuteTool(pathToTool, responseFileCommands, commandLineCommands)

vsintegration/src/FSharp.ProjectSystem.Base/Project/IDEBuildLogger.cs

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ private void BuildStartedHandler(object sender, BuildStartedEventArgs buildEvent
358358
try
359359
{
360360
this.haveCachedRegistry = false;
361-
if (LogAtImportance(MessageImportance.Low))
361+
if (LogAtImportance(MessageImportance.Normal))
362362
{
363363
LogEvent(sender, buildEvent);
364364
}
@@ -385,7 +385,7 @@ private void BuildFinishedHandler(object sender, BuildFinishedEventArgs buildEve
385385
{
386386
try
387387
{
388-
if (LogAtImportance(buildEvent.Succeeded ? MessageImportance.Low :
388+
if (LogAtImportance(buildEvent.Succeeded ? MessageImportance.Normal :
389389
MessageImportance.High))
390390
{
391391
if (this.outputWindowPane != null)
@@ -408,7 +408,7 @@ private void ProjectStartedHandler(object sender, ProjectStartedEventArgs buildE
408408
{
409409
try
410410
{
411-
if (LogAtImportance(MessageImportance.Low))
411+
if (LogAtImportance(MessageImportance.Normal))
412412
{
413413
LogEvent(sender, buildEvent);
414414
}
@@ -427,7 +427,7 @@ private void ProjectFinishedHandler(object sender, ProjectFinishedEventArgs buil
427427
{
428428
try
429429
{
430-
if (LogAtImportance(buildEvent.Succeeded ? MessageImportance.Low
430+
if (LogAtImportance(buildEvent.Succeeded ? MessageImportance.Normal
431431
: MessageImportance.High))
432432
{
433433
LogEvent(sender, buildEvent);
@@ -473,7 +473,7 @@ private void TargetFinishedHandler(object sender, TargetFinishedEventArgs buildE
473473
{
474474
--this.currentIndent;
475475
if ((isLogTaskDone) &&
476-
LogAtImportance(buildEvent.Succeeded ? MessageImportance.Low
476+
LogAtImportance(buildEvent.Succeeded ? MessageImportance.Normal
477477
: MessageImportance.High))
478478
{
479479
LogEvent(sender, buildEvent);
@@ -556,36 +556,37 @@ private void CustomHandler(object sender, CustomBuildEventArgs buildEvent)
556556
/// This method takes a MessageImportance and returns true if messages
557557
/// at importance i should be loggeed. Otherwise return false.
558558
/// </summary>
559-
private bool LogAtImportance(MessageImportance importance)
560-
{
561-
// If importance is too low for current settings, ignore the event
562-
bool logIt = false;
563-
564-
this.SetVerbosity();
565-
566-
switch (this.Verbosity)
567-
{
568-
case LoggerVerbosity.Quiet:
569-
logIt = false;
570-
break;
571-
case LoggerVerbosity.Minimal:
572-
logIt = (importance == MessageImportance.High);
573-
break;
574-
case LoggerVerbosity.Normal:
575-
// Falling through...
576-
case LoggerVerbosity.Detailed:
577-
logIt = (importance != MessageImportance.Low);
578-
break;
579-
case LoggerVerbosity.Diagnostic:
580-
logIt = true;
581-
break;
582-
default:
583-
Debug.Fail("Unknown Verbosity level. Ignoring will cause everything to be logged");
584-
break;
585-
}
586-
587-
return logIt;
588-
}
559+
private bool LogAtImportance(MessageImportance importance)
560+
{
561+
// If importance is too low for current settings, ignore the event
562+
bool logIt = false;
563+
564+
this.SetVerbosity();
565+
566+
switch (this.Verbosity)
567+
{
568+
case LoggerVerbosity.Quiet:
569+
logIt = false;
570+
break;
571+
case LoggerVerbosity.Minimal:
572+
logIt = (importance == MessageImportance.High);
573+
break;
574+
case LoggerVerbosity.Normal:
575+
logIt = (importance == MessageImportance.Normal) || (importance == MessageImportance.High);
576+
break;
577+
case LoggerVerbosity.Detailed:
578+
logIt = (importance == MessageImportance.Low) || (importance == MessageImportance.Normal) || (importance == MessageImportance.High);
579+
break;
580+
case LoggerVerbosity.Diagnostic:
581+
logIt = true;
582+
break;
583+
default:
584+
Debug.Fail("Unknown Verbosity level. Ignoring will cause everything to be logged");
585+
break;
586+
}
587+
588+
return logIt;
589+
}
589590

590591
/// <summary>
591592
/// This is the method that does the main work of logging an event

0 commit comments

Comments
 (0)