Skip to content

Commit

Permalink
Build with .net8, version 1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamin-hodgson committed Nov 28, 2023
1 parent 76f23db commit fdc41d0
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"image": "mcr.microsoft.com/devcontainers/dotnet:0-7.0"
"image": "mcr.microsoft.com/devcontainers/dotnet:8.0"
}
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ jobs:
uses: benjamin-hodgson/BuildScripts/.github/workflows/dotnet.yml@main
with:
DOCS_FOLDER: Benjamin.Pizza.DocTest.Docs
NET8: true
secrets:
NUGET_KEY: ${{ secrets.NUGET_KEY }}
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio" />
<PackageReference Include="coverlet.collector" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Benjamin.Pizza.DocTest/Benjamin.Pizza.DocTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<IsPackable>true</IsPackable>
<IsTestProject>false</IsTestProject>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CA2007</NoWarn>
<!-- <NoWarn>$(NoWarn);CA2007</NoWarn> -->
</PropertyGroup>

<ItemGroup>
Expand Down
10 changes: 6 additions & 4 deletions Benjamin.Pizza.DocTest/DocTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public DocTest(string name, string code, Script preamble)
/// <returns>A task.</returns>
public async Task Run()
{
var (output, error) = await RedirectConsole(() => _script.RunAsync());
var (output, error) = await RedirectConsole(() => _script.RunAsync()).ConfigureAwait(false);
Assert.Equal("", error);
Assert.Equal(GetExpected(), SplitLines(output));
}
Expand All @@ -59,7 +59,7 @@ private IEnumerable<string> GetExpected()
.Select(line => _commentRegex.Replace(line, ""));
}

private static async Task<(string output, string error)> RedirectConsole(Func<Task> action)
private static async Task<(string Output, string Error)> RedirectConsole(Func<Task> action)
{
using var outBuffer = new StringWriter();
using var errBuffer = new StringWriter();
Expand All @@ -69,7 +69,7 @@ private IEnumerable<string> GetExpected()
Console.SetError(errBuffer);
try
{
await action();
await action().ConfigureAwait(false);
}
finally
{
Expand All @@ -80,6 +80,8 @@ private IEnumerable<string> GetExpected()
return (outBuffer.ToString(), errBuffer.ToString());
}

private static readonly string[] _newlines = { "\r\n", "\n" };

private static string[] SplitLines(string str)
=> str.Split(new[] { "\r\n", "\n" }, StringSplitOptions.None);
=> str.Split(_newlines, StringSplitOptions.None);
}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
v1.0.2
------

Building with .NET 8 SDK - better support for SourceLink.


v1.0.0
------

Expand Down
5 changes: 4 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<Project>

<PropertyGroup>
<Authors>benjamin.hodgson</Authors>
<Copyright>© Benjamin Hodgson, 2022</Copyright>
Expand All @@ -9,13 +10,15 @@
<RepositoryUrl>https://github.com/benjamin-hodgson/Benjamin.Pizza.DocTest.git</RepositoryUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>

<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<GenerateDocumentationFile>true</GenerateDocumentationFile>

<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)Benjamin.Pizza.DocTest.snk</AssemblyOriginatorKeyFile>

<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<UseArtifactsOutput>true</UseArtifactsOutput>
</PropertyGroup>

</Project>
18 changes: 9 additions & 9 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<Project>
<ItemGroup>
<PackageVersion Include="coverlet.collector" Version="3.1.2" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.2.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageVersion Include="xunit" Version="2.4.1" />
<PackageVersion Include="xunit.assert" Version="2.4.1" />
<PackageVersion Include="xunit.core" Version="2.4.1" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.4.3" />
<PackageVersion Include="coverlet.collector" Version="6.0.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.8.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageVersion Include="xunit" Version="2.6.2" />
<PackageVersion Include="xunit.assert" Version="2.6.2" />
<PackageVersion Include="xunit.core" Version="2.6.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.4" />
</ItemGroup>

<ItemGroup>
<GlobalPackageReference Include="Benjamin.Pizza.BuildScripts" Version="2.2.2" />
<GlobalPackageReference Include="Benjamin.Pizza.BuildScripts" Version="2.2.5" />
<GlobalPackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
<GlobalPackageReference Include="StyleCop.Analyzers" Version="1.1.118" />
<GlobalPackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.507" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"docfx": {
"version": "2.70.3",
"version": "2.73.2",
"commands": [
"docfx"
]
Expand Down
3 changes: 1 addition & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"sdk": {
"version": "7.0.100",
"rollForward": "latestMajor"
"version": "8.0.100"
},
"msbuild-sdks": {
"Microsoft.Build.NoTargets": "3.7.0"
Expand Down

0 comments on commit fdc41d0

Please sign in to comment.