diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..da37e81 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,3 @@ +# These owners will be the default owners for everything in the repo and +# will be requested for review when someone opens a pull request. +* @pascalberger @christianbumann @x-jokay @silanosa @georgesgoetz \ No newline at end of file diff --git a/docs/examples.md b/docs/examples.md new file mode 100644 index 0000000..4003e87 --- /dev/null +++ b/docs/examples.md @@ -0,0 +1,75 @@ +--- +Order: 30 +Title: Examples +Description: Examples for using the Cake.Issues.MsBuild addin. +--- +The following example will call MsBuild to build the solution and outputs the number of warnings. + +To read issues from MsBuild log files you need to import the core addin and the MsBuild support: + +```csharp +#addin "Cake.Issues" +#addin "Cake.Issues.MsBuild" +``` + +In this example the log file is written by the `XmlFileLogger` class from [MSBuild Extension Pack]. +In order to use the above logger, the following line will download and install the tool from NuGet.org: + +```csharp +#tool "nuget:?package=MSBuild.Extension.Pack" +``` + +:::{.alert .alert-warning} +Please note that you always should pin addins and tools to a specific version to make sure your builds are deterministic and +won't break due to updates to one of the packages. + +See [pinning addin versions](https://cakebuild.net/docs/tutorials/pinning-cake-version#pinning-addin-version) for details. +::: + +We need some global variables: + +```csharp +var logPath = @"c:\build\msbuild.log"; +var repoRootPath = @"c:\repo"; +``` + +The following task will build the solution and write a log file: + +```csharp +Task("Build-Solution").Does(() => +{ + // Build solution. + var settings = + new MSBuildSettings() + .WithLogger( + Context.Tools.Resolve("MSBuild.ExtensionPack.Loggers.dll").FullPath, + "XmlFileLogger", + $"logfile=\"{logPath}\";verbosity=Detailed;encoding=UTF-8" + ); + + MSBuild(repoRootPath.CombineWithFilePath("MySolution.sln"), settings); +}); +``` + +Finally you can define a task where you call the core addin with the desired issue provider. +The following example reads issues reported as MsBuild warnings by the `XmlFileLogger` +class from [MSBuild Extension Pack]: + +```csharp +Task("Read-Issues") + .IsDependentOn("Build-Solution") + .Does(() => + { + // Read Issues. + var issues = + ReadIssues( + MsBuildIssuesFromFilePath( + logPath, + MsBuildXmlFileLoggerFormat), + repoRootFolder); + + Information("{0} issues are found.", issues.Count()); + }); +``` + +[MSBuild Extension Pack]: http://www.msbuildextensionpack.com/ diff --git a/docs/features.md b/docs/features.md new file mode 100644 index 0000000..78f695d --- /dev/null +++ b/docs/features.md @@ -0,0 +1,48 @@ +--- +Order: 20 +Title: Features +Description: Features of the Cake.Issues.MsBuild addin. +--- +The [Cake.Issues.MsBuild addin] provides the following features. + +# Basic features + +* Reads warnings from MSBuild log files. +* Provides URLs for all code analysis (`CA*`) and StyleCop (`SA*`) warnings. +* Support for custom URL resolving using the [MsBuildAddRuleUrlResolver] alias. + +# Supported log file formats + +* [MsBuildBinaryLogFileFormat] alias for reading issues from binary log files. +* [MsBuildXmlFileLoggerFormat] alias for reading issues from log files created by [MSBuild Extension Pack XmlFileLogger]. + +# Supported comment formats + +| | Comment format | Remarks | +|--------------------------------------------------------------------|--------------------------------|--------------------------------| +| | `IssueCommentFormat.PlainText` | | +| | `IssueCommentFormat.Markdown` | | +| | `IssueCommentFormat.Html` | | + +# Supported IIssue properties + +| | Property | Remarks | +|------------------------------------------------------------------|-----------------------------------|--------------------------------| +| | `IIssue.ProviderType` | | +| | `IIssue.ProviderName` | | +| | `IIssue.ProjectName` | | +| | `IIssue.ProjectFileRelativePath` | | +| | `IIssue.AffectedFileRelativePath` | | +| | `IIssue.Line` | | +| | `IIssue.Message` | | +| | `IIssue.Priority` | Always [IssuePriority.Warning] | +| | `IIssue.PriorityName` | Always `Warning` | +| | `IIssue.Rule` | | +| | `IIssue.RuleUrl` | For code analysis (`CA*`) and StyleCop (`SA*`) warnings. Support for additional rules can be added through a custom [MsBuildAddRuleUrlResolver] | + +[Cake.Issues.MsBuild addin]: https://www.nuget.org/packages/Cake.Issues.MsBuild +[MSBuild Extension Pack XmlFileLogger]: http://www.msbuildextensionpack.com/help/4.0.5.0/html/242ab4fd-c2e2-f6aa-325b-7588725aed24.htm +[MsBuildAddRuleUrlResolver]: ../../../api/Cake.Issues.MsBuild/MsBuildIssuesAliases/93C21487 +[MsBuildBinaryLogFileFormat]: ../../../api/Cake.Issues.MsBuild/MsBuildIssuesAliases/AD50C7E1 +[MsBuildXmlFileLoggerFormat]: ../../../api/Cake.Issues.MsBuild/MsBuildIssuesAliases/051D7B6E +[IssuePriority.Warning]: ../../../api/Cake.Issues/IssuePriority/7A0CE07F diff --git a/docs/index.cshtml b/docs/index.cshtml new file mode 100644 index 0000000..394da87 --- /dev/null +++ b/docs/index.cshtml @@ -0,0 +1,12 @@ +--- +Title: MsBuild +Description: Issue provider which allows you to read warnings logged by MsBuild. +--- +
@Html.Raw(Model.String(DocsKeys.Description))
+ ++ Support for reading warnings reported by MsBuild is implemented in the + Cake.Issues.MsBuild addin. +
+ +@Html.Partial("_ChildPages") \ No newline at end of file diff --git a/docs/requirements.md b/docs/requirements.md new file mode 100644 index 0000000..bc25ea6 --- /dev/null +++ b/docs/requirements.md @@ -0,0 +1,9 @@ +--- +Order: 10 +Title: Requirements +Description: Requirements for the Cake.Issues.MsBuild addin. +--- +The requirements for using the [Cake.Issues.MsBuild addin] are listed in the [release notes] for any specific version. + +[Cake.Issues.MsBuild addin]: https://www.nuget.org/packages/Cake.Issues.MsBuild +[release notes]: release-notes diff --git a/nuspec/nuget/Cake.Issues.MsBuild.nuspec b/nuspec/nuget/Cake.Issues.MsBuild.nuspec index 4cf8965..392d10a 100644 --- a/nuspec/nuget/Cake.Issues.MsBuild.nuspec +++ b/nuspec/nuget/Cake.Issues.MsBuild.nuspec @@ -24,7 +24,7 @@ See the Project Site for an overview of the whole ecosystem of addins for workin