Skip to content

Commit

Permalink
Upgrade packages
Browse files Browse the repository at this point in the history
* latest dependencies
* target net472 consistently for test projects
* remove unnecessary dotnet-xunit reference
* remove unused usings in test projects
* ensure GitHubActionsTestLogger is in use
  • Loading branch information
lahma committed Aug 2, 2024
1 parent 9bf8f69 commit 91f1211
Show file tree
Hide file tree
Showing 74 changed files with 49 additions and 138 deletions.
28 changes: 13 additions & 15 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,25 @@
<CentralPackageTransitivePinningEnabled>false</CentralPackageTransitivePinningEnabled>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="BenchmarkDotNet" Version="0.13.9" />
<PackageVersion Include="Fluid.Core" Version="2.9.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.2" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.0.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageVersion Include="BenchmarkDotNet" Version="0.13.12" />
<PackageVersion Include="Fluid.Core" Version="2.11.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.10.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageVersion Include="Namotion.Reflection" Version="3.1.1" />
<PackageVersion Include="NBench" Version="2.0.1" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="NodaTime" Version="3.1.9" />
<PackageVersion Include="NSwag.Core.Yaml" Version="14.0.0-preview011" />
<PackageVersion Include="NodaTime" Version="3.1.11" />
<PackageVersion Include="NSwag.Core.Yaml" Version="14.0.0" />
<PackageVersion Include="Pro.NBench.xUnit" Version="2.0.0" />
<PackageVersion Include="System.ComponentModel.Annotations" Version="4.4.0" />
<PackageVersion Include="System.Text.Json" Version="4.7.2" />
<PackageVersion Include="Verify.XUnit" Version="14.7.0" />
<PackageVersion Include="xunit" Version="2.8.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.0" />
<PackageVersion Include="YamlDotNet" Version="15.1.4" />
<PackageVersion Include="System.Text.Json" Version="8.0.4" />
<PackageVersion Include="Verify.XUnit" Version="26.1.6" />
<PackageVersion Include="xunit" Version="2.9.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
<PackageVersion Include="YamlDotNet" Version="16.0.0" />
</ItemGroup>
<ItemGroup>
<GlobalPackageReference Include="GitHubActionsTestLogger" Version="2.3.3" />
<GlobalPackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<GlobalPackageReference Include="GitHubActionsTestLogger" Version="2.4.1" />
<GlobalPackageReference Include="PolySharp" Version="1.14.1" />
</ItemGroup>
</Project>
2 changes: 2 additions & 0 deletions build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Xml.Linq;
using Nuke.Common;
using Nuke.Common.CI;
using Nuke.Common.CI.GitHubActions;
using Nuke.Common.Git;
using Nuke.Common.IO;
using Nuke.Common.ProjectModel;
Expand Down Expand Up @@ -136,6 +137,7 @@ protected override void OnBuildInitialized()
.SetConfiguration(Configuration)
.EnableNoRestore()
.SetFramework(framework)
.When(GitHubActions.Instance is not null, x => x.SetLoggers("GitHubActions"))
);
});

Expand Down
10 changes: 1 addition & 9 deletions src/NJsonSchema.Benchmark/JsonInheritanceConverterBenchmarks.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using System.Diagnostics;
using NBench;
using NBench;
using NJsonSchema.Tests.Generation;
using Pro.NBench.xUnit.XunitExtensions;
using Xunit.Abstractions;

