Skip to content

Commit

Permalink
Feat/add support for dotnet8 (#1251)
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasSchubert committed Nov 20, 2023
1 parent 50b91bd commit 13c1810
Show file tree
Hide file tree
Showing 14 changed files with 28 additions and 22 deletions.
1 change: 1 addition & 0 deletions .editorconfig
Expand Up @@ -205,5 +205,6 @@ dotnet_diagnostic.RS1026.severity = none

dotnet_diagnostic.CA1806.severity = none
dotnet_diagnostic.CA1826.severity = none
dotnet_diagnostic.CA1860.severity = none
dotnet_diagnostic.CA1861.severity = none
dotnet_diagnostic.CA2231.severity = none
1 change: 1 addition & 0 deletions ChangeLog.md
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- Bump Roslyn to 4.6.0 ([PR](https://github.com/dotnet/roslynator/pull/1248)).
- [CLI] Add support for .NET 8 ([PR](https://github.com/josefpihrt/roslynator/pull/1251)).

### Fixed

Expand Down
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup Condition="'$(RoslynatorDotNetCli)' != true AND '$(RoslynatorCommandLine)' != true">
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<PropertyGroup Condition="'$(RoslynatorDotNetCli)' == true">
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
</PropertyGroup>

<PropertyGroup Condition="'$(RoslynatorCommandLine)' == true">
Expand Down
4 changes: 4 additions & 0 deletions src/CommandLine/.editorconfig
Expand Up @@ -2,3 +2,7 @@

[*.{cs,csx}]
roslynator_configure_await = false

dotnet_diagnostic.CA1510.severity = none
dotnet_diagnostic.CA1512.severity = none
dotnet_diagnostic.CA1866.severity = none
4 changes: 2 additions & 2 deletions src/CommandLine/CommandLine.csproj
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup Condition="'$(RoslynatorDotNetCli)' != true AND '$(RoslynatorCommandLine)' != true">
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<PropertyGroup Condition="'$(RoslynatorDotNetCli)' == true">
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
</PropertyGroup>

<PropertyGroup Condition="'$(RoslynatorCommandLine)' == true">
Expand Down
20 changes: 10 additions & 10 deletions src/CommandLine/Commands/ListSymbolsCommand.cs
Expand Up @@ -112,7 +112,7 @@ public override async Task<CommandResult> ExecuteAsync(ProjectOrSolution project
: null;

using (var stringWriter = new StringWriter())
using (SymbolDefinitionWriter writer = new SymbolDefinitionTextWriter(
using (var writer = new SymbolDefinitionTextWriter(
stringWriter,
filter: SymbolFilterOptions,
format: format,
Expand All @@ -138,7 +138,7 @@ public override async Task<CommandResult> ExecuteAsync(ProjectOrSolution project
var xmlWriterSettings = new XmlWriterSettings() { Indent = true, IndentChars = Options.IndentChars };

using (XmlWriter xmlWriter = XmlWriter.Create(path, xmlWriterSettings))
using (SymbolDefinitionWriter writer = new SymbolDefinitionXmlWriter(xmlWriter, SymbolFilterOptions, format, documentationProvider, hierarchyRoot))
using (var writer = new SymbolDefinitionXmlWriter(xmlWriter, SymbolFilterOptions, format, documentationProvider, hierarchyRoot))
{
writer.WriteDocument(assemblies, cancellationToken);
}
Expand All @@ -148,7 +148,7 @@ public override async Task<CommandResult> ExecuteAsync(ProjectOrSolution project
var xmlWriterSettings = new XmlWriterSettings() { OmitXmlDeclaration = true, Indent = true, IndentChars = "" };

using (XmlWriter xmlWriter = XmlWriter.Create(path, xmlWriterSettings))
using (SymbolDefinitionWriter writer = new SymbolDefinitionHtmlWriter(xmlWriter, SymbolFilterOptions, format, documentationProvider, hierarchyRoot))
using (var writer = new SymbolDefinitionHtmlWriter(xmlWriter, SymbolFilterOptions, format, documentationProvider, hierarchyRoot))
{
writer.WriteDocument(assemblies, cancellationToken);
}
Expand All @@ -160,7 +160,7 @@ public override async Task<CommandResult> ExecuteAsync(ProjectOrSolution project
using (var fileStream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read))
using (var streamWriter = new StreamWriter(fileStream, Encodings.UTF8NoBom))
using (MarkdownWriter markdownWriter = MarkdownWriter.Create(streamWriter, markdownWriterSettings))
using (SymbolDefinitionWriter writer = new SymbolDefinitionMarkdownWriter(
using (var writer = new SymbolDefinitionMarkdownWriter(
markdownWriter,
SymbolFilterOptions,
format,
Expand Down Expand Up @@ -189,7 +189,7 @@ public override async Task<CommandResult> ExecuteAsync(ProjectOrSolution project
jsonWriter.Formatting = Newtonsoft.Json.Formatting.None;
}

using (SymbolDefinitionWriter writer = new SymbolDefinitionJsonWriter(jsonWriter, SymbolFilterOptions, format, documentationProvider, hierarchyRoot))
using (var writer = new SymbolDefinitionJsonWriter(jsonWriter, SymbolFilterOptions, format, documentationProvider, hierarchyRoot))
{
writer.WriteDocument(assemblies, cancellationToken);
}
Expand Down Expand Up @@ -304,7 +304,7 @@ private static IAssemblySymbol FindExternalAssembly(IEnumerable<Compilation> com
INamedTypeSymbol hierarchyRoot,
CancellationToken cancellationToken)
{
using (SymbolDefinitionWriter textWriter = new SymbolDefinitionTextWriter(
using (var textWriter = new SymbolDefinitionTextWriter(
ConsoleOut,
filter: SymbolFilterOptions,
format: format,
Expand All @@ -328,7 +328,7 @@ private static IAssemblySymbol FindExternalAssembly(IEnumerable<Compilation> com
jsonWriter.Formatting = Newtonsoft.Json.Formatting.None;
}

using (SymbolDefinitionWriter writer = new SymbolDefinitionJsonWriter(jsonWriter, SymbolFilterOptions, format, default(SymbolDocumentationProvider), hierarchyRoot))
using (var writer = new SymbolDefinitionJsonWriter(jsonWriter, SymbolFilterOptions, format, default(SymbolDocumentationProvider), hierarchyRoot))
{
writer.WriteDocument(assemblies, cancellationToken);
}
Expand All @@ -337,21 +337,21 @@ private static IAssemblySymbol FindExternalAssembly(IEnumerable<Compilation> com
WriteLine();

using (XmlWriter xmlWriter = XmlWriter.Create(ConsoleOut, new XmlWriterSettings() { Indent = true, IndentChars = Options.IndentChars }))
using (SymbolDefinitionWriter writer = new SymbolDefinitionXmlWriter(xmlWriter, SymbolFilterOptions, format, new SymbolDocumentationProvider(compilations), hierarchyRoot))
using (var writer = new SymbolDefinitionXmlWriter(xmlWriter, SymbolFilterOptions, format, new SymbolDocumentationProvider(compilations), hierarchyRoot))
{
writer.WriteDocument(assemblies, cancellationToken);
}

WriteLine();

using (XmlWriter xmlWriter = XmlWriter.Create(ConsoleOut, new XmlWriterSettings() { OmitXmlDeclaration = true, Indent = true, IndentChars = "" }))
using (SymbolDefinitionWriter writer = new SymbolDefinitionHtmlWriter(xmlWriter, SymbolFilterOptions, format, new SymbolDocumentationProvider(compilations), hierarchyRoot))
using (var writer = new SymbolDefinitionHtmlWriter(xmlWriter, SymbolFilterOptions, format, new SymbolDocumentationProvider(compilations), hierarchyRoot))
writer.WriteDocument(assemblies, cancellationToken);

WriteLine();

using (MarkdownWriter markdownWriter = MarkdownWriter.Create(ConsoleOut))
using (SymbolDefinitionWriter writer = new SymbolDefinitionMarkdownWriter(
using (var writer = new SymbolDefinitionMarkdownWriter(
markdownWriter,
SymbolFilterOptions,
format,
Expand Down
2 changes: 1 addition & 1 deletion src/CommandLine/ConsoleDialogDefinition.cs
Expand Up @@ -33,7 +33,7 @@ public static ConsoleDialogDefinition Default

public abstract bool TryGetValue(string key, out DialogResult result);

private static ConsoleDialogDefinition CreateDefaultDefinition()
private static DefaultDialogDefinition CreateDefaultDefinition()
{
ImmutableDictionary<string, DialogResult>.Builder builder
= ImmutableDictionary.CreateBuilder<string, DialogResult>();
Expand Down
2 changes: 1 addition & 1 deletion src/CommandLine/Json/SymbolDefinitionJsonWriter.cs
Expand Up @@ -19,7 +19,7 @@ internal class SymbolDefinitionJsonWriter : SymbolDefinitionWriter
private JsonWriter _writer;
private StringBuilder _attributeStringBuilder;

private SymbolDefinitionWriter _definitionWriter;
private SymbolDefinitionTextWriter _definitionWriter;

public SymbolDefinitionJsonWriter(
JsonWriter writer,
Expand Down
2 changes: 1 addition & 1 deletion src/CommandLine/Orang/CommandLine.Core/CommandLoader.cs
Expand Up @@ -42,7 +42,7 @@ public static Command LoadCommand(Assembly assembly, string commandName)
return null;
}

private static Command CreateCommand(Type type, VerbAttribute verbAttribute)
private static Command CreateCommand(System.Reflection.TypeInfo type, VerbAttribute verbAttribute)
{
ImmutableArray<CommandArgument>.Builder arguments = ImmutableArray.CreateBuilder<CommandArgument>();
ImmutableArray<CommandOption>.Builder options = ImmutableArray.CreateBuilder<CommandOption>();
Expand Down
2 changes: 1 addition & 1 deletion src/CommandLine/docs/NetCore/NuGetReadme.md
Expand Up @@ -4,7 +4,7 @@

## Requirements

.NET Core SDK 5.0 or 6.0.
.NET Core SDK 6.0, 7.0 or 8.0.

## Installation

Expand Down
2 changes: 1 addition & 1 deletion tools/generate_cli_docs.ps1
Expand Up @@ -5,7 +5,7 @@ dotnet build "$PSScriptRoot/../src/CommandLine.DocumentationGenerator/CommandLin

if(!$?) { Read-Host; Exit }

& "$PSScriptRoot/../src/CommandLine.DocumentationGenerator/bin/Release/net7.0/Roslynator.CommandLine.DocumentationGenerator.exe" `
& "$PSScriptRoot/../src/CommandLine.DocumentationGenerator/bin/Release/net8.0/Roslynator.CommandLine.DocumentationGenerator.exe" `
build `
"$PSScriptRoot/../src/CommandLine.DocumentationGenerator/data" `
"help,migrate"
2 changes: 1 addition & 1 deletion tools/generate_ref_docs.ps1
Expand Up @@ -4,7 +4,7 @@ dotnet build generate_ref_docs.sln --no-restore -c Release -v minimal /m
dotnet restore "$PSScriptRoot/../src/CommandLine.sln" -v minimal /m
dotnet build "$PSScriptRoot/../src/CommandLine.sln" --no-restore -c Release -v minimal /m

& "$PSScriptRoot/../src/CommandLine/bin/Release/net7.0/Roslynator" generate-doc generate_ref_docs.sln `
& "$PSScriptRoot/../src/CommandLine/bin/Release/net8.0/Roslynator" generate-doc generate_ref_docs.sln `
--properties Configuration=Release `
-o "build/ref" `
--host docusaurus `
Expand Down
2 changes: 1 addition & 1 deletion tools/reinstall_cli.ps1
@@ -1,4 +1,4 @@
Remove-Item -Path "$PSScriptRoot/../src/CommandLine/bin/Release/net7.0" -Recurse
Remove-Item -Path "$PSScriptRoot/../src/CommandLine/bin/Release/net8.0" -Recurse
Remove-Item -Path "$PSScriptRoot/../src/CommandLine/bin/Release/Roslynator.DotNet.Cli.*.nupkg"

dotnet pack "$PSScriptRoot/../src/CommandLine/CommandLine.csproj" -c Release -v minimal /p:RoslynatorDotNetCli=true,Deterministic=true,TreatWarningsAsErrors=true,WarningsNotAsErrors="1591"
Expand Down
2 changes: 1 addition & 1 deletion tools/reinstall_cli_debug.ps1
@@ -1,4 +1,4 @@
Remove-Item -Path "$PSScriptRoot/../src/CommandLine/bin/Debug/net7.0" -Recurse
Remove-Item -Path "$PSScriptRoot/../src/CommandLine/bin/Debug/net8.0" -Recurse
Remove-Item -Path "$PSScriptRoot/../src/CommandLine/bin/Debug/Roslynator.DotNet.Cli.*.nupkg"

dotnet pack "$PSScriptRoot/../src/CommandLine/CommandLine.csproj" -c Debug -v minimal /p:RoslynatorDotNetCli=true,Deterministic=true
Expand Down

0 comments on commit 13c1810

Please sign in to comment.