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=main 20# import VERSION from one of the google internal CLs 21VERSION=e9ce68804cb4e64cab5a52e3c8baf840d4ff87b7 22GIT_REPO="https://github.com/cncf/xds.git" 23GIT_BASE_DIR=xds 24SOURCE_PROTO_BASE_DIR=xds 25TARGET_PROTO_BASE_DIR=src/main/proto 26# Sorted alphabetically. 27FILES=( 28udpa/annotations/migrate.proto 29udpa/annotations/security.proto 30udpa/annotations/security.proto 31udpa/annotations/sensitive.proto 32udpa/annotations/status.proto 33udpa/annotations/versioning.proto 34udpa/type/v1/typed_struct.proto 35xds/annotations/v3/migrate.proto 36xds/annotations/v3/security.proto 37xds/annotations/v3/security.proto 38xds/annotations/v3/sensitive.proto 39xds/annotations/v3/status.proto 40xds/annotations/v3/versioning.proto 41xds/core/v3/authority.proto 42xds/core/v3/collection_entry.proto 43xds/core/v3/context_params.proto 44xds/core/v3/extension.proto 45xds/core/v3/resource_locator.proto 46xds/core/v3/resource_name.proto 47xds/data/orca/v3/orca_load_report.proto 48xds/service/orca/v3/orca.proto 49xds/type/matcher/v3/matcher.proto 50xds/type/matcher/v3/regex.proto 51xds/type/matcher/v3/string.proto 52xds/type/v3/typed_struct.proto 53) 54 55pushd `git rev-parse --show-toplevel`/xds/third_party/xds 56 57# clone the xds github repo in a tmp directory 58tmpdir="$(mktemp -d)" 59trap "rm -rf $tmpdir" EXIT 60 61pushd "${tmpdir}" 62git clone -b $BRANCH $GIT_REPO 63trap "rm -rf $GIT_BASE_DIR" EXIT 64cd "$GIT_BASE_DIR" 65git checkout $VERSION 66popd 67 68cp -p "${tmpdir}/${GIT_BASE_DIR}/LICENSE" LICENSE 69 70rm -rf "${TARGET_PROTO_BASE_DIR}" 71mkdir -p "${TARGET_PROTO_BASE_DIR}" 72pushd "${TARGET_PROTO_BASE_DIR}" 73 74# copy proto files to project directory 75for file in "${FILES[@]}" 76do 77 mkdir -p "$(dirname "${file}")" 78 cp -p "${tmpdir}/${SOURCE_PROTO_BASE_DIR}/${file}" "${file}" 79done 80popd 81 82popd 83