Imported Upstream version 1.34.0
[platform/upstream/grpc.git] / src / csharp / build_nuget.sh
1 #!/bin/bash
2 # Copyright 2020 The 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
16 set -ex
17
18 cd "$(dirname "$0")"
19
20 mkdir -p ../../artifacts
21
22 # Collect the artifacts built by the previous build step
23 mkdir -p nativelibs
24 cp -r "${EXTERNAL_GIT_ROOT}"/input_artifacts/csharp_ext_* nativelibs || true
25
26 # Collect protoc artifacts built by the previous build step
27 mkdir -p protoc_plugins
28 cp -r "${EXTERNAL_GIT_ROOT}"/input_artifacts/protoc_* protoc_plugins || true
29
30 # Add current timestamp to dev nugets
31 ./expand_dev_version.sh
32
33 dotnet restore Grpc.sln
34
35 # To be able to build the Grpc.Core project, we also need to put grpc_csharp_ext to where Grpc.Core.csproj
36 # expects it.
37 mkdir -p ../../cmake/build
38 cp nativelibs/csharp_ext_linux_x64/libgrpc_csharp_ext.so ../../cmake/build
39
40 dotnet pack --configuration Release Grpc.Core.Api --output ../../../artifacts
41 dotnet pack --configuration Release Grpc.Core --output ../../../artifacts
42 dotnet pack --configuration Release Grpc.Core.Testing --output ../../../artifacts
43 dotnet pack --configuration Release Grpc.Auth --output ../../../artifacts
44 dotnet pack --configuration Release Grpc.HealthCheck --output ../../../artifacts
45 dotnet pack --configuration Release Grpc.Reflection --output ../../../artifacts
46 dotnet pack --configuration Release Grpc.Tools --output ../../../artifacts
47 # rem build auxiliary packages
48 dotnet pack --configuration Release Grpc --output ../../../artifacts
49 dotnet pack --configuration Release Grpc.Core.NativeDebug --output ../../../artifacts
50 dotnet pack --configuration Release Grpc.Core.Xamarin --output ../../../artifacts
51
52 # Create a zipfile with all the nugets we just created
53 cd ../../artifacts
54 zip csharp_nugets_windows_dotnetcli.zip *.nupkg