Skip to content

Commit

Permalink
Migrate to NET8
Browse files Browse the repository at this point in the history
  • Loading branch information
sungam3r committed Dec 11, 2023
1 parent dc060d1 commit 1b18367
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x
source-url: https://nuget.pkg.github.com/graphql-dotnet/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x
source-url: https://api.nuget.org/v3/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.NUGET_AUTH_TOKEN}}
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,10 @@ jobs:
3.1.x
6.0.x
7.0.x
8.0.x
source-url: https://nuget.pkg.github.com/graphql-dotnet/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Disable MSVS Nuget Source # see https://github.com/graphql-dotnet/graphql-dotnet/issues/2422
if: ${{ startsWith(matrix.os, 'windows') }}
run: dotnet nuget disable source 'Microsoft Visual Studio Offline Packages'
- name: Install dependencies
working-directory: src
run: dotnet restore
Expand All @@ -73,7 +71,7 @@ jobs:
if: ${{ startsWith(matrix.os, 'ubuntu') }}
uses: codecov/codecov-action@v3
with:
files: .coverage/GraphQLParser.Tests/coverage.net5.opencover.xml
files: .coverage/GraphQLParser.Tests/coverage.net8.opencover.xml

buildcheck:
needs:
Expand Down
2 changes: 1 addition & 1 deletion src/GraphQLParser.ApiTests/ApiApprovalTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void Public_Api_Should_Not_Change_Inadvertently(Type type)
{
IncludeAssemblyAttributes = false,
//WhitelistedNamespacePrefixes = new[] { "Microsoft.Extensions.DependencyInjection" },
ExcludeAttributes = new[] { "System.Diagnostics.DebuggerDisplayAttribute", "System.Diagnostics.CodeAnalysis.AllowNullAttribute" }
ExcludeAttributes = ["System.Diagnostics.DebuggerDisplayAttribute", "System.Diagnostics.CodeAnalysis.AllowNullAttribute"]
}))).ToArray();

if (publicApi.DistinctBy(item => item.content).Count() == 1)
Expand Down
2 changes: 1 addition & 1 deletion src/GraphQLParser.ApiTests/GraphQLParser.ApiTests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7</TargetFramework>
<TargetFramework>net8</TargetFramework>
<NoWarn>$(NoWarn);1591</NoWarn>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7</TargetFramework>
<TargetFramework>net8</TargetFramework>
<OutputType>Exe</OutputType>
<IsPackable>false</IsPackable>
<NoWarn>$(NoWarn);1591</NoWarn>
Expand Down
2 changes: 1 addition & 1 deletion src/GraphQLParser.Tests/GraphQLParser.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</PropertyGroup>

<PropertyGroup Condition="'$(SingleTestPlatform)' != 'true'">
<TargetFrameworks>netcoreapp3.1;net6;net7</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net6;net7;net8</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>
</PropertyGroup>

