Skip to content

Commit aa5475e

Browse files
sungam3rShane32
andauthored
Migrate to NET8 (#382)
* Migrate to NET8 * format * Update --------- Co-authored-by: Shane Krueger <[email protected]>
1 parent 8de2491 commit aa5475e

File tree

11 files changed

+86
-58
lines changed

11 files changed

+86
-58
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Setup .NET SDK
2222
uses: actions/setup-dotnet@v4
2323
with:
24-
dotnet-version: 7.0.x
24+
dotnet-version: 8.0.x
2525

2626
- name: Initialize CodeQL
2727
uses: github/codeql-action/init@v2

.github/workflows/publish-preview.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- name: Setup .NET SDK
2828
uses: actions/setup-dotnet@v4
2929
with:
30-
dotnet-version: 7.0.x
30+
dotnet-version: 8.0.x
3131
source-url: https://nuget.pkg.github.com/graphql-dotnet/index.json
3232
env:
3333
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

.github/workflows/publish-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- name: Setup .NET SDK
3434
uses: actions/setup-dotnet@v4
3535
with:
36-
dotnet-version: 7.0.x
36+
dotnet-version: 8.0.x
3737
source-url: https://api.nuget.org/v3/index.json
3838
env:
3939
NUGET_AUTH_TOKEN: ${{secrets.NUGET_AUTH_TOKEN}}

.github/workflows/test.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,10 @@ jobs:
4040
dotnet-version: |
4141
6.0.x
4242
7.0.x
43+
8.0.x
4344
source-url: https://nuget.pkg.github.com/graphql-dotnet/index.json
4445
env:
4546
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
46-
- name: Disable MSVS Nuget Source # see https://github.com/graphql-dotnet/graphql-dotnet/issues/2422
47-
if: ${{ startsWith(matrix.os, 'windows') }}
48-
run: dotnet nuget disable source 'Microsoft Visual Studio Offline Packages'
4947
- name: Install dependencies
5048
working-directory: src
5149
run: dotnet restore
@@ -72,7 +70,7 @@ jobs:
7270
if: ${{ startsWith(matrix.os, 'ubuntu') }}
7371
uses: codecov/codecov-action@v3
7472
with:
75-
files: .coverage/GraphQLParser.Tests/coverage.net5.opencover.xml
73+
files: .coverage/GraphQLParser.Tests/coverage.net8.opencover.xml
7674

7775
buildcheck:
7876
needs:

src/GraphQLParser.ApiTests/ApiApprovalTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public void Public_Api_Should_Not_Change_Inadvertently(Type type)
3434
{
3535
IncludeAssemblyAttributes = false,
3636
//WhitelistedNamespacePrefixes = new[] { "Microsoft.Extensions.DependencyInjection" },
37-
ExcludeAttributes = new[] { "System.Diagnostics.DebuggerDisplayAttribute", "System.Diagnostics.CodeAnalysis.AllowNullAttribute" }
37+
ExcludeAttributes = ["System.Diagnostics.DebuggerDisplayAttribute", "System.Diagnostics.CodeAnalysis.AllowNullAttribute"]
3838
}))).ToArray();
3939

4040
if (publicApi.DistinctBy(item => item.content).Count() == 1)

src/GraphQLParser.ApiTests/GraphQLParser.ApiTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net7</TargetFramework>
4+
<TargetFramework>net8</TargetFramework>
55
<NoWarn>$(NoWarn);1591</NoWarn>
66
<Nullable>enable</Nullable>
77
</PropertyGroup>

src/GraphQLParser.Benchmarks/GraphQLParser.Benchmarks.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net7</TargetFramework>
4+
<TargetFramework>net8</TargetFramework>
55
<OutputType>Exe</OutputType>
66
<IsPackable>false</IsPackable>
77
<NoWarn>$(NoWarn);1591</NoWarn>

src/GraphQLParser.Tests/GraphQLParser.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<PropertyGroup Condition="'$(SingleTestPlatform)' != 'true'">
15-
<TargetFrameworks>net6;net7</TargetFrameworks>
15+
<TargetFrameworks>net6;net7;net8</TargetFrameworks>
1616
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>
1717
</PropertyGroup>
1818

