xref: /aosp_15_r20/external/grpc-grpc/test/distrib/csharp/run_distrib_test_dotnetcli.sh (revision cc02d7e222339f7a4f6ba5f422e6413f4bd931f2)
1#!/bin/bash
2# Copyright 2015 gRPC authors.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16set -ex
17
18cd "$(dirname "$0")"
19
20unzip -o "$EXTERNAL_GIT_ROOT/input_artifacts/csharp_nugets_windows_dotnetcli.zip" -d TestNugetFeed
21
22./update_version.sh auto
23
24cd DistribTest
25
26# TODO(jtattermusch): make sure we don't pollute the global nuget cache with
27# the nugets being tested.
28CLR_OPENSSL_VERSION_OVERRIDE=1.1 dotnet restore DistribTestDotNet.csproj
29
30dotnet build DistribTestDotNet.csproj
31
32ls -R bin
33
34if [ "${SKIP_NET45_DISTRIBTEST}" != "1" ]
35then
36  dotnet publish -f net45 DistribTestDotNet.csproj
37
38  # .NET 4.5 target after dotnet build
39  mono bin/Debug/net45/publish/DistribTestDotNet.exe
40
41  # .NET 4.5 target after dotnet publish
42  mono bin/Debug/net45/publish/DistribTestDotNet.exe
43fi
44
45if [ "${SKIP_NETCOREAPP21_DISTRIBTEST}" != "1" ]
46then
47  dotnet publish -f netcoreapp2.1 DistribTestDotNet.csproj
48
49  # .NET Core target after dotnet build
50  dotnet exec bin/Debug/netcoreapp2.1/DistribTestDotNet.dll
51
52  # .NET Core target after dotnet publish
53  dotnet exec bin/Debug/netcoreapp2.1/publish/DistribTestDotNet.dll
54fi
55
56if [ "${SKIP_NETCOREAPP31_DISTRIBTEST}" != "1" ]
57then
58  dotnet publish -f netcoreapp3.1 DistribTestDotNet.csproj
59
60  # .NET Core target after dotnet build
61  dotnet exec bin/Debug/netcoreapp3.1/DistribTestDotNet.dll
62
63  # .NET Core target after dotnet publish
64  dotnet exec bin/Debug/netcoreapp3.1/publish/DistribTestDotNet.dll
65fi
66
67if [ "${SKIP_NET50_DISTRIBTEST}" != "1" ]
68then
69  dotnet publish -f net5.0 DistribTestDotNet.csproj
70
71  dotnet publish -r linux-x64 -f net5.0 DistribTestDotNet.csproj -p:PublishSingleFile=true --self-contained true --output net5_singlefile_publish
72
73  # .NET Core target after dotnet build
74  dotnet exec bin/Debug/net5.0/DistribTestDotNet.dll
75
76  # .NET Core target after dotnet publish
77  dotnet exec bin/Debug/net5.0/publish/DistribTestDotNet.dll
78
79  # binary generated by the single file publish
80  ./net5_singlefile_publish/DistribTestDotNet
81fi
82