1*cc02d7e2SAndroid Build Coastguard Worker#!/bin/bash 2*cc02d7e2SAndroid Build Coastguard Worker# Copyright 2015 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 -e 17*cc02d7e2SAndroid Build Coastguard Worker 18*cc02d7e2SAndroid Build Coastguard Workercd "$(dirname "$0")" 19*cc02d7e2SAndroid Build Coastguard Worker 20*cc02d7e2SAndroid Build Coastguard WorkerCSHARP_VERSION="$1" 21*cc02d7e2SAndroid Build Coastguard Workerif [ "$CSHARP_VERSION" == "auto" ] 22*cc02d7e2SAndroid Build Coastguard Workerthen 23*cc02d7e2SAndroid Build Coastguard Worker # autodetect C# version from the name of Grpc.Tools.0.0.0-x.nupkg file 24*cc02d7e2SAndroid Build Coastguard Worker # TODO: find a better shellcheck-compliant way to write the following line 25*cc02d7e2SAndroid Build Coastguard Worker # shellcheck disable=SC2010 26*cc02d7e2SAndroid Build Coastguard Worker CSHARP_VERSION=$(ls TestNugetFeed | grep -m 1 '^Grpc\.Tools\.[0-9].*\.nupkg$' | sed s/^Grpc\.Tools\.// | sed s/\.nupkg$// | sed s/\.symbols$//) 27*cc02d7e2SAndroid Build Coastguard Worker echo "Autodetected nuget ${CSHARP_VERSION}" 28*cc02d7e2SAndroid Build Coastguard Workerfi 29*cc02d7e2SAndroid Build Coastguard Worker 30*cc02d7e2SAndroid Build Coastguard Worker# Replaces version placeholder with value provided as first argument. 31*cc02d7e2SAndroid Build Coastguard Workersed -ibak "s/__GRPC_NUGET_VERSION__/${CSHARP_VERSION}/g" DistribTest/DistribTestDotNet.csproj 32