mirror of https://github.com/grpc/grpc.git
Revert "Revert "Add back C# distribtests for Grpc.Tools"" (#31436)
* Revert "Revert "Add back C# distribtests for Grpc.Tools (#31399)" (#31412)"
This reverts commit dbc45208e2
.
* avoid clash with internal protos
pull/31479/head
parent
11a8f66cca
commit
3cf3ed7d59
18 changed files with 288 additions and 189 deletions
@ -0,0 +1,6 @@ |
||||
packages |
||||
*.userprefs |
||||
*.csproj.user |
||||
*.suo |
||||
/TestNugetFeed |
||||
|
@ -0,0 +1,3 @@ |
||||
bin |
||||
obj |
||||
*.lock.json |
@ -0,0 +1,63 @@ |
||||
#region Copyright notice and license |
||||
|
||||
// Copyright 2015 gRPC authors. |
||||
// |
||||
// Licensed under the Apache License, Version 2.0 (the "License"); |
||||
// you may not use this file except in compliance with the License. |
||||
// You may obtain a copy of the License at |
||||
// |
||||
// http://www.apache.org/licenses/LICENSE-2.0 |
||||
// |
||||
// Unless required by applicable law or agreed to in writing, software |
||||
// distributed under the License is distributed on an "AS IS" BASIS, |
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
// See the License for the specific language governing permissions and |
||||
// limitations under the License. |
||||
|
||||
#endregion |
||||
|
||||
using System; |
||||
using System.Linq; |
||||
using System.Threading.Tasks; |
||||
using Grpc.Core; |
||||
using GrpcCsharpDistribtest.Helloworld; |
||||
|
||||
namespace TestGrpcPackage |
||||
{ |
||||
class MainClass |
||||
{ |
||||
public static void Main(string[] args) |
||||
{ |
||||
CheckGreeterProtobufCodegenWorks(); |
||||
CheckGreeterGrpcProtobufPluginCodegenWorks(); |
||||
CheckDuplicateProtoFilesAreOk(); |
||||
} |
||||
|
||||
private static object CheckGreeterProtobufCodegenWorks() |
||||
{ |
||||
return new HelloRequest { Name = "ABC" }; |
||||
} |
||||
|
||||
private static object CheckGreeterGrpcProtobufPluginCodegenWorks() |
||||
{ |
||||
return typeof(GreeterImpl); |
||||
} |
||||
|
||||
// Test that codegen works well in case the .csproj has .proto files |
||||
// of the same name, but under different directories (see #17672). |
||||
// This method doesn't need to be used, it is enough to check that it builds. |
||||
private static object CheckDuplicateProtoFilesAreOk() |
||||
{ |
||||
return new GrpcCsharpDistribtest.DuplicateProto.MessageFromDuplicateProto(); |
||||
} |
||||
} |
||||
|
||||
class GreeterImpl : Greeter.GreeterBase |
||||
{ |
||||
// Server side handler of the SayHello RPC |
||||
public override Task<HelloReply> SayHello(HelloRequest request, ServerCallContext context) |
||||
{ |
||||
return Task.FromResult(new HelloReply { Message = "Hello " + request.Name }); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,23 @@ |
||||
// Copyright 2019 The gRPC Authors |
||||
// |
||||
// Licensed under the Apache License, Version 2.0 (the "License"); |
||||
// you may not use this file except in compliance with the License. |
||||
// You may obtain a copy of the License at |
||||
// |
||||
// http://www.apache.org/licenses/LICENSE-2.0 |
||||
// |
||||
// Unless required by applicable law or agreed to in writing, software |
||||
// distributed under the License is distributed on an "AS IS" BASIS, |
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
// See the License for the specific language governing permissions and |
||||
// limitations under the License. |
||||
|
||||
// Test that codegen works well in case the .csproj has .proto files |
||||
// of the same name, but under different directories (see #17672). |
||||
syntax = "proto3"; |
||||
|
||||
package grpc_csharp_distribtest.duplicate_proto; |
||||
|
||||
message MessageFromDuplicateProto { |
||||
string name = 1; |
||||
} |
@ -0,0 +1,29 @@ |
||||
// Copyright 2019 The gRPC Authors |
||||
// |
||||
// Licensed under the Apache License, Version 2.0 (the "License"); |
||||
// you may not use this file except in compliance with the License. |
||||
// You may obtain a copy of the License at |
||||
// |
||||
// http://www.apache.org/licenses/LICENSE-2.0 |
||||
// |
||||
// Unless required by applicable law or agreed to in writing, software |
||||
// distributed under the License is distributed on an "AS IS" BASIS, |
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
// See the License for the specific language governing permissions and |
||||
// limitations under the License. |
||||
|
||||
syntax = "proto3"; |
||||
|
||||
package grpc_csharp_distribtest.helloworld; |
||||
|
||||
service Greeter { |
||||
rpc SayHello (HelloRequest) returns (HelloReply) {} |
||||
} |
||||
|
||||
message HelloRequest { |
||||
string name = 1; |
||||
} |
||||
|
||||
message HelloReply { |
||||
string message = 1; |
||||
} |
@ -0,0 +1,8 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<configuration> |
||||
<packageSources> |
||||
<add key="https://www.nuget.org/api/v2/" value="https://www.nuget.org/api/v2/" /> |
||||
<add key="TestNugetFeed" value="TestNugetFeed" /> |
||||
</packageSources> |
||||
</configuration> |
||||
|
@ -0,0 +1,81 @@ |
||||
#!/bin/bash |
||||
# Copyright 2015 gRPC authors. |
||||
# |
||||
# Licensed under the Apache License, Version 2.0 (the "License"); |
||||
# you may not use this file except in compliance with the License. |
||||
# You may obtain a copy of the License at |
||||
# |
||||
# http://www.apache.org/licenses/LICENSE-2.0 |
||||
# |
||||
# Unless required by applicable law or agreed to in writing, software |
||||
# distributed under the License is distributed on an "AS IS" BASIS, |
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
# See the License for the specific language governing permissions and |
||||
# limitations under the License. |
||||
|
||||
set -ex |
||||
|
||||
cd "$(dirname "$0")" |
||||
|
||||
unzip -o "$EXTERNAL_GIT_ROOT/input_artifacts/csharp_nugets_windows_dotnetcli.zip" -d TestNugetFeed |
||||
|
||||
./update_version.sh auto |
||||
|
||||
cd DistribTest |
||||
|
||||
# TODO(jtattermusch): make sure we don't pollute the global nuget cache with |
||||
# the nugets being tested. |
||||
dotnet restore DistribTestDotNet.csproj |
||||
|
||||
dotnet build DistribTestDotNet.csproj |
||||
|
||||
ls -R bin |
||||
|
||||
if [ "${SKIP_NET45_DISTRIBTEST}" != "1" ] |
||||
then |
||||
dotnet publish -f net45 DistribTestDotNet.csproj |
||||
|
||||
# .NET 4.5 target after dotnet build |
||||
mono bin/Debug/net45/publish/DistribTestDotNet.exe |
||||
|
||||
# .NET 4.5 target after dotnet publish |
||||
mono bin/Debug/net45/publish/DistribTestDotNet.exe |
||||
fi |
||||
|
||||
if [ "${SKIP_NETCOREAPP21_DISTRIBTEST}" != "1" ] |
||||
then |
||||
dotnet publish -f netcoreapp2.1 DistribTestDotNet.csproj |
||||
|
||||
# .NET Core target after dotnet build |
||||
dotnet exec bin/Debug/netcoreapp2.1/DistribTestDotNet.dll |
||||
|
||||
# .NET Core target after dotnet publish |
||||
dotnet exec bin/Debug/netcoreapp2.1/publish/DistribTestDotNet.dll |
||||
fi |
||||
|
||||
if [ "${SKIP_NETCOREAPP31_DISTRIBTEST}" != "1" ] |
||||
then |
||||
dotnet publish -f netcoreapp3.1 DistribTestDotNet.csproj |
||||
|
||||
# .NET Core target after dotnet build |
||||
dotnet exec bin/Debug/netcoreapp3.1/DistribTestDotNet.dll |
||||
|
||||
# .NET Core target after dotnet publish |
||||
dotnet exec bin/Debug/netcoreapp3.1/publish/DistribTestDotNet.dll |
||||
fi |
||||
|
||||
if [ "${SKIP_NET50_DISTRIBTEST}" != "1" ] |
||||
then |
||||
dotnet publish -f net5.0 DistribTestDotNet.csproj |
||||
|
||||
dotnet publish -r linux-x64 -f net5.0 DistribTestDotNet.csproj -p:PublishSingleFile=true --self-contained true --output net5_singlefile_publish |
||||
|
||||
# .NET Core target after dotnet build |
||||
dotnet exec bin/Debug/net5.0/DistribTestDotNet.dll |
||||
|
||||
# .NET Core target after dotnet publish |
||||
dotnet exec bin/Debug/net5.0/publish/DistribTestDotNet.dll |
||||
|
||||
# binary generated by the single file publish |
||||
./net5_singlefile_publish/DistribTestDotNet |
||||
fi |
@ -0,0 +1,31 @@ |
||||
#!/bin/bash |
||||
# Copyright 2015 gRPC authors. |
||||
# |
||||
# Licensed under the Apache License, Version 2.0 (the "License"); |
||||
# you may not use this file except in compliance with the License. |
||||
# You may obtain a copy of the License at |
||||
# |
||||
# http://www.apache.org/licenses/LICENSE-2.0 |
||||
# |
||||
# Unless required by applicable law or agreed to in writing, software |
||||
# distributed under the License is distributed on an "AS IS" BASIS, |
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
# See the License for the specific language governing permissions and |
||||
# limitations under the License. |
||||
|
||||
set -e |
||||
|
||||
cd "$(dirname "$0")" |
||||
|
||||
CSHARP_VERSION="$1" |
||||
if [ "$CSHARP_VERSION" == "auto" ] |
||||
then |
||||
# autodetect C# version from the name of Grpc.Tools.0.0.0-x.nupkg file |
||||
# TODO: find a better shellcheck-compliant way to write the following line |
||||
# shellcheck disable=SC2010 |
||||
CSHARP_VERSION=$(ls TestNugetFeed | grep -m 1 '^Grpc\.Tools\.[0-9].*\.nupkg$' | sed s/^Grpc\.Tools\.// | sed s/\.nupkg$// | sed s/\.symbols$//) |
||||
echo "Autodetected nuget ${CSHARP_VERSION}" |
||||
fi |
||||
|
||||
# Replaces version placeholder with value provided as first argument. |
||||
sed -ibak "s/__GRPC_NUGET_VERSION__/${CSHARP_VERSION}/g" DistribTest/DistribTestDotNet.csproj |
@ -1,16 +0,0 @@ |
||||
@rem Copyright 2016 gRPC authors. |
||||
@rem |
||||
@rem Licensed under the Apache License, Version 2.0 (the "License"); |
||||
@rem you may not use this file except in compliance with the License. |
||||
@rem You may obtain a copy of the License at |
||||
@rem |
||||
@rem http://www.apache.org/licenses/LICENSE-2.0 |
||||
@rem |
||||
@rem Unless required by applicable law or agreed to in writing, software |
||||
@rem distributed under the License is distributed on an "AS IS" BASIS, |
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
@rem See the License for the specific language governing permissions and |
||||
@rem limitations under the License. |
||||
|
||||
@rem Nothing to do here. C# has been removed from this repository. This script is a placeholder |
||||
@rem to prevent C# tests from becoming red (until they get eventually disabled). |
@ -1,19 +0,0 @@ |
||||
#!/bin/bash |
||||
# Copyright 2016 gRPC authors. |
||||
# |
||||
# Licensed under the Apache License, Version 2.0 (the "License"); |
||||
# you may not use this file except in compliance with the License. |
||||
# You may obtain a copy of the License at |
||||
# |
||||
# http://www.apache.org/licenses/LICENSE-2.0 |
||||
# |
||||
# Unless required by applicable law or agreed to in writing, software |
||||
# distributed under the License is distributed on an "AS IS" BASIS, |
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
# See the License for the specific language governing permissions and |
||||
# limitations under the License. |
||||
|
||||
set -ex |
||||
|
||||
# Nothing to do here. C# has been removed from this repository. This script is a placeholder |
||||
# to prevent C# tests from becoming red (until they get eventually disabled). |
@ -1,19 +0,0 @@ |
||||
#!/bin/bash |
||||
# Copyright 2016 gRPC authors. |
||||
# |
||||
# Licensed under the Apache License, Version 2.0 (the "License"); |
||||
# you may not use this file except in compliance with the License. |
||||
# You may obtain a copy of the License at |
||||
# |
||||
# http://www.apache.org/licenses/LICENSE-2.0 |
||||
# |
||||
# Unless required by applicable law or agreed to in writing, software |
||||
# distributed under the License is distributed on an "AS IS" BASIS, |
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
# See the License for the specific language governing permissions and |
||||
# limitations under the License. |
||||
|
||||
set -ex |
||||
|
||||
# Nothing to do here. C# has been removed from this repository. This script is a placeholder |
||||
# to prevent C# tests from becoming red (until they get eventually disabled). |
@ -1,19 +0,0 @@ |
||||
#!/bin/bash |
||||
# Copyright 2018 The gRPC Authors |
||||
# |
||||
# Licensed under the Apache License, Version 2.0 (the "License"); |
||||
# you may not use this file except in compliance with the License. |
||||
# You may obtain a copy of the License at |
||||
# |
||||
# http://www.apache.org/licenses/LICENSE-2.0 |
||||
# |
||||
# Unless required by applicable law or agreed to in writing, software |
||||
# distributed under the License is distributed on an "AS IS" BASIS, |
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
# See the License for the specific language governing permissions and |
||||
# limitations under the License. |
||||
|
||||
set -ex |
||||
|
||||
# Nothing to do here. C# has been removed from this repository. This script is a placeholder |
||||
# to prevent C# tests from becoming red (until they get eventually disabled). |
Loading…
Reference in new issue