Skip to content

Commit

Permalink
Upgrade to .NET 9 (#35)
Browse files Browse the repository at this point in the history
* Update `.gitignore`

* Fix `.globalconfig`

* Upgrade to .NET 9

* Cleanup namespaces and remove generated files from System.Text.Json

* Update .yml to use .NET 9
  • Loading branch information
lithiumtoast authored Dec 12, 2024
1 parent b00c09a commit 9c5c570
Show file tree
Hide file tree
Showing 265 changed files with 1,896 additions and 11,701 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: "Setup .NET"
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'
dotnet-version: '9.x'

- name: "Test .NET extract"
run: |
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
- name: "Setup .NET"
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'
dotnet-version: '9.x'

- name: "Download generated FFI files: windows"
uses: actions/download-artifact@v4
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ obj/
src/c/tests/**/ffi/*.json
src/c/tests/**/ffi-x/*.json

# macOS
.DS_Store

# Native library files
lib/*.*
10 changes: 10 additions & 0 deletions src/cs/Analyzers.globalconfig → src/cs/.globalconfig
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/configuration-files#global-analyzerconfig
is_global = true
global_level = 100

# Microsoft
dotnet_diagnostic.IDE0008.severity = none
dotnet_diagnostic.IDE0041.severity = none
dotnet_diagnostic.IDE0046.severity = none
dotnet_diagnostic.IDE0055.severity = none
dotnet_diagnostic.IDE0160.severity = none
dotnet_diagnostic.IDE0161.severity = error
dotnet_diagnostic.IDE0301.severity = none
dotnet_diagnostic.CA1308.severity = none
dotnet_diagnostic.CA1515.severity = none
dotnet_diagnostic.CA1707.severity = error
dotnet_diagnostic.CA1812.severity = none

# StyleCop
dotnet_diagnostic.SA1300.severity = none
Expand Down
16 changes: 4 additions & 12 deletions src/cs/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,33 +1,25 @@
<Project>

<!-- Change output folder -->
<!-- Use and change artifacts folder -->
<PropertyGroup>
<UseArtifactsOutput>true</UseArtifactsOutput>
<ArtifactsPath>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory),.gitignore))/artifacts</ArtifactsPath>
</PropertyGroup>

<!-- Show generated files -->
<PropertyGroup>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<CompilerGeneratedFilesOutputPath>Generated</CompilerGeneratedFilesOutputPath>
</PropertyGroup>

<!-- bottlenoselabs.MSBuildExtensions -->
<PropertyGroup>
<IsEnabledAnalyzers>true</IsEnabledAnalyzers>
<IsEnabledAnalyzersStyleCop>true</IsEnabledAnalyzersStyleCop>
<StyleCopSettingsFilePath>$(MSBuildThisFileDirectory)StyleCop.json</StyleCopSettingsFilePath>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="bottlenoselabs.Common.Tools" Version="*-*">
<PackageReference Include="bottlenoselabs.MSBuild.Extensions" Version="*">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="StyleCop.Analyzers.Unstable" Version="1.2.0.507">
<PackageReference Include="StyleCop.Analyzers.Unstable" Version="*">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<GlobalAnalyzerConfigFiles Include="$(MSBuildThisFileDirectory)Analyzers.globalconfig" Link="Properties/Analyzers.globalconfig" />
</ItemGroup>

</Project>
6 changes: 0 additions & 6 deletions src/cs/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,4 @@
</None>
</ItemGroup>

<!-- Do not include generated files as part of compilation -->
<ItemGroup>
<Compile Remove="$(CompilerGeneratedFilesOutputPath)/**/*.cs" />
<None Include="$(CompilerGeneratedFilesOutputPath)/**/*.cs" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions src/cs/production/c2ffi.Data/CLocation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public record struct CLocation : IComparable<CLocation>
/// </summary>
/// <param name="other">The other <see cref="CLocation" />.</param>
/// <returns>A <see cref="int" />.</returns>
public int CompareTo(CLocation other)
public readonly int CompareTo(CLocation other)
{
var result = string.Compare(FileName, other.FileName, StringComparison.Ordinal);
if (result != 0)
Expand All @@ -75,7 +75,7 @@ public int CompareTo(CLocation other)
}

/// <inheritdoc />
public override string ToString()
public override readonly string ToString()
{
if (LineNumber == 0 && LineColumn == 0)
{
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 9c5c570

Please sign in to comment.