Skip to content

Commit

Permalink
added net9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Doraku committed Nov 15, 2024
1 parent 916c4c0 commit e4b218f
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 33 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/CodeCoverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:

- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
dotnet-version: '9.0.x'

- name: Collect coverage
run: dotnet test source -c Release -f net8.0
run: dotnet test source -c Release -f net9.0
env:
CollectCoverage: true
CoverletOutputFormat: lcov
Expand All @@ -30,4 +30,4 @@ jobs:
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: 'build\lcov.net8.0.info'
path-to-lcov: 'build\lcov.net9.0.info'
6 changes: 3 additions & 3 deletions .github/workflows/ContinuousIntegration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
dotnet-version: '9.0.x'
source-url: https://nuget.pkg.github.com/Doraku/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -30,8 +30,8 @@ jobs:
- name: Run tests net48
run: dotnet test source -c Release -f net48 --no-build

- name: Run tests net8.0
run: dotnet test source -c Release -f net8.0 --no-build
- name: Run tests net9.0
run: dotnet test source -c Release -f net9.0 --no-build

- name: Decrypte snk file
env:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/PullRequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
dotnet-version: '9.0.x'

- name: Build
run: dotnet build source -c Release -p:TreatWarningsAsErrors=true
Expand All @@ -24,5 +24,5 @@ jobs:
- name: Run tests net48
run: dotnet test source -c Release -f net48 --no-build

- name: Run tests net8.0
run: dotnet test source -c Release -f net8.0 --no-build
- name: Run tests net9.0
run: dotnet test source -c Release -f net9.0 --no-build
2 changes: 1 addition & 1 deletion .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
dotnet-version: '9.0.x'
source-url: https://api.nuget.org/v3/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY }}
Expand Down
1 change: 1 addition & 0 deletions documentation/NEXT_RELEASENOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- added net9.0
5 changes: 3 additions & 2 deletions source/DefaultUnDo.Test/DefaultUnDo.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<TargetFrameworks>
net462;
net48;
net8.0;
net9.0;
</TargetFrameworks>
<RootNamespace>DefaultUnDo</RootNamespace>

Expand All @@ -20,7 +20,8 @@
<PackageReference Include="NSubstitute" Version="5.3.0" />
<PackageReference Include="xunit" Version="2.9.2" />

<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" Condition="$(TargetFramework) != 'net8.0'" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />

<PackageReference Include="coverlet.msbuild" Version="6.0.2" PrivateAssets="all" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" PrivateAssets="all" />
Expand Down
9 changes: 0 additions & 9 deletions source/DefaultUnDo.Test/GroupUnDoTests/ConstructorShould.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,6 @@ namespace DefaultUnDo.GroupUnDoTests;

public sealed class ConstructorShould
{
[Fact]
public void ThrowArgumentNullExceptionWhenCommandsIsNull()
{
Check
.ThatCode(() => new GroupUnDo(default))
.Throws<ArgumentNullException>()
.WithProperty("ParamName", "commands");
}

[Fact]
public void ThrowArgumentNullExceptionWhenCommandsEmpty()
{
Expand Down
4 changes: 3 additions & 1 deletion source/DefaultUnDo/DefaultUnDo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
netstandard2.0;
netstandard2.1;
net8.0;
net9.0;
</TargetFrameworks>
<Nullable>enable</Nullable>

Expand All @@ -16,8 +17,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="DefaultDocumentation" Version="1.0.0-beta04" PrivateAssets="all" Condition="'$(Version)' != '0.0.0' AND '$(TargetFramework)' == 'net8.0'" />
<PackageReference Include="DefaultDocumentation" Version="1.0.0-beta04" PrivateAssets="all" Condition="'$(Version)' != '0.0.0' AND '$(TargetFramework)' == 'net9.0'" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
<PackageReference Include="System.Memory" Version="4.6.0" Condition="'$(TargetFramework)' == 'netstandard2.0'" />
</ItemGroup>

</Project>
17 changes: 7 additions & 10 deletions source/DefaultUnDo/GroupUnDo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,21 @@ public sealed class GroupUnDo : IMergeableUnDo
/// </summary>
/// <param name="description">The description of this <see cref="IUnDo"/></param>
/// <param name="commands">The sequence of <see cref="IUnDo"/> contained by the instance.</param>
/// <exception cref="ArgumentNullException"><paramref name="commands"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="commands"/> contains null elements.</exception>
public GroupUnDo(object? description, params IUnDo[] commands)
public GroupUnDo(object? description, params ReadOnlySpan<IUnDo> commands)
{
ArgumentNullException.ThrowIfNull(commands);

_description = description;
_commands = commands;

if (_commands.Length is 0)
if (commands.Length is 0)
{
throw new ArgumentException("IUnDo sequence contains no elements.", nameof(commands));
}

if (_commands.Any(i => i is null))
if (commands.Any(i => i is null))
{
throw new ArgumentException("IUnDo sequence contains null elements.", nameof(commands));
}

_description = description;
_commands = [.. commands];
}

/// <summary>
Expand All @@ -57,7 +54,7 @@ public GroupUnDo(object? description, params IUnDo[] commands)
/// <param name="commands">The sequence of <see cref="IUnDo"/> contained by the instance.</param>
/// <exception cref="ArgumentNullException"><paramref name="commands"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="commands"/> contains null elements.</exception>
public GroupUnDo(params IUnDo[] commands)
public GroupUnDo(params ReadOnlySpan<IUnDo> commands)
: this(null, commands)
{ }

Expand Down
17 changes: 17 additions & 0 deletions source/DefaultUnDo/Internal/Extensions/ReadOnlySpanExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace System;

internal static class ReadOnlySpanExtensions
{
public static bool Any<T>(this ReadOnlySpan<T> source, Predicate<T> predicate)
{
foreach (ref readonly T item in source)
{
if (predicate(item))
{
return true;
}
}

return false;
}
}
2 changes: 1 addition & 1 deletion source/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="DefaultCSharp" Version="1.0.0-test07" PrivateAssets="all" />
<PackageReference Include="DefaultCSharp" Version="1.0.0" PrivateAssets="all" />
</ItemGroup>

</Project>

0 comments on commit e4b218f

Please sign in to comment.