This repository has been archived by the owner on Dec 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
156 additions
and
2 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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,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 |
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,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/ |
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,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 | | ||
|--------------------------------------------------------------------|--------------------------------|--------------------------------| | ||
| <span class="glyphicon glyphicon-ok" style="color:green"></span> | `IssueCommentFormat.PlainText` | | | ||
| <span class="glyphicon glyphicon-remove" style="color:red"></span> | `IssueCommentFormat.Markdown` | | | ||
| <span class="glyphicon glyphicon-remove" style="color:red"></span> | `IssueCommentFormat.Html` | | | ||
|
||
# Supported IIssue properties | ||
|
||
| | Property | Remarks | | ||
|------------------------------------------------------------------|-----------------------------------|--------------------------------| | ||
| <span class="glyphicon glyphicon-ok" style="color:green"></span> | `IIssue.ProviderType` | | | ||
| <span class="glyphicon glyphicon-ok" style="color:green"></span> | `IIssue.ProviderName` | | | ||
| <span class="glyphicon glyphicon-ok" style="color:green"></span> | `IIssue.ProjectName` | | | ||
| <span class="glyphicon glyphicon-ok" style="color:green"></span> | `IIssue.ProjectFileRelativePath` | | | ||
| <span class="glyphicon glyphicon-ok" style="color:green"></span> | `IIssue.AffectedFileRelativePath` | | | ||
| <span class="glyphicon glyphicon-ok" style="color:green"></span> | `IIssue.Line` | | | ||
| <span class="glyphicon glyphicon-ok" style="color:green"></span> | `IIssue.Message` | | | ||
| <span class="glyphicon glyphicon-ok" style="color:green"></span> | `IIssue.Priority` | Always [IssuePriority.Warning] | | ||
| <span class="glyphicon glyphicon-ok" style="color:green"></span> | `IIssue.PriorityName` | Always `Warning` | | ||
| <span class="glyphicon glyphicon-ok" style="color:green"></span> | `IIssue.Rule` | | | ||
| <span class="glyphicon glyphicon-ok" style="color:green"></span> | `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 |
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,12 @@ | ||
--- | ||
Title: MsBuild | ||
Description: Issue provider which allows you to read warnings logged by MsBuild. | ||
--- | ||
<p>@Html.Raw(Model.String(DocsKeys.Description))</p> | ||
|
||
<p> | ||
Support for reading warnings reported by MsBuild is implemented in the | ||
<a href="https://www.nuget.org/packages/Cake.Issues.MsBuild" target="_blank">Cake.Issues.MsBuild addin</a>. | ||
</p> | ||
|
||
@Html.Partial("_ChildPages") |
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,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 |
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