Skip to content

Commit

Permalink
#366: Added custom settings to Azure DevOps task
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpalme committed Aug 2, 2020
1 parent 170172b commit 0529ec6
Show file tree
Hide file tree
Showing 15 changed files with 61 additions and 20 deletions.
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ variables:
- name: disable.coverage.autogenerate
value: 'true'
- name: version
value: '4.6.3'
value: '4.6.4'

stages:
- stage: Build
Expand Down
21 changes: 21 additions & 0 deletions src/AzureDevopsTask/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,27 @@ To learn how to use *ReportGenerator* have a look at the:
* [Usage Guide](https://danielpalme.github.io/ReportGenerator/usage.html)
* [Command line parameters](https://github.com/danielpalme/ReportGenerator/#usage--command-line-parameters)

### YAML example
```yaml

- task: Palmmedia.reportgenerator.reportgenerator-build-release-task. - task: Palmmedia.reportgenerator.reportgenerator-build-release-task.reportgenerator@4
displayName: ReportGenerator
inputs:
reports: 'coverage.xml' # REQUIRED # The coverage reports that should be parsed (separated by semicolon). Globbing is supported.
targetdir: 'coveragereport' # REQUIRED # The directory where the generated report should be saved.
reporttypes: 'HtmlInline_AzurePipelines;Cobertura' # The output formats and scope (separated by semicolon) Values: Badges, Clover, Cobertura, CsvSummary, Html, HtmlChart, HtmlInline, HtmlInline_AzurePipelines, HtmlInline_AzurePipelines_Dark, HtmlSummary, JsonSummary, Latex, LatexSummary, lcov, MHtml, PngChart, SonarQube, TeamCitySummary, TextSummary, Xml, XmlSummary
sourcedirs: '' # Optional directories which contain the corresponding source code (separated by semicolon). The source directories are used if coverage report contains classes without path information.
historydir: '' # Optional directory for storing persistent coverage information. Can be used in future reports to show coverage evolution.
plugins: '' # Optional plugin files for custom reports or custom history storage (separated by semicolon).
assemblyfilters: '+*' # Optional list of assemblies that should be included or excluded in the report. Exclusion filters take precedence over inclusion filters. Wildcards are allowed.
classfilters: '+*' # Optional list of classes that should be included or excluded in the report. Exclusion filters take precedence over inclusion filters. Wildcards are allowed.
filefilters: '+*' # Optional list of files that should be included or excluded in the report. Exclusion filters take precedence over inclusion filters. Wildcards are allowed.
verbosity: 'Info' # The verbosity level of the log messages. Values: Verbose, Info, Warning, Error, Off
title: '' # Optional title.
tag: '$(build.buildnumber)_#$(build.buildid)' # Optional tag or build version.
customSettings: '' # Optional custom settings (separated by semicolon). See: https://github.com/danielpalme/ReportGenerator/wiki/Settings.
```
### Attention
The [Publish Code Coverage Results](https://github.com/microsoft/azure-pipelines-tasks/tree/master/Tasks/PublishCodeCoverageResultsV1) task from Microsoft regenerates the report with different settings and based on the supplied _Coberatura_ file (see [announcement](https://docs.microsoft.com/en-us/azure/devops/release-notes/2019/sprint-150-update#cobertura-code-coverage-report-updates)). Moreover it does not necessarily use the latest version of _ReportGenerator_.
To disable the regeneration of the report, you can use the following environment variable in your build:
Expand Down
8 changes: 8 additions & 0 deletions src/AzureDevopsTask/ReportGenerator/reportgenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ async function executeReportGenerator(): Promise<number> {
.arg('-title:' + (tl.getInput('title') || ''))
.arg('-tag:' + (tl.getInput('tag') || ''));

const customSettings = (tl.getInput('customSettings') || '');

if (customSettings.length > 0) {
customSettings.split(';').forEach(setting => {
tool = tool.arg(setting.trim());
});
}

return await tool.exec();
}

Expand Down
10 changes: 9 additions & 1 deletion src/AzureDevopsTask/ReportGenerator/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"version": {
"Major": 4,
"Minor": 6,
"Patch": 3
"Patch": 4
},
"instanceNameFormat": "ReportGenerator",
"groups": [
Expand Down Expand Up @@ -121,6 +121,14 @@
"defaultValue": "$(build.buildnumber)_#$(build.buildid)",
"required": false,
"helpMarkDown": "Optional tag or build version."
},
{
"name": "customSettings",
"type": "string",
"label": "Custom settings",
"defaultValue": "",
"required": false,
"helpMarkDown": "Custom settings (separated by semicolon). See: https://github.com/danielpalme/ReportGenerator/wiki/Settings"
}
],
"execution": {
Expand Down
2 changes: 1 addition & 1 deletion src/AzureDevopsTask/vss-extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifestVersion": 1,
"id": "reportgenerator",
"name": "ReportGenerator",
"version": "4.6.3",
"version": "4.6.4",
"publisher": "Palmmedia",
"public": true,
"targets": [
Expand Down
4 changes: 4 additions & 0 deletions src/Readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ For further details take a look at LICENSE.txt.

CHANGELOG

4.6.4.0

* New: #366: Added custom settings to Azure DevOps task

4.6.3.0

* New: #364: Added tooltips to show coverage as ratio
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<AssemblyName>ReportGenerator</AssemblyName>
<RootNamespace>Palmmedia.ReportGenerator</RootNamespace>
<StartupObject>Palmmedia.ReportGenerator.Console.NetCore.Program</StartupObject>
<AssemblyVersion>4.6.3.0</AssemblyVersion>
<FileVersion>4.6.3.0</FileVersion>
<AssemblyVersion>4.6.4.0</AssemblyVersion>
<FileVersion>4.6.4.0</FileVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/ReportGenerator.Console/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.6.3.0")]
[assembly: AssemblyFileVersion("4.6.3.0")]
[assembly: AssemblyVersion("4.6.4.0")]
[assembly: AssemblyFileVersion("4.6.4.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<TargetFramework>netcoreapp3.1</TargetFramework>
<IsPackable>false</IsPackable>
<RootNamespace>Palmmedia.ReportGenerator.Core.Test</RootNamespace>
<AssemblyVersion>4.6.3.0</AssemblyVersion>
<FileVersion>4.6.3.0</FileVersion>
<AssemblyVersion>4.6.4.0</AssemblyVersion>
<FileVersion>4.6.4.0</FileVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/ReportGenerator.Core/ReportGenerator.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<AssemblyName>ReportGenerator.Core</AssemblyName>
<AssemblyVersion>4.6.3.0</AssemblyVersion>
<FileVersion>4.6.3.0</FileVersion>
<AssemblyVersion>4.6.4.0</AssemblyVersion>
<FileVersion>4.6.4.0</FileVersion>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<AssemblyName>dotnet-reportgenerator</AssemblyName>
<RootNamespace>Palmmedia.ReportGenerator</RootNamespace>
<StartupObject>Palmmedia.ReportGenerator.DotnetCliTool.Program</StartupObject>
<AssemblyVersion>4.6.3.0</AssemblyVersion>
<FileVersion>4.6.3.0</FileVersion>
<AssemblyVersion>4.6.4.0</AssemblyVersion>
<FileVersion>4.6.4.0</FileVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<RootNamespace>ReportGenerator.DotnetCorePluginLoader</RootNamespace>
<AssemblyVersion>4.6.3.0</AssemblyVersion>
<FileVersion>4.6.3.0</FileVersion>
<AssemblyVersion>4.6.4.0</AssemblyVersion>
<FileVersion>4.6.4.0</FileVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<AssemblyName>ReportGenerator</AssemblyName>
<RootNamespace>Palmmedia.ReportGenerator</RootNamespace>
<StartupObject>Palmmedia.ReportGenerator.DotnetGlobalTool.Program</StartupObject>
<AssemblyVersion>4.6.3.0</AssemblyVersion>
<FileVersion>4.6.3.0</FileVersion>
<AssemblyVersion>4.6.4.0</AssemblyVersion>
<FileVersion>4.6.4.0</FileVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/ReportGenerator.MSBuild/ReportGenerator.MSBuild.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<RootNamespace>Palmmedia.ReportGenerator.MSBuild</RootNamespace>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<AssemblyVersion>4.6.3.0</AssemblyVersion>
<FileVersion>4.6.3.0</FileVersion>
<AssemblyVersion>4.6.4.0</AssemblyVersion>
<FileVersion>4.6.4.0</FileVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<!-- Version, adjust before build -->
<PropertyGroup>
<Version>4.6.3</Version>
<Version>4.6.4</Version>
</PropertyGroup>

<!-- Tools -->
Expand Down

0 comments on commit 0529ec6

Please sign in to comment.