1e5c31af7Sopenharmony_ci#!/usr/bin/env bash
2e5c31af7Sopenharmony_ci# Copyright 2020 The Amber Authors
3e5c31af7Sopenharmony_ci#
4e5c31af7Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
5e5c31af7Sopenharmony_ci# you may not use this file except in compliance with the License.
6e5c31af7Sopenharmony_ci# You may obtain a copy of the License at
7e5c31af7Sopenharmony_ci#
8e5c31af7Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
9e5c31af7Sopenharmony_ci#
10e5c31af7Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
11e5c31af7Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
12e5c31af7Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13e5c31af7Sopenharmony_ci# See the License for the specific language governing permissions and
14e5c31af7Sopenharmony_ci# limitations under the License.
15e5c31af7Sopenharmony_ci
16e5c31af7Sopenharmony_ci# Defined to use origin/master instead of origin/main
17e5c31af7Sopenharmony_ci# TODO(https://github.com/google/amber/issues/1014): Khronos repos are switching
18e5c31af7Sopenharmony_ci# to main
19e5c31af7Sopenharmony_cicpplint=1
20e5c31af7Sopenharmony_cidxc=1
21e5c31af7Sopenharmony_cigoogletest=1
22e5c31af7Sopenharmony_cijson=1
23e5c31af7Sopenharmony_cilodepng=1
24e5c31af7Sopenharmony_ciswiftshader=1
25e5c31af7Sopenharmony_ci
26e5c31af7Sopenharmony_ci# This script assumes it's parent directory is the repo root.
27e5c31af7Sopenharmony_cirepo_path=$(dirname "$0")/..
28e5c31af7Sopenharmony_ci
29e5c31af7Sopenharmony_cicd "$repo_path"
30e5c31af7Sopenharmony_ci
31e5c31af7Sopenharmony_ciif [[ $(git diff --stat) != '' ]]; then
32e5c31af7Sopenharmony_ci    echo "Working tree is dirty, commit changes before attempting to roll DEPS"
33e5c31af7Sopenharmony_ci    exit 1
34e5c31af7Sopenharmony_cifi
35e5c31af7Sopenharmony_ci
36e5c31af7Sopenharmony_ciold_head=$(git rev-parse HEAD)
37e5c31af7Sopenharmony_ci
38e5c31af7Sopenharmony_cifor i in $(find third_party -maxdepth 1 -mindepth 1 -type d); do
39e5c31af7Sopenharmony_ci  name=`echo "${i%%/}" | cut -f2 -d'/' | tr '-' '_'`
40e5c31af7Sopenharmony_ci
41e5c31af7Sopenharmony_ci  if [ "x${name}" == "xcpplint" ]; then
42e5c31af7Sopenharmony_ci    continue
43e5c31af7Sopenharmony_ci  fi
44e5c31af7Sopenharmony_ci
45e5c31af7Sopenharmony_ci  trunk="origin/main"
46e5c31af7Sopenharmony_ci  if [ ! -z ${!name} ]; then
47e5c31af7Sopenharmony_ci    trunk="origin/master"
48e5c31af7Sopenharmony_ci  fi
49e5c31af7Sopenharmony_ci
50e5c31af7Sopenharmony_ci  roll-dep --ignore-dirty-tree --roll-to="${trunk}" "${i%%/}";
51e5c31af7Sopenharmony_cidone
52e5c31af7Sopenharmony_ci
53e5c31af7Sopenharmony_cigit rebase --interactive "${old_head}"
54