Skip to content

Commit 947a24a

Browse files
authored
Upgrade dotnet-grpc dependencies (#1914)
1 parent 22ac73b commit 947a24a

8 files changed

+62
-39
lines changed

build/dependencies.props

+7-8
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,18 @@
66
<GrpcDotNetPackageVersion>2.47.0</GrpcDotNetPackageVersion> <!-- Used by example projects -->
77
<GrpcPackageVersion>2.46.5</GrpcPackageVersion>
88
<GrpcToolsPackageVersion>2.49.0</GrpcToolsPackageVersion>
9-
<MicrosoftAspNetCoreAppPackageVersion>7.0.0-preview.6.22327.7</MicrosoftAspNetCoreAppPackageVersion>
9+
<MicrosoftAspNetCoreAppPackageVersion>7.0.0-rc.2.22476.2</MicrosoftAspNetCoreAppPackageVersion>
1010
<MicrosoftAspNetCoreApp6PackageVersion>6.0.0</MicrosoftAspNetCoreApp6PackageVersion>
1111
<MicrosoftAspNetCoreApp5PackageVersion>5.0.3</MicrosoftAspNetCoreApp5PackageVersion>
1212
<MicrosoftAspNetCoreApp31PackageVersion>3.1.3</MicrosoftAspNetCoreApp31PackageVersion>
13-
<MicrosoftBuildLocatorPackageVersion>1.2.2</MicrosoftBuildLocatorPackageVersion>
14-
<MicrosoftBuildPackageVersion>16.0.461</MicrosoftBuildPackageVersion>
15-
<MicrosoftCodeAnalysisNetAnalyzersPackageVersion>7.0.0-preview1.22310.1</MicrosoftCodeAnalysisNetAnalyzersPackageVersion>
13+
<MicrosoftBuildLocatorPackageVersion>1.5.5</MicrosoftBuildLocatorPackageVersion>
14+
<MicrosoftBuildPackageVersion>16.9.0</MicrosoftBuildPackageVersion>
15+
<MicrosoftCodeAnalysisNetAnalyzersPackageVersion>7.0.0-preview1.22464.1</MicrosoftCodeAnalysisNetAnalyzersPackageVersion>
1616
<MicrosoftCrankEventSourcesPackageVersion>0.2.0-alpha.21255.1</MicrosoftCrankEventSourcesPackageVersion>
1717
<MicrosoftExtensionsLoggingTestingPackageVersion>2.1.1</MicrosoftExtensionsLoggingTestingPackageVersion>
1818
<MicrosoftExtensionsPackageVersion>3.0.3</MicrosoftExtensionsPackageVersion>
1919
<MicrosoftNETTestSdkPackageVersion>16.9.1</MicrosoftNETTestSdkPackageVersion>
2020
<MicrosoftSourceLinkGitHubPackageVersion>1.0.0</MicrosoftSourceLinkGitHubPackageVersion>
21-
<MicrosoftTyePackageVersion>0.5.0-alpha.20555.1</MicrosoftTyePackageVersion>
2221
<MicrosoftWin32RegistryLinePackageVersion>4.6.0</MicrosoftWin32RegistryLinePackageVersion>
2322
<MoqPackageVersion>4.16.1</MoqPackageVersion>
2423
<NewtonsoftJsonPackageVersion>12.0.3</NewtonsoftJsonPackageVersion>
@@ -27,13 +26,13 @@
2726
<OpenTelemetryPackageVersion>1.3.0</OpenTelemetryPackageVersion>
2827
<OpenTelemetryIntergationPackageVersion>1.0.0-rc9.4</OpenTelemetryIntergationPackageVersion>
2928
<ProtobufNetGrpcPackageVersion>1.0.140</ProtobufNetGrpcPackageVersion>
30-
<SystemCommandLinePackageVersion>2.0.0-beta3.22114.1</SystemCommandLinePackageVersion>
31-
<SystemCommandLineRenderingPackageVersion>0.4.0-alpha.22114.1</SystemCommandLineRenderingPackageVersion>
29+
<SystemCommandLinePackageVersion>2.0.0-beta4.22272.1</SystemCommandLinePackageVersion>
30+
<SystemCommandLineRenderingPackageVersion>0.4.0-alpha.22272.1</SystemCommandLineRenderingPackageVersion>
3231
<SystemDiagnosticsDiagnosticSourcePackageVersion>4.5.1</SystemDiagnosticsDiagnosticSourcePackageVersion>
3332
<SystemIOPipelinesPackageVersion>5.0.1</SystemIOPipelinesPackageVersion>
3433
<SystemMemoryPackageVersion>4.5.3</SystemMemoryPackageVersion>
3534
<SystemNetHttpWinHttpHandlerPackageVersion>6.0.1</SystemNetHttpWinHttpHandlerPackageVersion>
36-
<SystemSecurityPrincipalWindowsPackageVersion>4.6.0</SystemSecurityPrincipalWindowsPackageVersion>
35+
<SystemSecurityPrincipalWindowsPackageVersion>4.7.0</SystemSecurityPrincipalWindowsPackageVersion>
3736
<SystemThreadingChannelsPackageVersion>4.6.0</SystemThreadingChannelsPackageVersion>
3837
</PropertyGroup>
3938
</Project>

src/dotnet-grpc/Commands/AddFileCommand.cs

+12-5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#endregion
1818

19+
using System;
1920
using System.CommandLine;
2021
using System.CommandLine.Invocation;
2122
using Grpc.Dotnet.Cli.Internal;
@@ -53,23 +54,29 @@ public static Command Create(HttpClient httpClient)
5354
command.AddOption(additionalImportDirsOption);
5455
command.AddArgument(filesArgument);
5556

56-
command.SetHandler<string, Services, Access, string?, string[], InvocationContext, IConsole>(
57-
async (project, services, access, additionalImportDirs, files, context, console) =>
57+
command.SetHandler(
58+
async (context) =>
5859
{
60+
var project = context.ParseResult.GetValueForOption(projectOption);
61+
var services = context.ParseResult.GetValueForOption(serviceOption);
62+
var access = context.ParseResult.GetValueForOption(accessOption);
63+
var additionalImportDirs = context.ParseResult.GetValueForOption(additionalImportDirsOption);
64+
var files = context.ParseResult.GetValueForArgument(filesArgument);
65+
5966
try
6067
{
61-
var command = new AddFileCommand(console, project, httpClient);
68+
var command = new AddFileCommand(context.Console, project, httpClient);
6269
await command.AddFileAsync(services, access, additionalImportDirs, files);
6370

6471
context.ExitCode = 0;
6572
}
6673
catch (CLIToolException e)
6774
{
68-
console.LogError(e);
75+
context.Console.LogError(e);
6976

7077
context.ExitCode = -1;
7178
}
72-
}, projectOption, serviceOption, accessOption, additionalImportDirsOption, filesArgument);
79+
});
7380

7481
return command;
7582
}

src/dotnet-grpc/Commands/AddUrlCommand.cs

+12-5
Original file line numberDiff line numberDiff line change
@@ -60,28 +60,35 @@ public static Command Create(HttpClient httpClient)
6060
command.AddOption(accessOption);
6161
command.AddArgument(urlArgument);
6262

63-
command.SetHandler<string, Services, Access, string?, string, string, InvocationContext, IConsole>(
64-
async (project, services, access, additionalImportDirs, url, output, context, console) =>
63+
command.SetHandler(
64+
async (context) =>
6565
{
66+
var project = context.ParseResult.GetValueForOption(projectOption);
67+
var services = context.ParseResult.GetValueForOption(serviceOption);
68+
var access = context.ParseResult.GetValueForOption(accessOption);
69+
var additionalImportDirs = context.ParseResult.GetValueForOption(additionalImportDirsOption);
70+
var output = context.ParseResult.GetValueForOption(outputOption);
71+
var url = context.ParseResult.GetValueForArgument(urlArgument);
72+
6673
try
6774
{
6875
if (string.IsNullOrEmpty(output))
6976
{
7077
throw new CLIToolException(CoreStrings.ErrorNoOutputProvided);
7178
}
7279

73-
var command = new AddUrlCommand(console, project, httpClient);
80+
var command = new AddUrlCommand(context.Console, project, httpClient);
7481
await command.AddUrlAsync(services, access, additionalImportDirs, url, output);
7582

7683
context.ExitCode = 0;
7784
}
7885
catch (CLIToolException e)
7986
{
80-
console.LogError(e);
87+
context.Console.LogError(e);
8188

8289
context.ExitCode = -1;
8390
}
84-
}, projectOption, serviceOption, accessOption, additionalImportDirsOption, urlArgument, outputOption);
91+
});
8592

8693
return command;
8794
}

src/dotnet-grpc/Commands/ListCommand.cs

+6-5
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,24 @@ public static Command Create(HttpClient httpClient)
4141

4242
command.AddOption(projectOption);
4343

44-
command.SetHandler<string, InvocationContext, IConsole>(
45-
(project, context, console) =>
44+
command.SetHandler(
45+
(context) =>
4646
{
47+
var project = context.ParseResult.GetValueForOption(projectOption);
4748
try
4849
{
49-
var command = new ListCommand(console, project, httpClient);
50+
var command = new ListCommand(context.Console, project, httpClient);
5051
command.List();
5152

5253
context.ExitCode = 0;
5354
}
5455
catch (CLIToolException e)
5556
{
56-
console.LogError(e);
57+
context.Console.LogError(e);
5758

5859
context.ExitCode = -1;
5960
}
60-
}, projectOption);
61+
});
6162

6263
return command;
6364
}

src/dotnet-grpc/Commands/RefreshCommand.cs

+9-5
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,27 @@ public static Command Create(HttpClient httpClient)
5656
command.AddOption(dryRunOption);
5757
command.AddArgument(referencesArgument);
5858

59-
command.SetHandler<string, bool, string[], InvocationContext, IConsole>(
60-
async (project, dryRun, references, context, console) =>
59+
command.SetHandler(
60+
async (context) =>
6161
{
62+
var project = context.ParseResult.GetValueForOption(projectOption);
63+
var dryRun = context.ParseResult.GetValueForOption(dryRunOption);
64+
var references = context.ParseResult.GetValueForArgument(referencesArgument);
65+
6266
try
6367
{
64-
var command = new RefreshCommand(console, project, httpClient);
68+
var command = new RefreshCommand(context.Console, project, httpClient);
6569
await command.RefreshAsync(dryRun, references);
6670

6771
context.ExitCode = 0;
6872
}
6973
catch (CLIToolException e)
7074
{
71-
console.LogError(e);
75+
context.Console.LogError(e);
7276

7377
context.ExitCode = -1;
7478
}
75-
}, projectOption, dryRunOption, referencesArgument);
79+
});
7680

7781
return command;
7882
}

src/dotnet-grpc/Commands/RemoveCommand.cs

+10-5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#endregion
1818

19+
using System;
1920
using System.CommandLine;
2021
using System.CommandLine.Invocation;
2122
using Grpc.Dotnet.Cli.Internal;
@@ -47,23 +48,27 @@ public static Command Create(HttpClient httpClient)
4748
command.AddOption(projectOption);
4849
command.AddArgument(referencesArgument);
4950

50-
command.SetHandler<string, string[], InvocationContext, IConsole>(
51-
(project, references, context, console) =>
51+
command.SetHandler(
52+
(context) =>
5253
{
54+
var project = context.ParseResult.GetValueForOption(projectOption);
55+
var references = context.ParseResult.GetValueForArgument(referencesArgument);
5356
try
5457
{
55-
var command = new RemoveCommand(console, project, httpClient);
58+
var command = new RemoveCommand(context.Console, project, httpClient);
5659
command.Remove(references);
5760

5861
context.ExitCode = 0;
5962
}
6063
catch (CLIToolException e)
6164
{
62-
console.LogError(e);
65+
context.Console.LogError(e);
6366

6467
context.ExitCode = -1;
6568
}
66-
}, projectOption, referencesArgument);
69+
70+
return Task.CompletedTask;
71+
});
6772

6873
return command;
6974
}

src/dotnet-grpc/Options/CommonOptions.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,31 +23,31 @@ namespace Grpc.Dotnet.Cli.Options;
2323

2424
internal static class CommonOptions
2525
{
26-
public static Option ProjectOption()
26+
public static Option<string> ProjectOption()
2727
{
2828
var o = new Option<string>(
2929
aliases: new[] { "-p", "--project" },
3030
description: CoreStrings.ProjectOptionDescription);
3131
return o;
3232
}
3333

34-
public static Option ServiceOption()
34+
public static Option<Services> ServiceOption()
3535
{
3636
var o = new Option<Services>(
3737
aliases: new[] { "-s", "--services" },
3838
description: CoreStrings.ServiceOptionDescription);
3939
return o;
4040
}
4141

42-
public static Option AccessOption()
42+
public static Option<Access> AccessOption()
4343
{
4444
var o = new Option<Access>(
4545
aliases: new[] { "--access" },
4646
description: CoreStrings.AccessOptionDescription);
4747
return o;
4848
}
4949

50-
public static Option AdditionalImportDirsOption()
50+
public static Option<string> AdditionalImportDirsOption()
5151
{
5252
var o = new Option<string>(
5353
aliases: new[] { "-i", "--additional-import-dirs" },

src/dotnet-grpc/dotnet-grpc.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<PackageTags>gRPC RPC CLI</PackageTags>
55

66
<IsGrpcPublishedPackage>true</IsGrpcPublishedPackage>
7-
<TargetFramework>netcoreapp3.0</TargetFramework>
7+
<TargetFramework>netcoreapp3.1</TargetFramework>
88

99
<OutputType>exe</OutputType>
1010
<PackAsTool>true</PackAsTool>
@@ -15,7 +15,7 @@
1515
<NoWarn>$(NoWarn);CA2007</NoWarn>
1616

1717
<!-- The roll forward policy is set to LatestMajor to allow rolling forward to latest major and minor
18-
version of the runtime even if requested major (netcoreapp3.0) is present. This ensures that the runtime
18+
version of the runtime even if requested major (netcoreapp3.1) is present. This ensures that the runtime
1919
contains assemblies that are equal or newer than neede by the SDK assemblies resolved by the MSBuild locator.
2020
See https://github.com/dotnet/designs/blob/main/accepted/2019/runtime-binding.md#rollforward for details-->
2121
<RollForward>LatestMajor</RollForward>

0 commit comments

Comments
 (0)