Skip to content
This repository has been archived by the owner on Dec 25, 2023. It is now read-only.

Commit

Permalink
Merge branch 'release/0.7.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalberger committed Aug 22, 2019
2 parents 800e1bd + de4c182 commit 3480839
Show file tree
Hide file tree
Showing 9 changed files with 156 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
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
75 changes: 75 additions & 0 deletions docs/examples.md
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/
48 changes: 48 additions & 0 deletions docs/features.md
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
12 changes: 12 additions & 0 deletions docs/index.cshtml
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")
9 changes: 9 additions & 0 deletions docs/requirements.md
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
2 changes: 1 addition & 1 deletion nuspec/nuget/Cake.Issues.MsBuild.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ See the Project Site for an overview of the whole ecosystem of addins for workin
<repository type="git" url="https://github.com/cake-contrib/Cake.Issues.MsBuild.git"/>
<copyright>Copyright © BBT Software AG and contributors</copyright>
<tags>Cake Script Cake-Issues Cake-IssueProvider CodeAnalysis Linting MsBuild</tags>
<releaseNotes>https://github.com/cake-contrib/Cake.Issues.MsBuild/releases/tag/0.7.1</releaseNotes>
<releaseNotes>https://github.com/cake-contrib/Cake.Issues.MsBuild/releases/tag/0.7.2</releaseNotes>
</metadata>
<files>
<file src="netstandard2.0\Cake.Issues.MsBuild.dll" target="lib\netstandard2.0" />
Expand Down
1 change: 1 addition & 0 deletions setup.cake
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ BuildParameters.SetParameters(
repositoryOwner: "cake-contrib",
repositoryName: "Cake.Issues.MsBuild",
appVeyorAccountName: "cakecontrib",
shouldGenerateDocumentation: false,
shouldRunCodecov: false);

BuildParameters.PrintParameters(Context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static string MsBuildIssuesProviderTypeName(
{
context.NotNull(nameof(context));

return typeof(MsBuildIssuesProvider).FullName;
return MsBuildIssuesProvider.ProviderTypeName;
}

/// <summary>
Expand Down
6 changes: 6 additions & 0 deletions src/Cake.Issues.MsBuild/MsBuildIssuesProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ public MsBuildIssuesProvider(ICakeLog log, MsBuildIssuesSettings settings)
{
}

/// <summary>
/// Gets the name of the MsBuild issue provider.
/// This name can be used to identify issues based on the <see cref="IIssue.ProviderType"/> property.
/// </summary>
public static string ProviderTypeName => typeof(MsBuildIssuesProvider).FullName;

/// <inheritdoc />
public override string ProviderName => "MSBuild";
}
Expand Down

0 comments on commit 3480839

Please sign in to comment.