| 1 |
#!/usr/bin/env bash |
| 2 |
|
| 3 |
# Copyright 2019 The Shaderc Authors. All rights reserved. |
| 4 |
# |
| 5 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 |
# you may not use this file except in compliance with the License. |
| 7 |
# You may obtain a copy of the License at |
| 8 |
# |
| 9 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 |
# |
| 11 |
# Unless required by applicable law or agreed to in writing, software |
| 12 |
# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 |
# See the License for the specific language governing permissions and |
| 15 |
# limitations under the License. |
| 16 |
|
| 17 |
# Attempts to roll all entries in DEPS to tip-of-tree and create a commit. |
| 18 |
# |
| 19 |
# Depends on roll-dep from depot_path being in PATH. |
| 20 |
|
| 21 |
set -eo pipefail |
| 22 |
|
| 23 |
function 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 |
dependencies=("third_party/effcee/" |
| 32 |
"third_party/glslang/" |
| 33 |
"third_party/googletest/" |
| 34 |
"third_party/re2/" |
| 35 |
"third_party/spirv-headers/" |
| 36 |
"third_party/spirv-tools/") |
| 37 |
branch="origin/main" |
| 38 |
|
| 39 |
# This script assumes it's parent directory is the repo root. |
| 40 |
repo_path=$(dirname "$0")/.. |
| 41 |
|
| 42 |
cd "$repo_path" |
| 43 |
|
| 44 |
if [[ $(git diff --stat) != '' ]]; then |
| 45 |
echo "Working tree is dirty, commit changes before attempting to roll DEPS" |
| 46 |
exit 1 |
| 47 |
fi |
| 48 |
|
| 49 |
echo "*** Ignore messages about running 'git cl upload' ***" |
| 50 |
|
| 51 |
set +e |
| 52 |
|
| 53 |
for dep in ${dependencies[@]}; do |
| 54 |
echo "Rolling $dep" |
| 55 |
roll-dep --ignore-dirty-tree --roll-to="${branch}" "${dep}" |
| 56 |
ExitIfIsInterestingError $? |
| 57 |
done |