Skip to content

Commit

Permalink
update to .NET 9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianoc committed Jan 11, 2025
1 parent 8415fcf commit 1cb432a
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cecilifier-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- run: dotnet tool install --global dotnet-ilverify --version 8.0.0
dotnet-version: '9.0.x'
- run: dotnet tool install --global dotnet-ilverify --version 9.0.0
- run: dotnet restore
- run: dotnet test --filter 'TestCategory !~ Issues' --collect:"XPlat Code Coverage"
- run: dotnet format style --verify-no-changes
Expand Down
2 changes: 1 addition & 1 deletion Cecilifier.Common.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<LangVersion>12</LangVersion>
<AssemblyVersion>2.16.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Expand Down
4 changes: 2 additions & 2 deletions Cecilifier.CommonPackages.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.12.0-1.final" />
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.12.0-1.final" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.12.0-3.final" />
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.12.0-3.final" />
<PackageReference Include="Mono.Cecil"><Version>0.11.6</Version></PackageReference>
</ItemGroup>
</Project>
6 changes: 4 additions & 2 deletions Cecilifier.Core.Tests/Cecilifier.Core.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
<Import Project="../Cecilifier.Common.props" />
<Import Project="../Cecilifier.CommonPackages.props" />
<ItemGroup>
<PackageReference Include="Basic.Reference.Assemblies.Net90" Version="1.7.9" />
<PackageReference Include="coverlet.collector" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.ILVerification" Version="9.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="NUnit" Version="4.2.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="NUnit3TestAdapter" Version="5.0.0-beta.5" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Cecilifier.Core\Cecilifier.Core.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ using System.Collections.Generic;

class GenericTypesAsMembers
{
public IList<int> field;
public IList<int> Property { get { return field; } set { field = value; } }
public IList<int> asField;
public IList<int> Property { get { return asField; } set { asField = value; } }

public IList<string> Method(IList<string> l)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
class RefProperties
{
private int field;
private int prop;
ref int Property
{
get => ref field;
get => ref prop;
}

public ref int UseRefProperty() => ref Property;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Cecilifier.Core.AST.MemberDependencies;

Check failure on line 7 in Cecilifier.Core.Tests/Tests/Unit/MemberDependencies/MemberDependencyTestBase.cs

View workflow job for this annotation

GitHub Actions / RunTests

The type or namespace name 'MemberDependencies' does not exist in the namespace 'Cecilifier.Core.AST' (are you missing an assembly reference?)
using Cecilifier.Core.Tests.Tests.Unit.Framework;

namespace Cecilifier.Core.Tests.Tests.Unit;

public class MemberDependencyTestBase
{
private protected IReadOnlyCollection<MemberDependency> CollectDependenciesFromSingleType(CSharpCompilation compilation)

Check failure on line 14 in Cecilifier.Core.Tests/Tests/Unit/MemberDependencies/MemberDependencyTestBase.cs

View workflow job for this annotation

GitHub Actions / RunTests

The type or namespace name 'MemberDependency' could not be found (are you missing a using directive or an assembly reference?)
{
var collector = new MemberDependencyCollector<MemberDependency>();

var typeUnderTest = compilation.SyntaxTrees[0].GetRoot().ChildNodes().OfType<TypeDeclarationSyntax>().Single();
var computedDependencies = collector.Process(typeUnderTest, compilation.GetSemanticModel(compilation.SyntaxTrees[0]));
return computedDependencies;
}

protected static CSharpCompilation CompilationFor(params string[] code)
{
var syntaxTrees = code.Select(source => CSharpSyntaxTree.ParseText(source));
var comp = CSharpCompilation.Create("Test", syntaxTrees, Basic.Reference.Assemblies.Net90.References.All, new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary));

var errors = comp.GetDiagnostics()
.Where(d => d.Severity == DiagnosticSeverity.Error)
.Select(d => d.GetMessage())
.ToArray();

if (errors.Any())
throw new ArgumentException($"Code has compilation errors:\n\t{string.Join("\n\t", errors)}");
return comp;
}

internal static string MemberNameFrom(MemberDependency dependency) => dependency.Declaration.MemberName();

Check failure on line 38 in Cecilifier.Core.Tests/Tests/Unit/MemberDependencies/MemberDependencyTestBase.cs

View workflow job for this annotation

GitHub Actions / RunTests

The type or namespace name 'MemberDependency' could not be found (are you missing a using directive or an assembly reference?)
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.9.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.9.2" PrivateAssets="all" />
<PackageReference Include="System.Reflection.Metadata" Version="8.0.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.12.0-3.final" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.12.0-3.final" PrivateAssets="all" />
<PackageReference Include="System.Reflection.Metadata" Version="9.0.0" PrivateAssets="all" />
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" PrivateAssets="all" />
</ItemGroup>

Expand Down
4 changes: 2 additions & 2 deletions Cecilifier.Web/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ public class Startup
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Mono.Cecil" Version="0.11.5" />
<PackageReference Include="Mono.Cecil" Version="0.11.6" />
<PackageReference Include="Cecilifier.TypeMapGenerator" Version="1.0.0" />
</ItemGroup>
</Project>
Expand Down

0 comments on commit 1cb432a

Please sign in to comment.