src/GraphQLParser.Tests/NodeHelperTests.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ public void NodeHelper_Should_Return_Proper_Nodes_1()
88
foreach (var method in typeof(NodeHelper).GetMethods().Where(m => m.IsStatic))
99
{
1010
var node = method.GetParameters().Length == 1
11-
? (ASTNode)method.Invoke(null, new object[] { IgnoreOptions.None })
12-
: (ASTNode)method.Invoke(null, new object[] { IgnoreOptions.None, Activator.CreateInstance(method.GetParameters()[1].ParameterType) });
11+
? (ASTNode)method.Invoke(null, [IgnoreOptions.None])
12+
: (ASTNode)method.Invoke(null, [IgnoreOptions.None, Activator.CreateInstance(method.GetParameters()[1].ParameterType)]);
1313

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

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

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

7373
node.Comments = new List<GraphQLComment> { new GraphQLComment("abcdef") };
7474
node.Comment.ShouldBeNull();

src/GraphQLParser/ParserContext.cs

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ namespace GraphQLParser;
99

1010
internal ref partial struct ParserContext
1111
{
12-
private static string[] TopLevelKeywordOneOf { get; set; } = new[]
13-
{
12+
private static string[] TopLevelKeywordOneOf { get; set; } =
13+
[
1414
"query",
1515
"mutation",
1616
"subscription",
@@ -24,50 +24,50 @@ internal ref partial struct ParserContext
2424
"input",
2525
"extend",
2626
"directive",
27-
};
27+
];
2828

29-
private static string[] TypeExtensionOneOf { get; set; } = new[]
30-
{
29+
private static string[] TypeExtensionOneOf { get; set; } =
30+
[
3131
"schema",
3232
"scalar",
3333
"type",
3434
"interface",
3535
"union",
3636
"enum",
3737
"input",
38-
};
38+
];
3939

40-
private static string[] OperationTypeOneOf { get; set; } = new[]
41-
{
40+
private static string[] OperationTypeOneOf { get; set; } =
41+
[
4242
"query",
4343
"mutation",
4444
"subscription",
45-
};
46-
47-
private static string[] DirectiveLocationOneOf { get; set; } = new[]
48-
{
49-
// http://spec.graphql.org/June2018/#ExecutableDirectiveLocation
50-
"QUERY",
51-
"MUTATION",
52-
"SUBSCRIPTION",
53-
"FIELD",
54-
"FRAGMENT_DEFINITION",
55-
"FRAGMENT_SPREAD",
56-
"INLINE_FRAGMENT",
57-
"VARIABLE_DEFINITION",
58-
// http://spec.graphql.org/June2018/#TypeSystemDirectiveLocation
59-
"SCHEMA",
60-
"SCALAR",
61-
"OBJECT",
62-
"FIELD_DEFINITION",
63-
"ARGUMENT_DEFINITION",
64-
"INTERFACE",
65-
"UNION",
66-
"ENUM",
67-
"ENUM_VALUE",
68-
"INPUT_OBJECT",
69-
"INPUT_FIELD_DEFINITION",
70-
};
45+
];
46+
47+
private static string[] DirectiveLocationOneOf { get; set; } =
48+
[
49+
// http://spec.graphql.org/June2018/#ExecutableDirectiveLocation
50+
"QUERY",
51+
"MUTATION",
52+
"SUBSCRIPTION",
53+
"FIELD",
54+
"FRAGMENT_DEFINITION",
55+
"FRAGMENT_SPREAD",
56+
"INLINE_FRAGMENT",
57+
"VARIABLE_DEFINITION",
58+
// http://spec.graphql.org/June2018/#TypeSystemDirectiveLocation
59+
"SCHEMA",
60+
"SCALAR",
61+
"OBJECT",
62+
"FIELD_DEFINITION",
63+
"ARGUMENT_DEFINITION",
64+
"INTERFACE",
65+
"UNION",
66+
"ENUM",
67+
"ENUM_VALUE",
68+
"INPUT_OBJECT",
69+
"INPUT_FIELD_DEFINITION",
70+
];
7171

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

0 commit comments

Comments
 (0)