namespace NJsonSchema.Benchmark
{
Expand All @@ -11,12 +9,6 @@ public class JsonInheritanceConverterBenchmarks
private Counter _counter;
private JsonInheritanceConverterTests _tests;

public JsonInheritanceConverterBenchmarks(ITestOutputHelper output)
{
Trace.Listeners.Clear();
Trace.Listeners.Add(new XunitTraceListener(output));
}

[PerfSetup]
public void Setup(BenchmarkContext context)
{
Expand Down
4 changes: 0 additions & 4 deletions src/NJsonSchema.Benchmark/NJsonSchema.Benchmark.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
<PackageReference Include="xunit.runner.visualstudio" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\NJsonSchema.CodeGeneration.CSharp\NJsonSchema.CodeGeneration.CSharp.csproj" />
<ProjectReference Include="..\NJsonSchema.CodeGeneration.TypeScript\NJsonSchema.CodeGeneration.TypeScript.csproj" />
Expand Down
8 changes: 0 additions & 8 deletions src/NJsonSchema.Benchmark/SchemaGenerationBenchmarks.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
using System;
using System.Diagnostics;
using System.Runtime.Serialization;
using NBench;
using NJsonSchema.NewtonsoftJson.Generation;
using Pro.NBench.xUnit.XunitExtensions;
using Xunit.Abstractions;

namespace NJsonSchema.Benchmark
{
public class SchemaGenerationBenchmarks
{
private Counter _counter;

public SchemaGenerationBenchmarks(ITestOutputHelper output)
{
Trace.Listeners.Clear();
Trace.Listeners.Add(new XunitTraceListener(output));
}

[PerfSetup]
public void Setup(BenchmarkContext context)
{
Expand Down
10 changes: 1 addition & 9 deletions src/NJsonSchema.Benchmark/SerializationBenchmarks.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using System.Diagnostics;
using System.IO;
using System.IO;
using System.Reflection;
using NBench;
using Pro.NBench.xUnit.XunitExtensions;
using Xunit;
using Xunit.Abstractions;

[assembly: CollectionBehavior(DisableTestParallelization = true)]

Expand All @@ -16,12 +14,6 @@ public class SerializationBenchmarks
private Counter _counter;
private string _json;

public SerializationBenchmarks(ITestOutputHelper output)
{
Trace.Listeners.Clear();
Trace.Listeners.Add(new XunitTraceListener(output));
}

[PerfSetup]
public void Setup(BenchmarkContext context)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using NJsonSchema.CodeGeneration.CSharp;
using NJsonSchema.Generation;
using NJsonSchema.NewtonsoftJson.Generation;
using Xunit;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using Xunit;
using Xunit;

namespace NJsonSchema.CodeGeneration.CSharp.Tests
{
Expand Down
1 change: 0 additions & 1 deletion src/NJsonSchema.CodeGeneration.CSharp.Tests/EnumTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using NJsonSchema.CodeGeneration.CSharp;
using NJsonSchema.Generation;
using NJsonSchema.NewtonsoftJson.Generation;
using System.Collections.Generic;
using System.Threading.Tasks;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using NJsonSchema.Annotations;
using NJsonSchema.Generation;
using NJsonSchema.NewtonsoftJson.Generation;
using Xunit;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Threading.Tasks;
using Newtonsoft.Json;
using NJsonSchema.CodeGeneration.CSharp;
using NJsonSchema.Generation;
using NJsonSchema.NewtonsoftJson.Converters;
using NJsonSchema.NewtonsoftJson.Generation;
using Xunit;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Threading.Tasks;
using NJsonSchema.Generation;
using NJsonSchema.NewtonsoftJson.Generation;
using Xunit;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Condition="'$(TargetFramework)' == 'net8.0'" />
<PackageReference Condition="'$(TargetFramework)' == 'net8.0'" Include="System.ComponentModel.Annotations" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using NJsonSchema.CodeGeneration.CSharp;
using NJsonSchema.Generation;
using NJsonSchema.NewtonsoftJson.Generation;
using Xunit;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using NJsonSchema.CodeGeneration.CSharp;
using NJsonSchema.Generation;
using NJsonSchema.NewtonsoftJson.Generation;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using NJsonSchema.CodeGeneration.CSharp;
using NJsonSchema.Generation;
using NJsonSchema.NewtonsoftJson.Generation;
using Xunit;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using NJsonSchema.Generation;
using NJsonSchema.NewtonsoftJson.Generation;
using Xunit;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.ComponentModel;
using System.Threading.Tasks;
using NJsonSchema.CodeGeneration.CSharp;
using NJsonSchema.Generation;
using NJsonSchema.NewtonsoftJson.Generation;
using Xunit;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using NJsonSchema.Annotations;
using NJsonSchema.CodeGeneration.CSharp;
using NJsonSchema.CodeGeneration.CSharp;
using NJsonSchema.CodeGeneration.TypeScript;
using Xunit;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using Newtonsoft.Json.Converters;
using NJsonSchema.CodeGeneration.CSharp;
using NJsonSchema.CodeGeneration.TypeScript;
using NJsonSchema.Generation;
using NJsonSchema.NewtonsoftJson.Generation;
using Xunit;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;net462</TargetFrameworks>
<TargetFrameworks>net8.0;net472</TargetFrameworks>
<IsPackable>false</IsPackable>
<NoWarn>$(NoWarn),1998,1591,618</NoWarn>
<Nullable>disable</Nullable>
<EnableNETAnalyzers>false</EnableNETAnalyzers>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Condition="'$(TargetFramework)' == 'net462'" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Condition="'$(TargetFramework)' == 'net8.0'" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio" />
</ItemGroup>

<ItemGroup>
<Reference Condition="'$(TargetFramework)' == 'net462'" Include="System.ComponentModel.DataAnnotations" />
</ItemGroup>

<ItemGroup>
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
<Reference Condition="'$(TargetFramework)' == 'net472'" Include="System.ComponentModel.DataAnnotations" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Newtonsoft.Json;
using NJsonSchema.Generation;
using NJsonSchema.NewtonsoftJson.Converters;
using NJsonSchema.NewtonsoftJson.Generation;
using System;
Expand All @@ -8,14 +7,12 @@
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using System.Threading.Tasks;
using VerifyXunit;
using Xunit;

using static NJsonSchema.CodeGeneration.TypeScript.Tests.VerifyHelper;

namespace NJsonSchema.CodeGeneration.TypeScript.Tests
{
[UsesVerify]
public class ClassGenerationTests
{
public class MyClassTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Runtime.Serialization;
using System.Threading.Tasks;
using Newtonsoft.Json;
using NJsonSchema.Generation;
using NJsonSchema.NewtonsoftJson.Converters;
using NJsonSchema.NewtonsoftJson.Generation;
using Xunit;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Threading.Tasks;
using NJsonSchema.CodeGeneration.TypeScript;
using Xunit;

namespace NJsonSchema.CodeGeneration.TypeScript.Tests
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Threading.Tasks;
using NJsonSchema.CodeGeneration.TypeScript;
using NJsonSchema.NewtonsoftJson.Generation;
using Xunit;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using NJsonSchema.Generation;
using NJsonSchema.Infrastructure;
using NJsonSchema.NewtonsoftJson.Converters;
using NJsonSchema.NewtonsoftJson.Generation;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;net462</TargetFrameworks>
<TargetFrameworks>net8.0;net472</TargetFrameworks>
<IsPackable>false</IsPackable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn),1587,1998,1591,618</NoWarn>
Expand All @@ -19,7 +19,7 @@
</ItemGroup>

<ItemGroup>
<Reference Condition="'$(TargetFramework)' == 'net462'" Include="System.ComponentModel.DataAnnotations" />
<Reference Condition="'$(TargetFramework)' == 'net472'" Include="System.ComponentModel.DataAnnotations" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
using System.Threading.Tasks;
using NJsonSchema.Annotations;
using NJsonSchema.NewtonsoftJson.Generation;
using VerifyXunit;
using Xunit;

using static NJsonSchema.CodeGeneration.TypeScript.Tests.VerifyHelper;

namespace NJsonSchema.CodeGeneration.TypeScript.Tests;

[UsesVerify]
public class PropertyNameTests
{
private class TypeWithRestrictedProperties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@
using Xunit;
using NJsonSchema.NewtonsoftJson.Converters;
using NJsonSchema.NewtonsoftJson.Generation;
using VerifyXunit;
using Newtonsoft.Json.Converters;

namespace NJsonSchema.CodeGeneration.TypeScript.Tests
{
[UsesVerify]
public class TypeScriptDiscriminatorTests
{
[JsonConverter(typeof(JsonInheritanceConverter), nameof(Type))]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Collections.Generic;
using NJsonSchema.CodeGeneration.TypeScript.Tests.Models;
using NJsonSchema.CodeGeneration.TypeScript.Tests.Models;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
Expand Down
2 changes: 1 addition & 1 deletion src/NJsonSchema.CodeGeneration/DefaultTemplateFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ public LiquidParser()
}

private static ValueTask<Completion> RenderTemplate(
List<Expression> arguments,
IReadOnlyList<Expression> arguments,
TextWriter writer,
TextEncoder encoder,
TemplateContext context)
Expand Down
Loading

0 comments on commit 91f1211

Please sign in to comment.