-
-
Notifications
You must be signed in to change notification settings - Fork 732
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH703: Add FileLogger switches to MSBuild Runner
Addresses issue #703 Provides the ability to add FileLogger parameters to the MsBuild command line. The various fileloggerparameters (flp) can also be specified. The parameters that can be created are /fl, /fl[1 thru 9], /flp, and /flp[1 thru 9]
- Loading branch information
1 parent
e9f8f5e
commit 4d12531
Showing
8 changed files
with
327 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Cake.Core.Diagnostics; | ||
|
||
namespace Cake.Common.Tools.MSBuild | ||
{ | ||
/// <summary> | ||
/// Contains settings for specifying a MSBuild file logger. | ||
/// </summary> | ||
public class MSBuildFileLogger | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="MSBuildFileLogger"/> class. | ||
/// </summary> | ||
public MSBuildFileLogger() | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets a value indicating whether PerformanceSummary will Show the time that’s spent in tasks, targets, and projects. | ||
/// </summary> | ||
public bool PerformanceSummaryEnabled { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets a value indicating whether Summary will Show the error and warning summary at the end. | ||
/// </summary> | ||
public bool SummaryDisabled { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets show ErrorsOnly, WarningsOnly, or All | ||
/// </summary> | ||
public MSBuildFileLoggerOutput MSBuildFileLoggerOutput { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets a value indicating whether NoItemAndPropertyList will be set to Don't show the list of items and properties that would appear at the start of each project build if the verbosity level is set to diagnostic. | ||
/// </summary> | ||
public bool HideVerboseItemAndPropertyList { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets a value indicating whether ShowCommandLine. Show TaskCommandLineEvent messages. | ||
/// </summary> | ||
public bool ShowCommandLine { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets a value indicating whether ShowTimestamp. Show the timestamp as a prefix to any message. | ||
/// </summary> | ||
public bool ShowTimestamp { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets a value indicating whether ShowEventId. Show the event ID for each started event, finished event, and message. | ||
/// </summary> | ||
public bool ShowEventId { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets Verbosity. Override the /verbosity setting for this logger. | ||
/// | ||
/// specify the following verbosity levels: q[uiet], m[inimal], n[ormal], v[erbose] (detailed), and diag[nostic]. | ||
/// </summary> | ||
public Verbosity? Verbosity { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets LogFile. The path to the log file into which the build log is written. | ||
/// | ||
/// an empty string will use msbuild.log | ||
/// </summary> | ||
public string LogFile { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets a value indicating whether the build log is appended to the log file or overwrites it. When true, the build log is appended to the log file. | ||
/// </summary> | ||
public bool AppendToLogFile { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets Specifies the encoding for the file (for example, UTF-8, Unicode, or ASCII). | ||
/// </summary> | ||
public string Encoding { get; set; } | ||
|
||
/// <summary> | ||
/// process the file logger config and return parameters as a string | ||
/// </summary> | ||
/// <returns>The parameters separated by semi-colons.</returns> | ||
public string GetParameters() | ||
{ | ||
var parameters = new List<string>(); | ||
parameters.Add(!string.IsNullOrWhiteSpace(LogFile) ? $"logfile={LogFile}" : null); | ||
parameters.Add(!string.IsNullOrWhiteSpace(Encoding) ? $"Encoding={Encoding}" : null); | ||
parameters.Add(AppendToLogFile ? "Append" : null); | ||
parameters.Add(PerformanceSummaryEnabled ? "PerformanceSummary" : null); | ||
parameters.Add(SummaryDisabled ? "NoSummary" : null); | ||
parameters.Add(MSBuildFileLoggerOutput == MSBuildFileLoggerOutput.ErrorsOnly ? "ErrorsOnly" : null); | ||
parameters.Add(MSBuildFileLoggerOutput == MSBuildFileLoggerOutput.WarningsOnly ? "WarningsOnly" : null); | ||
parameters.Add(HideVerboseItemAndPropertyList ? "NoItemAndPropertyList" : null); | ||
parameters.Add(ShowCommandLine ? "ShowCommandLine" : null); | ||
parameters.Add(ShowTimestamp ? "ShowTimestamp" : null); | ||
parameters.Add(ShowEventId ? "ShowEventId" : null); | ||
parameters.Add(Verbosity != null ? $"Verbosity={Verbosity.Value.ToString()}" : null); | ||
|
||
return string.Join(";", parameters.Where(p => p != null)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
namespace Cake.Common.Tools.MSBuild | ||
{ | ||
/// <summary> | ||
/// the type of file logger output to generate | ||
/// </summary> | ||
public enum MSBuildFileLoggerOutput | ||
{ | ||
/// <summary> | ||
/// show errors and warnings | ||
/// </summary> | ||
All = 0, | ||
|
||
/// <summary> | ||
/// show errors only | ||
/// </summary> | ||
ErrorsOnly = 1, | ||
|
||
/// <summary> | ||
/// show warnings only | ||
/// </summary> | ||
WarningsOnly = 2, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters