Skip to content

Commit

Permalink
Merge pull request #69 from max-ieremenko/release/1.4.2
Browse files Browse the repository at this point in the history
release/1.4.2
  • Loading branch information
max-ieremenko authored Jan 22, 2022
2 parents d448e8d + 61bce18 commit a955d97
Show file tree
Hide file tree
Showing 67 changed files with 1,133 additions and 91 deletions.
26 changes: 26 additions & 0 deletions Build/sdk-test/sync-over-async-ci-linux.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[CmdletBinding()]
param(
[Parameter(Mandatory = $true)]
$Settings
)

Enter-Build {
$exampleDir = Join-Path $Settings.examples "SyncOverAsync"
}

task Default Build, Run

task Build {
exec { dotnet restore $exampleDir }
exec { dotnet build --configuration Release $exampleDir }
}

task Run {
$apps = @("Demo.ServerAspNetCore", "Demo.ServerSelfHost")
foreach ($app in $apps) {
Write-Output "=== exec $app ==="

$entryPoint = Join-Path $exampleDir "$app/bin/Release/net6.0/$app.dll"
exec { dotnet $entryPoint }
}
}
27 changes: 27 additions & 0 deletions Build/sdk-test/sync-over-async-locally.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[CmdletBinding()]
param(
[Parameter(Mandatory = $true)]
$Settings
)

task Default Clean, Build, Run

task Clean {
Remove-DirectoryRecurse -Path (Join-Path $settings.examples "SyncOverAsync") -Filters "bin", "obj"
}

task Build {
Build-ExampleInContainer `
-Sources $settings.sources `
-Examples $settings.examples `
-Packages $settings.buildOut `
-ExampleName "SyncOverAsync" `
-DotNet "net6.0"
}

task Run {
Invoke-ExampleInContainer `
-Example (Join-Path $settings.examples "SyncOverAsync") `
-DotNet "net6.0" `
-Apps "Demo.ServerAspNetCore", "Demo.ServerSelfHost"
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"Dependencies": [
{
"Name": "Grpc.Net.Common",
"Version": "2.41.0"
"Version": "2.42.0"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>Grpc.AspNetCore.Server</id>
<version>2.41.0</version>
<version>2.42.0</version>
<authors>The gRPC Authors</authors>
<license type="expression">Apache-2.0</license>
<licenseUrl>https://licenses.nuget.org/Apache-2.0</licenseUrl>
Expand All @@ -11,16 +11,16 @@
<description>gRPC support for ASP.NET Core</description>
<copyright>Copyright 2019 The gRPC Authors</copyright>
<tags>gRPC RPC HTTP/2 aspnetcore</tags>
<repository type="git" url="https://github.com/grpc/grpc-dotnet.git" commit="89dfcc5dcecc858e6c690844858dac69e85dac1d" />
<repository type="git" url="https://github.com/grpc/grpc-dotnet.git" commit="5c8feaec5cda029ee961672bb645de1dd13cccd4" />
<dependencies>
<group targetFramework=".NETCoreApp3.0">
<dependency id="Grpc.Net.Common" version="2.41.0" exclude="Build,Analyzers" />
<dependency id="Grpc.Net.Common" version="2.42.0" exclude="Build,Analyzers" />
</group>
<group targetFramework="net5.0">
<dependency id="Grpc.Net.Common" version="2.41.0" exclude="Build,Analyzers" />
<dependency id="Grpc.Net.Common" version="2.42.0" exclude="Build,Analyzers" />
</group>
<group targetFramework="net6.0">
<dependency id="Grpc.Net.Common" version="2.41.0" exclude="Build,Analyzers" />
<dependency id="Grpc.Net.Common" version="2.42.0" exclude="Build,Analyzers" />
</group>
</dependencies>
<frameworkReferences>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Grpc.AspNetCore.Server [2.41.0](https://www.nuget.org/packages/Grpc.AspNetCore.Server/2.41.0)
Grpc.AspNetCore.Server [2.42.0](https://www.nuget.org/packages/Grpc.AspNetCore.Server/2.42.0)
--------------------

Used by: AspNetCore
Expand All @@ -25,6 +25,6 @@ Dependencies 1

|Name|Version|
|----------|:----|
|[Grpc.Net.Common](../../../../packages/nuget.org/grpc.net.common/2.41.0)|2.41.0|
|[Grpc.Net.Common](../../../../packages/nuget.org/grpc.net.common/2.42.0)|2.42.0|

*This page was generated by a tool.*
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>Grpc.Net.Common</id>
<version>2.41.0</version>
<version>2.42.0</version>
<authors>The gRPC Authors</authors>
<license type="expression">Apache-2.0</license>
<licenseUrl>https://licenses.nuget.org/Apache-2.0</licenseUrl>
Expand All @@ -11,19 +11,19 @@
<description>Infrastructure for common functionality in gRPC</description>
<copyright>Copyright 2019 The gRPC Authors</copyright>
<tags>gRPC RPC HTTP/2</tags>
<repository type="git" url="https://github.com/grpc/grpc-dotnet.git" commit="89dfcc5dcecc858e6c690844858dac69e85dac1d" />
<repository type="git" url="https://github.com/grpc/grpc-dotnet.git" commit="5c8feaec5cda029ee961672bb645de1dd13cccd4" />
<dependencies>
<group targetFramework="net5.0">
<dependency id="Grpc.Core.Api" version="2.41.0" exclude="Build,Analyzers" />
<dependency id="Grpc.Core.Api" version="2.42.0" exclude="Build,Analyzers" />
</group>
<group targetFramework="net6.0">
<dependency id="Grpc.Core.Api" version="2.41.0" exclude="Build,Analyzers" />
<dependency id="Grpc.Core.Api" version="2.42.0" exclude="Build,Analyzers" />
</group>
<group targetFramework=".NETStandard2.0">
<dependency id="Grpc.Core.Api" version="2.41.0" exclude="Build,Analyzers" />
<dependency id="Grpc.Core.Api" version="2.42.0" exclude="Build,Analyzers" />
</group>
<group targetFramework=".NETStandard2.1">
<dependency id="Grpc.Core.Api" version="2.41.0" exclude="Build,Analyzers" />
<dependency id="Grpc.Core.Api" version="2.42.0" exclude="Build,Analyzers" />
</group>
</dependencies>
</metadata>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Grpc.Net.Common [2.41.0](https://www.nuget.org/packages/Grpc.Net.Common/2.41.0)
Grpc.Net.Common [2.42.0](https://www.nuget.org/packages/Grpc.Net.Common/2.42.0)
--------------------

Used by: AspNetCore
Expand Down
4 changes: 2 additions & 2 deletions Build/third-party-libraries/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ Packages 174
|[DiffEngine](packages/nuget.org/diffengine/6.4.9)|6.4.9|[nuget.org](https://www.nuget.org/packages/DiffEngine/6.4.9)|[MIT](licenses/mit)|Core internal|
|[EmptyFiles](packages/nuget.org/emptyfiles/2.3.3)|2.3.3|[nuget.org](https://www.nuget.org/packages/EmptyFiles/2.3.3)|[MIT](licenses/mit)|Core internal|
|[Google.Protobuf](packages/nuget.org/google.protobuf/3.19.2)|3.19.2|[nuget.org](https://www.nuget.org/packages/Google.Protobuf/3.19.2)|[Google.Protobuf](licenses/google.protobuf)|AspNetCore internal, AspNetCoreNSwag internal, AspNetCoreSwashbuckle internal|
|[Grpc.AspNetCore.Server](packages/nuget.org/grpc.aspnetcore.server/2.41.0)|2.41.0|[nuget.org](https://www.nuget.org/packages/Grpc.AspNetCore.Server/2.41.0)|[Apache-2.0](licenses/apache-2.0)|AspNetCore|
|[Grpc.AspNetCore.Server](packages/nuget.org/grpc.aspnetcore.server/2.42.0)|2.42.0|[nuget.org](https://www.nuget.org/packages/Grpc.AspNetCore.Server/2.42.0)|[Apache-2.0](licenses/apache-2.0)|AspNetCore|
|[Grpc.Core](packages/nuget.org/grpc.core/2.43.0)|2.43.0|[nuget.org](https://www.nuget.org/packages/Grpc.Core/2.43.0)|[Apache-2.0](licenses/apache-2.0)|AspNetCore internal, AspNetCoreNSwag internal, AspNetCoreSwashbuckle internal, SelfHost|
|[Grpc.Core.Api](packages/nuget.org/grpc.core.api/2.43.0)|2.43.0|[nuget.org](https://www.nuget.org/packages/Grpc.Core.Api/2.43.0)|[Apache-2.0](licenses/apache-2.0)|AspNetCore, AspNetCoreNSwag internal, AspNetCoreSwashbuckle internal, Core, DesignTime, SelfHost|
|[Grpc.Net.Common](packages/nuget.org/grpc.net.common/2.41.0)|2.41.0|[nuget.org](https://www.nuget.org/packages/Grpc.Net.Common/2.41.0)|[Apache-2.0](licenses/apache-2.0)|AspNetCore|
|[Grpc.Net.Common](packages/nuget.org/grpc.net.common/2.42.0)|2.42.0|[nuget.org](https://www.nuget.org/packages/Grpc.Net.Common/2.42.0)|[Apache-2.0](licenses/apache-2.0)|AspNetCore|
|[Grpc.Tools](packages/nuget.org/grpc.tools/2.43.0)|2.43.0|[nuget.org](https://www.nuget.org/packages/Grpc.Tools/2.43.0)|[Apache-2.0](licenses/apache-2.0)|AspNetCore internal, AspNetCoreNSwag internal, AspNetCoreSwashbuckle internal|
|[Humanizer.Core](packages/nuget.org/humanizer.core/2.2.0)|2.2.0|[nuget.org](https://www.nuget.org/packages/Humanizer.Core/2.2.0)|[MIT](licenses/mit)|DesignTime|
|[MessagePack](packages/nuget.org/messagepack/2.3.85)|2.3.85|[nuget.org](https://www.nuget.org/packages/MessagePack/2.3.85)|[MIT](licenses/mit)|MessagePack|
Expand Down
3 changes: 3 additions & 0 deletions Examples/Swagger/Contract/ICalculator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ namespace Contract
[ServiceContract]
public interface ICalculator
{
[OperationContract]
Task<int> GetRandomNumber();

[OperationContract]
Task<long> Sum(long x, int y, int z, CancellationToken token = default);

Expand Down
8 changes: 7 additions & 1 deletion Examples/Swagger/NSwagWebApplication/Services/Calculator.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
Expand All @@ -8,6 +9,11 @@ namespace NSwagWebApplication.Services
{
internal sealed class Calculator : ICalculator
{
public Task<int> GetRandomNumber()
{
return Task.FromResult(new Random(DateTime.Now.Millisecond).Next());
}

public Task<long> Sum(long x, int y, int z, CancellationToken token)
{
return Task.FromResult(x + y + z);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
Expand All @@ -8,6 +9,11 @@ namespace SwashbuckleWebApplication.Services
{
internal sealed class Calculator : ICalculator
{
public Task<int> GetRandomNumber()
{
return Task.FromResult(new Random(DateTime.Now.Millisecond).Next());
}

public Task<long> Sum(long x, int y, int z, CancellationToken token)
{
return Task.FromResult(x + y + z);
Expand Down
16 changes: 16 additions & 0 deletions Examples/SyncOverAsync/Client/Client.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Grpc.Core" Version="$(GrpcCoreVersion)" />
<PackageReference Include="ServiceModel.Grpc" Version="$(ServiceModelGrpcVersion)" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Contract\Contract.csproj" />
</ItemGroup>

</Project>
58 changes: 58 additions & 0 deletions Examples/SyncOverAsync/Client/ClientCalls.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
using System;
using System.Threading.Tasks;
using Contract;
using Grpc.Core;
using ServiceModel.Grpc.Client;

namespace Client
{
public sealed class ClientCalls
{
private readonly IClientFactory _clientFactory;
private readonly Channel _channel;

public ClientCalls(int serverPort)
{
_clientFactory = new ClientFactory();
_channel = new Channel("localhost", serverPort, ChannelCredentials.Insecure);
}

public void RunSync()
{
var personService = _clientFactory.CreateClient<IPersonService>(_channel);

Console.WriteLine("Invoke Create");

var person = personService.Create("John X", DateTime.Today.AddYears(-20));

Console.WriteLine(" Name: {0}", person.Name);
Console.WriteLine(" BirthDay: {0}", person.BirthDay);

Console.WriteLine("Invoke Update");

person = personService.Update(person, "John", DateTime.Today.AddYears(-21));

Console.WriteLine(" Name: {0}", person.Name);
Console.WriteLine(" BirthDay: {0}", person.BirthDay);
}

public async Task RunAsync()
{
var personService = _clientFactory.CreateClient<IPersonService>(_channel);

Console.WriteLine("Invoke CreateAsync");

var person = await personService.CreateAsync("John X", DateTime.Today.AddYears(-20));

Console.WriteLine(" Name: {0}", person.Name);
Console.WriteLine(" BirthDay: {0}", person.BirthDay);

Console.WriteLine("Invoke UpdateAsync");

person = await personService.UpdateAsync(person, "John", DateTime.Today.AddYears(-21), default);

Console.WriteLine(" Name: {0}", person.Name);
Console.WriteLine(" BirthDay: {0}", person.BirthDay);
}
}
}
12 changes: 12 additions & 0 deletions Examples/SyncOverAsync/Contract/Contract.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.ServiceModel.Primitives" Version="4.7.0" />
<PackageReference Include="ServiceModel.Grpc" Version="$(ServiceModelGrpcVersion)" />
</ItemGroup>

</Project>
25 changes: 25 additions & 0 deletions Examples/SyncOverAsync/Contract/IPersonService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.ServiceModel;
using System.Threading;
using System.Threading.Tasks;

namespace Contract
{
[ServiceContract]
public interface IPersonService
{
// blocking unary call Create
Person Create(string name, DateTime birthDay);

// async unary call Create
[OperationContract]
Task<Person> CreateAsync(string name, DateTime birthDay);

// blocking unary call Update
Person Update(Person person, string newName, DateTime newBirthDay);

// async unary call Update
[OperationContract]
ValueTask<Person> UpdateAsync(Person person, string newName, DateTime newBirthDay, CancellationToken token);
}
}
15 changes: 15 additions & 0 deletions Examples/SyncOverAsync/Contract/Person.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.Runtime.Serialization;

namespace Contract
{
[DataContract]
public class Person
{
[DataMember]
public string Name { get; set; }

[DataMember]
public DateTime BirthDay { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ServiceModel.Grpc.AspNetCore" Version="$(ServiceModelGrpcVersion)" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Client\Client.csproj" />
<ProjectReference Include="..\Service\Service.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ActiveDebugProfile>ServerAspNetCore</ActiveDebugProfile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebuggerFlavor>ProjectDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>
Loading

0 comments on commit a955d97

Please sign in to comment.