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

Commit

Permalink
Multi-Target .NET 8 (#362)
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalberger authored Nov 26, 2023
1 parent 41c14e4 commit b324fb2
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 37 deletions.
1 change: 1 addition & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ install:
- ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Version 5.0.408 -InstallDir $env:DOTNET_INSTALL_DIR'
- ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Version 6.0.417 -InstallDir $env:DOTNET_INSTALL_DIR'
- ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Version 7.0.404 -InstallDir $env:DOTNET_INSTALL_DIR'
- ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Version 8.0.100 -InstallDir $env:DOTNET_INSTALL_DIR'
- ps: $env:Path = "$env:DOTNET_INSTALL_DIR;$env:Path"
- ps: dotnet --info

Expand Down
4 changes: 4 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,9 @@ jobs:
inputs:
version: '7.x'
displayName: 'Install .NET 7'
- task: UseDotNet@2
inputs:
version: '8.x'
displayName: 'Install .NET 8'
- powershell: ./build.ps1
displayName: 'Cake Build'
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"sdk": {
"allowPrerelease": true,
"version": "7.0.404",
"version": "8.0.100",
"rollForward": "latestFeature"
}
}
6 changes: 6 additions & 0 deletions nuspec/nuget/Cake.Issues.MsBuild.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,11 @@ See the Project Site for an overview of the whole ecosystem of addins for workin
<file src="net7.0\StructuredLogger.dll" target="lib\net7.0" />
<file src="net7.0\Microsoft.Build.Framework.dll" target="lib\net7.0" />
<file src="net7.0\Microsoft.Build.Utilities.Core.dll" target="lib\net7.0" />
<file src="net8.0\Cake.Issues.MsBuild.dll" target="lib\net8.0" />
<file src="net8.0\Cake.Issues.MsBuild.pdb" target="lib\net8.0" />
<file src="net8.0\Cake.Issues.MsBuild.xml" target="lib\net8.0" />
<file src="net8.0\StructuredLogger.dll" target="lib\net8.0" />
<file src="net8.0\Microsoft.Build.Framework.dll" target="lib\net8.0" />
<file src="net8.0\Microsoft.Build.Utilities.Core.dll" target="lib\net8.0" />
</files>
</package>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<Product>Cake.Issues</Product>
<Copyright>Copyright © BBT Software AG and contributors</Copyright>
Expand Down
7 changes: 1 addition & 6 deletions src/Cake.Issues.MsBuild.Tests/FakeMsBuildLogFileFormat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,8 @@
using System.Collections.Generic;
using Cake.Core.Diagnostics;

