1#!/bin/bash
2# Copyright 2018 The Amber 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
16set -e  # fail on error
17set -x  # display commands
18
19BUILD_ROOT=$PWD
20SRC=$PWD/github/amber
21
22cd $SRC
23./tools/git-sync-deps
24
25echo $(date): Check copyright...
26./tools/copyright.py --check;
27echo $(date): check completed.
28
29echo $(date): Linting...
30./tools/run-lint.sh;
31echo $(date): check complete.
32
33# Check format adds a bunch of stuff to the repo so do that check last.
34
35# Get clang-format-5.0.0.
36# Once kokoro upgrades the Ubuntu VMs, we can use 'apt-get install clang-format'
37curl -L http://releases.llvm.org/5.0.0/clang+llvm-5.0.0-linux-x86_64-ubuntu14.04.tar.xz -o clang-llvm.tar.xz
38tar xf clang-llvm.tar.xz
39export PATH=$PWD/clang+llvm-5.0.0-linux-x86_64-ubuntu14.04/bin:$PATH
40
41cd $SRC
42curl -L http://llvm.org/svn/llvm-project/cfe/trunk/tools/clang-format/clang-format-diff.py -o tools/clang-format-diff.py;
43
44echo $(date): Check formatting...
45./tools/check_code_format.sh;
46echo $(date): check completed.
47