1#!/bin/bash 2# Copyright 2018 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# Update VERSION then in this directory run ./import.sh 17 18set -e 19BRANCH=master 20# import VERSION from the istio repository 21VERSION=cbee1999ad8b0f1ec790ec47f9ea33fed887f4a7 22GIT_REPO="https://github.com/istio/istio.git" 23GIT_BASE_DIR=istio 24SOURCE_PROTO_BASE_DIR=istio/pkg 25TARGET_PROTO_BASE_DIR=src/main/proto 26# Sorted alphabetically. 27FILES=( 28test/echo/proto/echo.proto 29) 30 31pushd `git rev-parse --show-toplevel`/istio-interop-testing/third_party/istio 32 33# clone the istio github repo in a tmp directory 34tmpdir="$(mktemp -d)" 35trap "rm -rf ${tmpdir}" EXIT 36 37pushd "${tmpdir}" 38git clone -b $BRANCH $GIT_REPO 39trap "rm -rf $GIT_BASE_DIR" EXIT 40cd "$GIT_BASE_DIR" 41git checkout $VERSION 42popd 43 44cp -p "${tmpdir}/${GIT_BASE_DIR}/LICENSE" LICENSE 45 46rm -rf "${TARGET_PROTO_BASE_DIR}" 47mkdir -p "${TARGET_PROTO_BASE_DIR}" 48pushd "${TARGET_PROTO_BASE_DIR}" 49 50# copy proto files to project directory 51for file in "${FILES[@]}" 52do 53 mkdir -p "$(dirname "${file}")" 54 cp -p "${tmpdir}/${SOURCE_PROTO_BASE_DIR}/${file}" "${file}" 55done 56popd 57 58popd 59