1#!/usr/bin/env bash 2# Copyright (c) 2021 Google LLC 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# Attempts to roll all entries in DEPS to tip-of-tree and create a commit. 17# 18# Depends on roll-dep from depot_tools 19# (https://chromium.googlesource.com/chromium/tools/depot_tools) being in PATH. 20 21set -eo pipefail 22 23function ExitIfIsInterestingError() { 24 local return_code=$1 25 if [[ ${return_code} -ne 0 && ${return_code} -ne 2 ]]; then 26 exit ${return_code} 27 fi 28 return 0 29} 30 31 32# We are not rolling google test for now. The latest version requires C++14. 33dependencies=("external/effcee/" 34 "external/googletest/" 35 "external/re2/" 36 "external/spirv-headers/") 37 38 39branch="origin/main" 40 41# This script assumes it's parent directory is the repo root. 42repo_path=$(dirname "$0")/.. 43 44cd "$repo_path" 45 46if [[ $(git diff --stat) != '' ]]; then 47 echo "Working tree is dirty, commit changes before attempting to roll DEPS" 48 exit 1 49fi 50 51echo "*** Ignore messages about running 'git cl upload' ***" 52 53old_head=$(git rev-parse HEAD) 54 55set +e 56 57for dep in ${dependencies[@]}; do 58 echo "Rolling $dep" 59 roll-dep --ignore-dirty-tree --roll-to="${branch}" "${dep}" 60 ExitIfIsInterestingError $? 61done 62