1*cc02d7e2SAndroid Build Coastguard Worker#!/bin/bash 2*cc02d7e2SAndroid Build Coastguard Worker# Copyright 2020 The gRPC Authors 3*cc02d7e2SAndroid Build Coastguard Worker# 4*cc02d7e2SAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License"); 5*cc02d7e2SAndroid Build Coastguard Worker# you may not use this file except in compliance with the License. 6*cc02d7e2SAndroid Build Coastguard Worker# You may obtain a copy of the License at 7*cc02d7e2SAndroid Build Coastguard Worker# 8*cc02d7e2SAndroid Build Coastguard Worker# http://www.apache.org/licenses/LICENSE-2.0 9*cc02d7e2SAndroid Build Coastguard Worker# 10*cc02d7e2SAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software 11*cc02d7e2SAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS, 12*cc02d7e2SAndroid Build Coastguard Worker# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*cc02d7e2SAndroid Build Coastguard Worker# See the License for the specific language governing permissions and 14*cc02d7e2SAndroid Build Coastguard Worker# limitations under the License. 15*cc02d7e2SAndroid Build Coastguard Worker 16*cc02d7e2SAndroid Build Coastguard Workerset -ex 17*cc02d7e2SAndroid Build Coastguard Worker 18*cc02d7e2SAndroid Build Coastguard Workercd "$(dirname "$0")" 19*cc02d7e2SAndroid Build Coastguard Worker 20*cc02d7e2SAndroid Build Coastguard Workermkdir -p ../../artifacts 21*cc02d7e2SAndroid Build Coastguard Worker 22*cc02d7e2SAndroid Build Coastguard Worker# Collect protoc artifacts built by the previous build step 23*cc02d7e2SAndroid Build Coastguard Workermkdir -p protoc_plugins 24*cc02d7e2SAndroid Build Coastguard Workercp -r "${EXTERNAL_GIT_ROOT}"/input_artifacts/protoc_* protoc_plugins || true 25*cc02d7e2SAndroid Build Coastguard Worker 26*cc02d7e2SAndroid Build Coastguard Worker# Add current timestamp to dev nugets 27*cc02d7e2SAndroid Build Coastguard Worker./nuget_helpers/expand_dev_version.sh 28*cc02d7e2SAndroid Build Coastguard Worker 29*cc02d7e2SAndroid Build Coastguard Worker# For building the nugets we normally need native libraries and binaries 30*cc02d7e2SAndroid Build Coastguard Worker# built on multiple different platforms (linux, mac, windows), which makes 31*cc02d7e2SAndroid Build Coastguard Worker# it difficult to support a local build of the nuget. 32*cc02d7e2SAndroid Build Coastguard Worker# To allow simple local builds (restricted to a single platform), 33*cc02d7e2SAndroid Build Coastguard Worker# we provide a way of building "partial" nugets that only include artifacts 34*cc02d7e2SAndroid Build Coastguard Worker# that can be built locally on a given platform (e.g. linux), and 35*cc02d7e2SAndroid Build Coastguard Worker# contain placeholders (empty files) for artifacts that normally need 36*cc02d7e2SAndroid Build Coastguard Worker# to be built on a different platform. Because such nugets obviously 37*cc02d7e2SAndroid Build Coastguard Worker# only work on a single platform (and are broken on other platform), 38*cc02d7e2SAndroid Build Coastguard Worker# whenever we are building such nugets, we clearly mark them as 39*cc02d7e2SAndroid Build Coastguard Worker# "singleplatform only" to avoid mixing them up with the full "multiplatform" 40*cc02d7e2SAndroid Build Coastguard Worker# nugets by accident. 41*cc02d7e2SAndroid Build Coastguard Workerif [ "${GRPC_CSHARP_BUILD_SINGLE_PLATFORM_NUGET}" != "" ] 42*cc02d7e2SAndroid Build Coastguard Workerthen 43*cc02d7e2SAndroid Build Coastguard Worker # create placeholders for artifacts that can't be built 44*cc02d7e2SAndroid Build Coastguard Worker # on the current platform. 45*cc02d7e2SAndroid Build Coastguard Worker ./nuget_helpers/create_fake_native_artifacts.sh || true 46*cc02d7e2SAndroid Build Coastguard Worker 47*cc02d7e2SAndroid Build Coastguard Worker # add a suffix to the nuget's version 48*cc02d7e2SAndroid Build Coastguard Worker # to avoid confusing the package with a full nuget package. 49*cc02d7e2SAndroid Build Coastguard Worker # NOTE: adding the suffix must be done AFTER expand_dev_version.sh has run. 50*cc02d7e2SAndroid Build Coastguard Worker sed -ibak "s/<\/GrpcCsharpVersion>/-singleplatform<\/GrpcCsharpVersion>/" build/dependencies.props 51*cc02d7e2SAndroid Build Coastguard Workerfi 52*cc02d7e2SAndroid Build Coastguard Worker 53*cc02d7e2SAndroid Build Coastguard Workerdotnet restore Grpc.sln 54*cc02d7e2SAndroid Build Coastguard Worker 55*cc02d7e2SAndroid Build Coastguard Workerdotnet pack --configuration Release Grpc.Tools --output ../../artifacts 56*cc02d7e2SAndroid Build Coastguard Worker 57*cc02d7e2SAndroid Build Coastguard Worker# Create a zipfile with all the nugets we just created 58*cc02d7e2SAndroid Build Coastguard Workercd ../../artifacts 59*cc02d7e2SAndroid Build Coastguard Workerzip csharp_nugets_windows_dotnetcli.zip *.nupkg 60