Home | History | Annotate | Download | only in distrib
      1 #!/bin/bash
      2 # Copyright 2015 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 echo "NOTE: to automagically apply fixes, invoke with --fix"
     17 
     18 set -ex
     19 
     20 # change to root directory
     21 cd $(dirname $0)/../..
     22 REPO_ROOT=$(pwd)
     23 
     24 if [ "$CLANG_TIDY_SKIP_DOCKER" == "" ]
     25 then
     26   # build clang-tidy docker image
     27   docker build -t grpc_clang_tidy tools/dockerfile/grpc_clang_tidy
     28 
     29   # run clang-tidy against the checked out codebase
     30   # when modifying the checked-out files, the current user will be impersonated
     31   # so that the updated files don't end up being owned by "root".
     32   docker run -e TEST="$TEST" -e CHANGED_FILES="$CHANGED_FILES" -e CLANG_TIDY_ROOT="/local-code" --rm=true -v "${REPO_ROOT}":/local-code --user "$(id -u):$(id -g)" -t grpc_clang_tidy /clang_tidy_all_the_things.sh "$@"
     33 else
     34   CLANG_TIDY_ROOT="${REPO_ROOT}" tools/dockerfile/grpc_clang_tidy/clang_tidy_all_the_things.sh "$@"
     35 fi
     36