Craig Tiller | ddf3a51 | 2015-09-24 13:03:44 -0700 | [diff] [blame] | 1 | #!/bin/bash |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 2 | # Copyright 2015 gRPC authors. |
Craig Tiller | cb6ce54 | 2015-12-22 15:03:40 -0800 | [diff] [blame] | 3 | # |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 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 |
Craig Tiller | cb6ce54 | 2015-12-22 15:03:40 -0800 | [diff] [blame] | 7 | # |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
Craig Tiller | cb6ce54 | 2015-12-22 15:03:40 -0800 | [diff] [blame] | 9 | # |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 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. |
Craig Tiller | ddf3a51 | 2015-09-24 13:03:44 -0700 | [diff] [blame] | 15 | |
| 16 | set -ex |
| 17 | |
| 18 | # change to root directory |
| 19 | cd $(dirname $0)/../.. |
Jan Tattermusch | 7dd2cc6 | 2016-12-20 17:15:39 +0100 | [diff] [blame] | 20 | REPO_ROOT=$(pwd) |
Craig Tiller | ddf3a51 | 2015-09-24 13:03:44 -0700 | [diff] [blame] | 21 | |
Jan Tattermusch | 7dd2cc6 | 2016-12-20 17:15:39 +0100 | [diff] [blame] | 22 | if [ "$CLANG_FORMAT_SKIP_DOCKER" == "" ] |
| 23 | then |
| 24 | # build clang-format docker image |
| 25 | docker build -t grpc_clang_format tools/dockerfile/grpc_clang_format |
Craig Tiller | ddf3a51 | 2015-09-24 13:03:44 -0700 | [diff] [blame] | 26 | |
Jan Tattermusch | 7dd2cc6 | 2016-12-20 17:15:39 +0100 | [diff] [blame] | 27 | # run clang-format against the checked out codebase |
| 28 | docker run -e TEST=$TEST -e CHANGED_FILES="$CHANGED_FILES" -e CLANG_FORMAT_ROOT="/local-code" --rm=true -v "${REPO_ROOT}":/local-code -t grpc_clang_format /clang_format_all_the_things.sh |
| 29 | else |
| 30 | CLANG_FORMAT_ROOT="${REPO_ROOT}" tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh |
| 31 | fi |