internal class FakeMsBuildLogFileFormat : BaseMsBuildLogFileFormat
internal class FakeMsBuildLogFileFormat(ICakeLog log) : BaseMsBuildLogFileFormat(log)
{
public FakeMsBuildLogFileFormat(ICakeLog log)
: base(log)
{
}

public new (bool Valid, string FilePath) ValidateFilePath(string filePath, IRepositorySettings repositorySettings)
{
return base.ValidateFilePath(filePath, repositorySettings);
Expand Down
2 changes: 1 addition & 1 deletion src/Cake.Issues.MsBuild/Cake.Issues.MsBuild.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<Description>MsBuild support for the Cake.Issues Addin for Cake Build Automation System</Description>
<Authors>BBT Software AG</Authors>
<Company>BBT Software AG</Company>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,9 @@
/// <summary>
/// MsBuild log format as written by the <c>XmlFileLogger</c> class from MSBuild Extension Pack.
/// </summary>
internal class XmlFileLoggerLogFileFormat : BaseMsBuildLogFileFormat
/// <param name="log">The Cake log instance.</param>
internal class XmlFileLoggerLogFileFormat(ICakeLog log) : BaseMsBuildLogFileFormat(log)
{
/// <summary>
/// Initializes a new instance of the <see cref="XmlFileLoggerLogFileFormat"/> class.
/// </summary>
/// <param name="log">The Cake log instance.</param>
public XmlFileLoggerLogFileFormat(ICakeLog log)
: base(log)
{
}

/// <inheritdoc/>
public override IEnumerable<IIssue> ReadIssues(
MsBuildIssuesProvider issueProvider,
Expand Down Expand Up @@ -54,14 +46,14 @@ public override IEnumerable<IIssue> ReadIssues(
}

// Read affected project from the warning or error.
if (!this.TryGetProject(element, repositorySettings, out string projectFileRelativePath))
if (!this.TryGetProject(element, repositorySettings, out var projectFileRelativePath))
{
this.Log.Information("Skip element since project could not be parsed");
continue;
}

// Read affected file from the warning or error.
if (!this.TryGetFile(element, repositorySettings, out string fileName))
if (!this.TryGetFile(element, repositorySettings, out var fileName))
{
this.Log.Information("Skip element since file path could not be parsed");
continue;
Expand All @@ -82,7 +74,7 @@ public override IEnumerable<IIssue> ReadIssues(
}

// Read rule code from the warning or error.
if (!this.TryGetRule(element, out string rule))
if (!this.TryGetRule(element, out var rule))
{
this.Log.Information("Skip element since rule could not be parsed");
continue;
Expand Down
14 changes: 3 additions & 11 deletions src/Cake.Issues.MsBuild/MsBuildIssuesProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,10 @@
/// <summary>
/// Provider for issues reported as MsBuild warnings.
/// </summary>
public class MsBuildIssuesProvider : BaseMultiFormatIssueProvider<MsBuildIssuesSettings, MsBuildIssuesProvider>
/// <param name="log">The Cake log context.</param>
/// <param name="settings">Settings for reading the log file.</param>
public class MsBuildIssuesProvider(ICakeLog log, MsBuildIssuesSettings settings) : BaseMultiFormatIssueProvider<MsBuildIssuesSettings, MsBuildIssuesProvider>(log, settings)
{
/// <summary>
/// Initializes a new instance of the <see cref="MsBuildIssuesProvider"/> class.
/// </summary>
/// <param name="log">The Cake log context.</param>
/// <param name="settings">Settings for reading the log file.</param>
public MsBuildIssuesProvider(ICakeLog log, MsBuildIssuesSettings settings)
: base(log, 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.
Expand Down
8 changes: 4 additions & 4 deletions src/Cake.Issues.MsBuild/MsBuildRuleUrlResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,25 @@ private MsBuildRuleUrlResolver()

// .NET SDK analyzers
this.AddUrlResolver(x =>
x.Category.ToUpperInvariant() == "CA" ?
x.Category.Equals("CA", StringComparison.OrdinalIgnoreCase) ?
new Uri("https://www.google.com/search?q=%22" + x.Rule + ":%22+site:learn.microsoft.com") :
null);

// StyleCop analyzer rules
this.AddUrlResolver(x =>
x.Category.ToUpperInvariant() == "SA" ?
x.Category.Equals("SA", StringComparison.OrdinalIgnoreCase) ?
new Uri("https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/" + x.Rule + ".md") :
null);

// SonarLint rules
this.AddUrlResolver(x =>
x.Category.ToUpperInvariant() == "S" ?
x.Category.Equals("S", StringComparison.OrdinalIgnoreCase) ?
new Uri("https://rules.sonarsource.com/csharp/RSPEC-" + x.RuleId) :
null);

// Roslynator rules
this.AddUrlResolver(x =>
x.Category.ToUpperInvariant() == "RCS" ?
x.Category.Equals("RCS", StringComparison.OrdinalIgnoreCase) ?
new Uri("https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/" + x.Rule + ".md") :
null);
}
Expand Down
5 changes: 5 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
</PropertyGroup>
</Project>

0 comments on commit b324fb2

Please sign in to comment.