Expand Down
16 changes: 8 additions & 8 deletions src/GraphQLParser.Tests/NodeHelperTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ public void NodeHelper_Should_Return_Proper_Nodes_1()
foreach (var method in typeof(NodeHelper).GetMethods().Where(m => m.IsStatic))
{
var node = method.GetParameters().Length == 1
? (ASTNode)method.Invoke(null, new object[] { IgnoreOptions.None })
: (ASTNode)method.Invoke(null, new object[] { IgnoreOptions.None, Activator.CreateInstance(method.GetParameters()[1].ParameterType) });
? (ASTNode)method.Invoke(null, [IgnoreOptions.None])
: (ASTNode)method.Invoke(null, [IgnoreOptions.None, Activator.CreateInstance(method.GetParameters()[1].ParameterType)]);

node.Comments = new List<GraphQLComment> { new GraphQLComment("abcdef") };
if (node is not GraphQLComment &&
Expand All @@ -29,8 +29,8 @@ public void NodeHelper_Should_Return_Proper_Nodes_2()
foreach (var method in typeof(NodeHelper).GetMethods().Where(m => m.IsStatic))
{
var node = method.GetParameters().Length == 1
? (ASTNode)method.Invoke(null, new object[] { IgnoreOptions.Comments })
: (ASTNode)method.Invoke(null, new object[] { IgnoreOptions.Comments, Activator.CreateInstance(method.GetParameters()[1].ParameterType) });
? (ASTNode)method.Invoke(null, [IgnoreOptions.Comments])
: (ASTNode)method.Invoke(null, [IgnoreOptions.Comments, Activator.CreateInstance(method.GetParameters()[1].ParameterType)]);

node.Comments = new List<GraphQLComment> { new GraphQLComment("abcdef") };
node.Comment.ShouldBeNull();
Expand All @@ -46,8 +46,8 @@ public void NodeHelper_Should_Return_Proper_Nodes_3()
foreach (var method in typeof(NodeHelper).GetMethods().Where(m => m.IsStatic))
{
var node = method.GetParameters().Length == 1
? (ASTNode)method.Invoke(null, new object[] { IgnoreOptions.Locations })
: (ASTNode)method.Invoke(null, new object[] { IgnoreOptions.Locations, Activator.CreateInstance(method.GetParameters()[1].ParameterType) });
? (ASTNode)method.Invoke(null, [IgnoreOptions.Locations])
: (ASTNode)method.Invoke(null, [IgnoreOptions.Locations, Activator.CreateInstance(method.GetParameters()[1].ParameterType)]);

node.Comments = new List<GraphQLComment> { new GraphQLComment("abcdef") };
if (node is not GraphQLComment &&
Expand All @@ -67,8 +67,8 @@ public void NodeHelper_Should_Return_Proper_Nodes_4()
foreach (var method in typeof(NodeHelper).GetMethods().Where(m => m.IsStatic))
{
var node = method.GetParameters().Length == 1
? (ASTNode)method.Invoke(null, new object[] { IgnoreOptions.All })
: (ASTNode)method.Invoke(null, new object[] { IgnoreOptions.All, Activator.CreateInstance(method.GetParameters()[1].ParameterType) });
? (ASTNode)method.Invoke(null, [IgnoreOptions.All])
: (ASTNode)method.Invoke(null, [IgnoreOptions.All, Activator.CreateInstance(method.GetParameters()[1].ParameterType)]);

node.Comments = new List<GraphQLComment> { new GraphQLComment("abcdef") };
node.Comment.ShouldBeNull();
Expand Down
24 changes: 12 additions & 12 deletions src/GraphQLParser/ParserContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ namespace GraphQLParser;

internal ref partial struct ParserContext
{
private static string[] TopLevelKeywordOneOf { get; set; } = new[]
{
private static string[] TopLevelKeywordOneOf { get; set; } =
[
"query",
"mutation",
"subscription",
Expand All @@ -24,28 +24,28 @@ internal ref partial struct ParserContext
"input",
"extend",
"directive",
};
];

private static string[] TypeExtensionOneOf { get; set; } = new[]
{
private static string[] TypeExtensionOneOf { get; set; } =
[
"schema",
"scalar",
"type",
"interface",
"union",
"enum",
"input",
};
];

private static string[] OperationTypeOneOf { get; set; } = new[]
{
private static string[] OperationTypeOneOf { get; set; } =
[
"query",
"mutation",
"subscription",
};
];

private static string[] DirectiveLocationOneOf { get; set; } = new[]
{
private static string[] DirectiveLocationOneOf { get; set; } =
[

Check failure on line 48 in src/GraphQLParser/ParserContext.cs

View workflow job for this annotation

GitHub Actions / ubuntu-latest

Fix formatting
// http://spec.graphql.org/June2018/#ExecutableDirectiveLocation

Check failure on line 49 in src/GraphQLParser/ParserContext.cs

View workflow job for this annotation

GitHub Actions / ubuntu-latest

Fix formatting
"QUERY",

Check failure on line 50 in src/GraphQLParser/ParserContext.cs

View workflow job for this annotation

GitHub Actions / ubuntu-latest

Fix formatting
"MUTATION",

Check failure on line 51 in src/GraphQLParser/ParserContext.cs

View workflow job for this annotation

GitHub Actions / ubuntu-latest

Fix formatting
Expand All @@ -67,7 +67,7 @@ internal ref partial struct ParserContext
"ENUM_VALUE",
"INPUT_OBJECT",
"INPUT_FIELD_DEFINITION",
};
];

private delegate TResult ParseCallback<out TResult>(ref ParserContext context);

Expand Down
6 changes: 3 additions & 3 deletions src/GraphQLParser/Visitors/SDLPrinter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1135,11 +1135,11 @@ private static bool TryPeekParent(TContext context, [NotNullWhen(true)] out ASTN
return true;
}

private static readonly string[] _hex32 = new[]
{
private static readonly string[] _hex32 =
[
"\\u0000", "\\u0001", "\\u0002", "\\u0003", "\\u0004", "\\u0005", "\\u0006", "\\u0007", "\\u0008", "\\u0009", "\\u000A", "\\u000B", "\\u000C", "\\u000D", "\\u000E", "\\u000F",
"\\u0010", "\\u0011", "\\u0012", "\\u0013", "\\u0014", "\\u0015", "\\u0016", "\\u0017", "\\u0018", "\\u0019", "\\u001A", "\\u001B", "\\u001C", "\\u001D", "\\u001E", "\\u001F"
};
];

// http://spec.graphql.org/October2021/#StringCharacter
private static async ValueTask WriteEncodedStringAsync(TContext context, ROM value)
Expand Down

0 comments on commit 1b18367

Please sign in to comment.