Skip to content

Commit

Permalink
Convert to CPM and add support for net9.0 TFM
Browse files Browse the repository at this point in the history
  • Loading branch information
RussKie committed Sep 17, 2024
1 parent 5d27bb4 commit 879fbd9
Show file tree
Hide file tree
Showing 11 changed files with 155 additions and 117 deletions.
19 changes: 13 additions & 6 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
# Remove the line below if you want to inherit .editorconfig settings from higher directories
root = true

# C# files
[*.cs]

#### Core EditorConfig Options ####
[*]

# Indentation and spacing
indent_size = 4
indent_style = space
tab_width = 4
insert_final_newline = true
trim_trailing_whitespace = true

[*.{appxmanifest,axml,build,config,proj,csproj,dbml,discomap,dtd,json,jsproj,lsproj,njsproj,nuspec,proj,props,resjson,resw,resx,StyleCop,targets,tasks,vbproj,yml,xml,xsd}]
indent_style = space
indent_size = 2
tab_width = 2

# C# files
[*.cs]

#### Core EditorConfig Options ####

# New line preferences
end_of_line = crlf
insert_final_newline = false

#### .NET Coding Conventions ####

Expand Down
18 changes: 7 additions & 11 deletions src/CSnakes.Runtime.Tests/CSnakes.Runtime.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PackageReference Include="coverlet.collector">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="python" Version="$(PythonVersion)" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="python" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="MartinCostello.Logging.XUnit" Version="0.4.0" />
<PackageReference Include="MartinCostello.Logging.XUnit" />
</ItemGroup>

<ItemGroup>
Expand Down
40 changes: 18 additions & 22 deletions src/CSnakes.Runtime/CSnakes.Runtime.csproj
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" />
<PackageReference Include="Microsoft.SourceLink.GitHub">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Text.Json" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Text.Json" Version="8.0.4" />
</ItemGroup>
<PropertyGroup>
<PackageId>CSnakes.Runtime</PackageId>
<Title>CSnakes Runtime</Title>
</PropertyGroup>

<PropertyGroup>
<PackageId>CSnakes.Runtime</PackageId>
<Title>CSnakes Runtime</Title>
</PropertyGroup>

<PropertyGroup>
<GeneratePackageOnBuild>$(EnableLocalPackaging)</GeneratePackageOnBuild>
<PackageOutputPath>../../nuget</PackageOutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup>
<GeneratePackageOnBuild>$(EnableLocalPackaging)</GeneratePackageOnBuild>
<PackageOutputPath>../../nuget</PackageOutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

</Project>
14 changes: 7 additions & 7 deletions src/CSnakes.Tests/CSnakes.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<IsPackable>false</IsPackable>
Expand All @@ -7,12 +7,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
<PackageReference Include="xunit" Version="2.5.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" />
<PackageReference Include="coverlet.collector" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="System.Net.Http" />
<PackageReference Include="System.Text.RegularExpressions" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio" />
</ItemGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/CSnakes.sln
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{24D80700-8F01-41C7-B858-2C1B242C4EE0}"
ProjectSection(SolutionItems) = preProject
Directory.Build.props = Directory.Build.props
Directory.Packages.props = Directory.Packages.props
..\README.md = ..\README.md
EndProjectSection
EndProject
Expand Down
92 changes: 46 additions & 46 deletions src/CSnakes/CSnakes.csproj
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
<NoWarn>RS1035</NoWarn>
</PropertyGroup>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
<NoWarn>RS1035</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.9.2" />
<PackageReference Include="Superpower" Version="3.0.0">
<GeneratePathProperty>true</GeneratePathProperty>
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive; compile</IncludeAssets>
</PackageReference>
<None Include="$(OutputPath)\$(AssemblyName).dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
<None Include="..\..\LICENSE">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
<None Include="$(PKGSuperpower)\lib\netstandard2.0\Superpower.dll" CopyToOutputDirectory="PreserveNewest">
<Pack>True</Pack>
<PackagePath>analyzers/dotnet/cs</PackagePath>
</None>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" />
<PackageReference Include="Superpower">
<GeneratePathProperty>true</GeneratePathProperty>
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive; compile</IncludeAssets>
</PackageReference>
<None Include="$(OutputPath)\$(AssemblyName).dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
<None Include="..\..\LICENSE">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
<None Include="$(PKGSuperpower)\lib\netstandard2.0\Superpower.dll" CopyToOutputDirectory="PreserveNewest">
<Pack>True</Pack>
<PackagePath>analyzers/dotnet/cs</PackagePath>
</None>

<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<PropertyGroup>
<GetTargetPathDependsOn>$(GetTargetPathDependsOn);GetDependencyTargetPaths</GetTargetPathDependsOn>
<PackageId>CSnakes</PackageId>
<Title>CSnakes</Title>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
</PropertyGroup>
<PropertyGroup>
<GetTargetPathDependsOn>$(GetTargetPathDependsOn);GetDependencyTargetPaths</GetTargetPathDependsOn>
<PackageId>CSnakes</PackageId>
<Title>CSnakes</Title>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
</PropertyGroup>

