Skip to content

Commit

Permalink
Preparation for .NET 8 (#118)
Browse files Browse the repository at this point in the history
* Preparation for .NET 8

* Fixed CI
  • Loading branch information
gfoidl authored Apr 13, 2023
1 parent 401b965 commit 1d8c10d
Show file tree
Hide file tree
Showing 16 changed files with 70 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .azure/pipelines/jobs/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ jobs:
- job: build_test
displayName: build and test
pool:
vmImage: 'ubuntu-20.04'
vmImage: 'ubuntu-22.04'
strategy:
matrix:
debug-build:
Expand Down
2 changes: 1 addition & 1 deletion .azure/pipelines/jobs/build_and_test_vectors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ jobs:
- job: build_test
displayName: build and test
pool:
vmImage: 'ubuntu-20.04'
vmImage: 'ubuntu-22.04'
strategy:
matrix:
vectors-enabled:
Expand Down
2 changes: 1 addition & 1 deletion .azure/pipelines/jobs/coverage.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
jobs:
- job: coverage_report_quality
pool:
vmImage: 'ubuntu-20.04'
vmImage: 'ubuntu-22.04'
steps:
# checkout is needed for file-references
#- checkout: none
Expand Down
2 changes: 1 addition & 1 deletion .azure/pipelines/jobs/deploy_nuget.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
jobs:
- job: deploy_nuget
pool:
vmImage: 'ubuntu-20.04'
vmImage: 'ubuntu-22.04'
steps:
- checkout: none

Expand Down
2 changes: 1 addition & 1 deletion .azure/pipelines/jobs/e2e_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ jobs:
- job: e2e_tests
displayName: e2e tests
pool:
vmImage: 'ubuntu-20.04'
vmImage: 'ubuntu-22.04'
steps:
# ~Already installed on current hosted agents~
- template: steps/dotnet-install.yml
Expand Down
10 changes: 5 additions & 5 deletions .azure/pipelines/jobs/e2e_tests_all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ jobs:
- job: e2e_tests
displayName: e2e tests
pool:
vmImage: 'ubuntu-20.04'
vmImage: 'ubuntu-22.04'
strategy:
matrix:
net80:
dotnetVersion: '8.x'
TRX2JUNIT_VECTORS_ENABLED: true
net60:
dotnetVersion: '6.x'
TRX2JUNIT_VECTORS_ENABLED: true
net31:
dotnetVersion: '3.1.x'
steps:
- task: UseDotNet@2
inputs:
version: $(dotnetVersion)
installationPath: $(Agent.ToolsDirectory)/dotnet
includePreviewVersions: false
includePreviewVersions: true

- bash: |
sudo apt update
Expand Down
12 changes: 6 additions & 6 deletions .azure/pipelines/jobs/steps/dotnet-install.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
steps:
- task: UseDotNet@2
displayName: 'Use .NET SDK 7.0'
displayName: 'Use .NET SDK 8.0'
inputs:
version: 7.x
version: 8.x
installationPath: $(Agent.ToolsDirectory)/dotnet
includePreviewVersions: true

- task: UseDotNet@2
displayName: 'Use .NET SDK 6.0'
displayName: 'Use .NET SDK 7.0'
inputs:
version: 6.x
version: 7.x
installationPath: $(Agent.ToolsDirectory)/dotnet

- task: UseDotNet@2
displayName: 'Use .NET SDK 3.1'
displayName: 'Use .NET SDK 6.0'
inputs:
version: 3.1.x
version: 6.x
installationPath: $(Agent.ToolsDirectory)/dotnet
41 changes: 28 additions & 13 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ tab_width = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_auto_properties = true:silent
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_operator_placement_when_wrapping = beginning_of_line
dotnet_style_prefer_conditional_expression_over_return = true:silent

# C# files
[*.cs]
Expand Down Expand Up @@ -85,14 +95,14 @@ csharp_style_var_for_built_in_types = false
csharp_style_var_when_type_is_apparent = false

# Expression-bodied members
csharp_style_expression_bodied_accessors = true
csharp_style_expression_bodied_constructors = when_on_single_line
csharp_style_expression_bodied_indexers = when_on_single_line
csharp_style_expression_bodied_lambdas = true
csharp_style_expression_bodied_local_functions = true
csharp_style_expression_bodied_methods = when_on_single_line
csharp_style_expression_bodied_operators = when_on_single_line
csharp_style_expression_bodied_properties = when_on_single_line
csharp_style_expression_bodied_accessors = true:silent
csharp_style_expression_bodied_constructors = when_on_single_line:silent
csharp_style_expression_bodied_indexers = when_on_single_line:silent
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = true:silent
csharp_style_expression_bodied_methods = when_on_single_line:silent
csharp_style_expression_bodied_operators = when_on_single_line:silent
csharp_style_expression_bodied_properties = when_on_single_line:silent

# Pattern matching preferences
csharp_style_pattern_matching_over_as_with_null_check = true
Expand All @@ -109,9 +119,9 @@ csharp_prefer_static_local_function = true
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async

# Code-block preferences
csharp_prefer_braces = true
csharp_prefer_simple_using_statement = true
csharp_style_namespace_declarations = file_scoped
csharp_prefer_braces = true:silent
csharp_prefer_simple_using_statement = true:suggestion
csharp_style_namespace_declarations = file_scoped:silent

# Expression-level preferences
csharp_prefer_simple_default_expression = true
Expand All @@ -121,13 +131,13 @@ csharp_style_inlined_variable_declaration = true
csharp_style_pattern_local_over_anonymous_function = true
csharp_style_prefer_index_operator = true
csharp_style_prefer_null_check_over_type_check = true
csharp_style_prefer_range_operator = true
csharp_style_prefer_range_operator = false
csharp_style_throw_expression = true
csharp_style_unused_value_assignment_preference = discard_variable
csharp_style_unused_value_expression_statement_preference = discard_variable

# 'using' directive preferences
csharp_using_directive_placement = outside_namespace
csharp_using_directive_placement = outside_namespace:silent

# New line preferences
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false
Expand Down Expand Up @@ -280,3 +290,8 @@ dotnet_naming_style.camel_case.capitalization = camel_case

# RCS1090: Add call to 'ConfigureAwait' (or vice versa).
dotnet_diagnostic.RCS1090.severity = none
csharp_style_prefer_method_group_conversion = true:silent
csharp_style_prefer_top_level_statements = true:silent

# IDE0055: Fix formatting
dotnet_diagnostic.IDE0055.severity = silent
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
Expand Down Expand Up @@ -222,3 +222,4 @@ _Pvt_Extensions
/tests/*.playlist
/tests/Coverage
/tests/trx2junit.Tests/coverage.*.cobertura.xml
.artifacts
3 changes: 2 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
</PropertyGroup>

<PropertyGroup>
<LangVersion>10</LangVersion>
<LangVersion>preview</LangVersion>
<UseArtifactsOutput>true</UseArtifactsOutput>
</PropertyGroup>

<PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions samples/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
<Import Project="../Directory.Build.props" />

<PropertyGroup>
<SampleTfm>net7.0</SampleTfm>
<SampleTfm>net8.0</SampleTfm>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
</ItemGroup>

</Project>
6 changes: 6 additions & 0 deletions source/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
<PublishRepositoryUrl>true</PublishRepositoryUrl>
</PropertyGroup>

<PropertyGroup Label="Trim analyzers" Condition="'$(TargetFramework)' == 'net8.0'">
<EnableSingleFileAnalyzer>true</EnableSingleFileAnalyzer>
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
<EnableAotAnalyzer>true</EnableAotAnalyzer>
</PropertyGroup>

<PropertyGroup Condition="'$(TF_BUILD)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion source/trx2junit.Core/Internal/TypeInfoHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace gfoidl.Trx2Junit.Core;

internal static class TypeInfoHelper
{
[return: NotNullIfNotNull("name")]
[return: NotNullIfNotNull(nameof(name))]
public static string? StripTypeInfo(this string? name)
{
if (name is null) return null;
Expand Down
6 changes: 5 additions & 1 deletion source/trx2junit.Core/trx2junit.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net7.0;net6.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net8.0;net6.0;netstandard2.1</TargetFrameworks>
<RootNamespace>gfoidl.Trx2Junit.Core</RootNamespace>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net8.0'">
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>

<ItemGroup>
<Compile Update="Resources\Strings.Designer.cs">
<DesignTime>True</DesignTime>
Expand Down
6 changes: 5 additions & 1 deletion source/trx2junit/trx2junit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net7.0;net6.0;net5.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<PackAsTool>true</PackAsTool>
<RollForward>Major</RollForward>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net8.0'">
<!--<PublishAot>true</PublishAot>-->
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\trx2junit.Core\trx2junit.Core.csproj" />
</ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions tests/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="../Directory.Build.props" />

<PropertyGroup>
<TestTfm>net7.0;net6.0;netcoreapp3.1</TestTfm>
<TestTfm>net8.0;net7.0;net6.0</TestTfm>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand All @@ -12,9 +12,9 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.3.0">
<PackageReference Include="NUnit3TestAdapter" Version="4.4.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down

0 comments on commit 1d8c10d

Please sign in to comment.