1#!/bin/bash 2# Copyright 2016 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. 15set -ex 16 17# the platform for which we wanna build the native gem 18GEM_PLATFORM="$1" 19 20SYSTEM=$(uname | cut -f 1 -d_) 21 22cd "$(dirname "$0")/../../.." 23 24if [ "$SYSTEM" == "MSYS" ] ; then 25 SYSTEM=MINGW32 26fi 27if [ "$SYSTEM" == "MINGW64" ] ; then 28 SYSTEM=MINGW32 29fi 30 31if [ "$SYSTEM" == "MINGW32" ] ; then 32 echo "Need Linux to build the Windows ruby gem." 33 exit 1 34fi 35 36# log ruby version for easier debugging if things go wrong 37# we assume that the current ruby version has already been selected 38# (e.g. by the top-level CI script or with rvm locally) 39ruby --version 40 41# log gem versions for easier debugging if things go wrong 42gem list || true 43 44# avoid polluting the global gem diretory 45# by configuring "bundle install" to install all the gems 46# into a project-local directory 47export BUNDLE_PATH=bundle_local_gems 48tools/run_tests/helper_scripts/bundle_install_wrapper.sh 49 50bundle exec rake "gem:native[${GEM_PLATFORM}]" 51 52if [ "$SYSTEM" == "Darwin" ] ; then 53 # TODO: consider rewriting this to pass shellcheck 54 # shellcheck disable=SC2046,SC2010 55 rm $(ls pkg/*.gem | grep -v darwin) 56fi 57 58mkdir -p "${ARTIFACTS_OUT}" 59 60cp pkg/*.gem "${ARTIFACTS_OUT}"/ 61