<Target Name="GetDependencyTargetPaths">
<ItemGroup>
<TargetPathWithTargetPlatformMoniker Include="$(PKGSuperpower)\lib\netstandard2.0\Superpower.dll" IncludeRuntimeDependency="false" />
</ItemGroup>
</Target>
<Target Name="GetDependencyTargetPaths">
<ItemGroup>
<TargetPathWithTargetPlatformMoniker Include="$(PKGSuperpower)\lib\netstandard2.0\Superpower.dll" IncludeRuntimeDependency="false" />
</ItemGroup>
</Target>

<PropertyGroup>
<GeneratePackageOnBuild>$(EnableLocalPackaging)</GeneratePackageOnBuild>
<PackageOutputPath>../../nuget</PackageOutputPath>
</PropertyGroup>
<PropertyGroup>
<GeneratePackageOnBuild>$(EnableLocalPackaging)</GeneratePackageOnBuild>
<PackageOutputPath>../../nuget</PackageOutputPath>
</PropertyGroup>
</Project>
8 changes: 1 addition & 7 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
<Project>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>latest</LangVersion>
<WarningsAsErrors>true</WarningsAsErrors>
</PropertyGroup>

<PropertyGroup>
<PythonVersion>3.12.4</PythonVersion>
<!-- See https://github.com/tonybaloney/CSnakes/issues/154#issuecomment-2352116849 -->
<PythonVersion Condition=" '$(PYTHON_VERSION)' != '' ">$(PYTHON_VERSION.Replace('alpha.','a').Replace('beta.','b').Replace('rc.','rc'))</PythonVersion>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\docs\res\logo.jpeg">
<Pack>True</Pack>
Expand Down
47 changes: 47 additions & 0 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>

<PropertyGroup>
<PythonVersion>3.12.4</PythonVersion>
<!-- See https://github.com/tonybaloney/CSnakes/issues/154#issuecomment-2352116849 -->
<PythonVersion Condition=" '$(PYTHON_VERSION)' != '' ">$(PYTHON_VERSION.Replace('alpha.','a').Replace('beta.','b').Replace('rc.','rc'))</PythonVersion>
</PropertyGroup>

<!--
Runtime dependencies
-->
<ItemGroup>
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.9.2" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageVersion Include="Superpower" Version="3.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageVersion Include="System.Text.Json" Version="8.0.4" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="9.0.0-rc.1.24431.7" />
<PackageVersion Include="System.Text.Json" Version="9.0.0-rc.1.24431.7" />
</ItemGroup>

<!--
Test-only dependencies
-->
<ItemGroup>
<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
<PackageVersion Include="MartinCostello.Logging.XUnit" Version="0.4.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageVersion Include="Microsoft.VisualStudio.DiagnosticsHub.BenchmarkDotNetDiagnosers" Version="17.12.35209.2" />
<PackageVersion Include="python" Version="$(PythonVersion)" />
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
<PackageVersion Include="System.Text.RegularExpressions" Version="4.3.1" />
<PackageVersion Include="xunit" Version="2.9.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
</ItemGroup>
</Project>
6 changes: 3 additions & 3 deletions src/Integration.Tests/GeneratorTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
namespace Integration.Tests;
public class GeneratorTests: IntegrationTestBase
public class GeneratorTests : IntegrationTestBase
{
[Fact]
public void TestGenerator()
Expand All @@ -10,7 +10,7 @@ public void TestGenerator()
Assert.True(generator.MoveNext());
Assert.Equal("Item 0", generator.Current);
Assert.Equal("Received 10", generator.Send(10));
Assert.Equal(["Item 1", "Item 2"], generator.ToArray());
Assert.Equal<string[]>(["Item 1", "Item 2"], generator.ToArray());
}

[Fact]
Expand All @@ -19,6 +19,6 @@ public void TestNormalGenerator()
// Test the most likely scenario of TSend and TReturn being None
var mod = Env.TestGenerators();
var generator = mod.TestNormalGenerator();
Assert.Equal(["one", "two"], generator.ToArray());
Assert.Equal<string[]>(["one", "two"], generator.ToArray());
}
}
16 changes: 8 additions & 8 deletions src/Integration.Tests/Integration.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
<PackageReference Include="xunit" Version="2.5.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" />
<PackageReference Include="python" Version="$(PythonVersion)" />
<PackageReference Include="MartinCostello.Logging.XUnit" Version="0.4.0" />
<PackageReference Include="coverlet.collector" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="System.Net.Http" />
<PackageReference Include="System.Text.RegularExpressions" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio" />
<PackageReference Include="python" />
<PackageReference Include="MartinCostello.Logging.XUnit" />
</ItemGroup>

<ItemGroup>
Expand Down
11 changes: 4 additions & 7 deletions src/Profile/Profile.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
Expand All @@ -18,9 +15,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.14.0" />
<PackageReference Include="Microsoft.VisualStudio.DiagnosticsHub.BenchmarkDotNetDiagnosers" Version="17.12.35209.2" />
<PackageReference Include="python" Version="$(PythonVersion)" />
<PackageReference Include="BenchmarkDotNet" />
<PackageReference Include="Microsoft.VisualStudio.DiagnosticsHub.BenchmarkDotNetDiagnosers" />
<PackageReference Include="python" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 879fbd9

Please sign in to comment.