From 5c88149c4d3acd258cd5825e9d9cfcaa5af6265d Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Tue, 8 Oct 2019 18:03:49 +0200 Subject: [PATCH 01/50] add new format script --- utils/clang-format-everything.sh | 38 ++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 utils/clang-format-everything.sh diff --git a/utils/clang-format-everything.sh b/utils/clang-format-everything.sh new file mode 100755 index 000000000000..633310168c1d --- /dev/null +++ b/utils/clang-format-everything.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +## locate executable +clang_format="${ARANGODB_CLANG_FORMAT:-""}" + +for candidate in "clang-format-arangodb" "clang-format-6" "clang-format"; do + path=$(type -p candidate) + if [[ -n $path ]]; then + clang_format="$path" + break; + fi +done + +# fallback if nothing is found +if [[ -z $clang_format ]]; then + clang_format="clang-format" +fi + +## check version +echo "checking version of $clang_format" +version_string=$(${clang_format} --version) +re=".*version 6.0.1.*" +if ! [[ $version_string =~ $re ]]; then + echo "your version: '$version_string' does not match version 6.0.1" + exit 1 +fi + + +## find relevant files +files="$( + find arangod arangosh lib enterprise \ + -name Zip -prune -o \ + -type f "(" -name "*.cpp" -o -name "*.h" ")" \ + "!" "(" -name "tokens.*" -o -name "v8-json.*" -o -name "voc-errors.*" -o -name "grammar.*" -o -name "xxhash.*" -o -name "exitcodes.*" ")" +)" + +## do final formatting +${clang_format} -i -verbose ${files[@]} From 87570a8892cc2c80a6b6a4238f89bf41a2e89b56 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Wed, 9 Oct 2019 07:39:41 +0200 Subject: [PATCH 02/50] make version selectable and add more search location --- utils/clang-format-everything.sh | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/utils/clang-format-everything.sh b/utils/clang-format-everything.sh index 633310168c1d..217826d3212e 100755 --- a/utils/clang-format-everything.sh +++ b/utils/clang-format-everything.sh @@ -1,25 +1,35 @@ #!/usr/bin/env bash +set -u ## locate executable clang_format="${ARANGODB_CLANG_FORMAT:-""}" +clang_format_version="${ARANGODB_CLANG_FORMAT_VERSION:-"6.0.1"}" -for candidate in "clang-format-arangodb" "clang-format-6" "clang-format"; do - path=$(type -p candidate) - if [[ -n $path ]]; then - clang_format="$path" - break; - fi -done +# fallback if nothing is found +if [[ -z $clang_format ]]; then + for candidate in "$HOME/.local/bin/clang-format" "clang-format-arangodb" "clang-format-6" "clang-format"; do + echo "checking candidate $candidate" + path="$(type -p ${candidate})" + if [[ -n $path ]]; then + clang_format="$path" + echo "selecting this candidate" + break; + fi + done +else + echo "clang-format provided by environment" +fi # fallback if nothing is found if [[ -z $clang_format ]]; then + echo "using fallback" clang_format="clang-format" fi ## check version echo "checking version of $clang_format" version_string=$(${clang_format} --version) -re=".*version 6.0.1.*" +re=".*version ${clang_format_version}.*" if ! [[ $version_string =~ $re ]]; then echo "your version: '$version_string' does not match version 6.0.1" exit 1 From 54ce5deaf388e34e80f580eb4460ca4f5b284bf5 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Wed, 9 Oct 2019 09:10:12 +0200 Subject: [PATCH 03/50] Add notes on what needs to be done to get clang-tidy/format --- README_maintainers.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README_maintainers.md b/README_maintainers.md index fcee3bcaabf9..22efdcc816b6 100644 --- a/README_maintainers.md +++ b/README_maintainers.md @@ -841,3 +841,21 @@ Currently available analyzers are: ./scripts/examine_results.js -- 'yaml,locateLongRunning' --readFile out/UNITTEST_RESULT.json + +### Tooling + +## clang-format / clang-tidy + +You can get prebuild llvm/clang packages at: +http://releases.llvm.org/download.html + +If you want to build the tools for yourself, because there are no packages for +your platform, then you need to clone +`https://github.com/llvm/llvm-project.git` and configure the build with a +command similar to the following. + +``` +cmake -G Ninja -DCMAKE_INSTALL_PREFIX=$HOME/.local -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra" ../llvm-project/llvm/ +ninja -j8 +ninja install +``` From 641e1dd8638bd86009282e7bc6aa28688248331f Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Wed, 9 Oct 2019 11:33:59 +0200 Subject: [PATCH 04/50] add script for formating touched files only --- utils/clang-format-diff.sh | 61 ++++++++++++++++++++++++++++++++ utils/clang-format-everything.sh | 6 ++-- 2 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 utils/clang-format-diff.sh diff --git a/utils/clang-format-diff.sh b/utils/clang-format-diff.sh new file mode 100644 index 000000000000..e77669483e0f --- /dev/null +++ b/utils/clang-format-diff.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env bash +set -u + +## locate executable +clang_format="${ARANGODB_CLANG_FORMAT:-""}" +clang_format_version="${ARANGODB_CLANG_FORMAT_VERSION:-"6.0.1"}" + +# fallback if nothing is found +if [[ -z $clang_format ]]; then + for candidate in "$HOME/.local/bin/clang-format" "clang-format-arangodb" "clang-format-6" "clang-format"; do + echo "checking candidate $candidate" + path="$(type -p ${candidate})" + if [[ -n $path ]]; then + clang_format="$path" + echo "selecting this candidate" + break; + fi + done +else + echo "clang-format provided by environment" +fi + +# fallback if nothing is found +if [[ -z $clang_format ]]; then + echo "using fallback" + clang_format="clang-format" +fi + +## check version +echo "checking version of $clang_format" +version_string=$(${clang_format} --version) +re=".*version ${clang_format_version}.*" +if ! [[ $version_string =~ $re ]]; then + echo "your version: '$version_string' does not match version 6.0.1" + exit 1 +fi + + +## find relevant files +files="$( + find arangod arangosh lib enterprise \ + -name Zip -prune -o \ + -type f "(" -name "*.cpp" -o -name "*.h" ")" \ + "!" "(" -name "tokens.*" -o -name "v8-json.*" -o -name "voc-errors.*" -o -name "grammar.*" -o -name "xxhash.*" -o -name "exitcodes.*" ")" +)" + +git_files=$(git diff --name-only) +files_final=() +for gf in ${git_files[@]}; do + echo "---------------------" + for f in ${files[@]}; do + echo "$gf -- $f" + if [[ $gf == $f ]]; then + files_final+=( "$f" ) + continue + fi + done +done + +# do final formatting +${clang_format} -i -verbose -style=file ${files_final[@]} diff --git a/utils/clang-format-everything.sh b/utils/clang-format-everything.sh index 217826d3212e..8996b5059a0d 100755 --- a/utils/clang-format-everything.sh +++ b/utils/clang-format-everything.sh @@ -44,5 +44,7 @@ files="$( "!" "(" -name "tokens.*" -o -name "v8-json.*" -o -name "voc-errors.*" -o -name "grammar.*" -o -name "xxhash.*" -o -name "exitcodes.*" ")" )" -## do final formatting -${clang_format} -i -verbose ${files[@]} +git_files=$(git diff --name-only) + +# do final formatting +${clang_format} -i -verbose -style=file ${files[@]} From 38b22b3dc58a6ec875ad7ecdae727aaf1becc793 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Wed, 9 Oct 2019 11:40:04 +0200 Subject: [PATCH 05/50] remove leftover from experiments --- utils/clang-format-everything.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/utils/clang-format-everything.sh b/utils/clang-format-everything.sh index 8996b5059a0d..bede6f9a9550 100755 --- a/utils/clang-format-everything.sh +++ b/utils/clang-format-everything.sh @@ -44,7 +44,5 @@ files="$( "!" "(" -name "tokens.*" -o -name "v8-json.*" -o -name "voc-errors.*" -o -name "grammar.*" -o -name "xxhash.*" -o -name "exitcodes.*" ")" )" -git_files=$(git diff --name-only) - # do final formatting ${clang_format} -i -verbose -style=file ${files[@]} From 971ba6bd70933f39db9cf6f6b0391b63ba5680af Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Wed, 9 Oct 2019 12:17:52 +0200 Subject: [PATCH 06/50] add script for clang tidy --- compile_commands.json | 1 + utils/clang-tidy.sh | 48 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 120000 compile_commands.json create mode 100755 utils/clang-tidy.sh diff --git a/compile_commands.json b/compile_commands.json new file mode 120000 index 000000000000..25eb4b2b4b7b --- /dev/null +++ b/compile_commands.json @@ -0,0 +1 @@ +build/compile_commands.json \ No newline at end of file diff --git a/utils/clang-tidy.sh b/utils/clang-tidy.sh new file mode 100755 index 000000000000..e94b09bd532f --- /dev/null +++ b/utils/clang-tidy.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +#!/usr/bin/env bash +set -u + +## locate executable +clang_tidy="${ARANGODB_CLANG_TIDY:-""}" +clang_tidy_version="${ARANGODB_CLANG_TIDY_VERSION:-"9.0.0"}" + +# fallback if nothing is found +if [[ -z $clang_tidy ]]; then + for candidate in "$HOME/.local/bin/clang-tidy" "clang-tidy-arangodb" "clang-tidy-9" "clang-tidy"; do + echo "checking candidate $candidate" + path="$(type -p ${candidate})" + if [[ -n $path ]]; then + clang_tidy="$path" + echo "selecting this candidate" + break; + fi + done +else + echo "clang-tidy provided by environment" +fi + +# fallback if nothing is found +if [[ -z $clang_tidy ]]; then + echo "using fallback" + clang_tidy="clang-tidy" +fi + +## check version +echo "checking version of $clang_tidy" +version_string=$(${clang_tidy} --version) +re=".*version ${clang_tidy_version}.*" +if ! [[ $version_string =~ $re ]]; then + echo "your version: '$version_string' does not match version 6.0.1" + exit 1 +fi + +## find relevant files +files="$( + find arangod arangosh lib enterprise \ + -name Zip -prune -o \ + -type f "(" -name "*.cpp" -o -name "*.h" ")" \ + "!" "(" -name "tokens.*" -o -name "v8-json.*" -o -name "voc-errors.*" -o -name "grammar.*" -o -name "xxhash.*" -o -name "exitcodes.*" ")" +)" + +${clang_tidy} ${files} From 5e61964458f10623e053492ce80119876f8a5a98 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Wed, 9 Oct 2019 13:56:19 +0200 Subject: [PATCH 07/50] reduce checks done to basic checks --- utils/clang-tidy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/clang-tidy.sh b/utils/clang-tidy.sh index e94b09bd532f..d4b3ead37d08 100755 --- a/utils/clang-tidy.sh +++ b/utils/clang-tidy.sh @@ -45,4 +45,4 @@ files="$( "!" "(" -name "tokens.*" -o -name "v8-json.*" -o -name "voc-errors.*" -o -name "grammar.*" -o -name "xxhash.*" -o -name "exitcodes.*" ")" )" -${clang_tidy} ${files} +${clang_tidy} -checks=-*,clang-analyzer-*,-clang-analyzer-cplusplus* ${files} From dd0b8d43688d39db99516b25de6ddb6b6432a60f Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Thu, 10 Oct 2019 09:13:27 +0200 Subject: [PATCH 08/50] add script works on a diff --- ...rmat-diff.sh => clang-format-changed-only} | 0 utils/clang-format-check | 52 +++++++ ...-everything.sh => clang-format-everything} | 0 utils/{clang-tidy.sh => clang-tidy} | 0 utils/lib/clang-format-diff.py | 127 ++++++++++++++++++ utils/{ => lib}/reformat.sh | 0 6 files changed, 179 insertions(+) rename utils/{clang-format-diff.sh => clang-format-changed-only} (100%) mode change 100644 => 100755 create mode 100755 utils/clang-format-check rename utils/{clang-format-everything.sh => clang-format-everything} (100%) rename utils/{clang-tidy.sh => clang-tidy} (100%) create mode 100755 utils/lib/clang-format-diff.py rename utils/{ => lib}/reformat.sh (100%) diff --git a/utils/clang-format-diff.sh b/utils/clang-format-changed-only old mode 100644 new mode 100755 similarity index 100% rename from utils/clang-format-diff.sh rename to utils/clang-format-changed-only diff --git a/utils/clang-format-check b/utils/clang-format-check new file mode 100755 index 000000000000..487b66573641 --- /dev/null +++ b/utils/clang-format-check @@ -0,0 +1,52 @@ +#!/usr/bin/env bash +set -u + +# Make any failure in piped commands be reflected in the exit code. +set -o pipefail + +readonly bash_source_dir="$(dirname $(readlink -f ${BASH_SOURCE[0]}))" + + +## locate executable +clang_format="${ARANGODB_CLANG_FORMAT:-""}" +clang_format_version="${ARANGODB_CLANG_FORMAT_VERSION:-"6.0.1"}" + +# fallback if nothing is found +if [[ -z $clang_format ]]; then + for candidate in "$HOME/.local/bin/clang-format" "clang-format-arangodb" "clang-format-6" "clang-format"; do + echo "checking candidate $candidate" + path="$(type -p ${candidate})" + if [[ -n $path ]]; then + clang_format="$path" + echo "selecting this candidate" + break; + fi + done +else + echo "clang-format provided by environment" +fi + +# fallback if nothing is found +if [[ -z $clang_format ]]; then + echo "using fallback" + clang_format="clang-format" +fi + +## check version +echo "checking version of $clang_format" +version_string=$(${clang_format} --version) +re=".*version ${clang_format_version}.*" +if ! [[ $version_string =~ $re ]]; then + echo "your version: '$version_string' does not match version 6.0.1" + exit 1 +fi + + +diff="$(git diff -U0 --no-color HEAD^)" +if type colordiff 2>/dev/null; then + #need pipefail option + ${bash_source_dir}/lib/clang-format-diff.py --verbose -binary "${clang_format}" -style=file -p1 <<<"$diff" | colordiff -u3 +else + ${bash_source_dir}/lib/clang-format-diff.py --verbose -binary "${clang_format}" -style=file -p1 <<<"$diff" +fi + diff --git a/utils/clang-format-everything.sh b/utils/clang-format-everything similarity index 100% rename from utils/clang-format-everything.sh rename to utils/clang-format-everything diff --git a/utils/clang-tidy.sh b/utils/clang-tidy similarity index 100% rename from utils/clang-tidy.sh rename to utils/clang-tidy diff --git a/utils/lib/clang-format-diff.py b/utils/lib/clang-format-diff.py new file mode 100755 index 000000000000..3ba0abefc9f5 --- /dev/null +++ b/utils/lib/clang-format-diff.py @@ -0,0 +1,127 @@ +#!/usr/bin/env python +# +#===- clang-format-diff.py - ClangFormat Diff Reformatter ----*- python -*--===# +# +# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +# See https://llvm.org/LICENSE.txt for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# +#===------------------------------------------------------------------------===# + +r""" +ClangFormat Diff Reformatter +============================ + +This script reads input from a unified diff and reformats all the changed +lines. This is useful to reformat all the lines touched by a specific patch. +Example usage for git/svn users: + + git diff -U0 --no-color HEAD^ | clang-format-diff.py -p1 -i + svn diff --diff-cmd=diff -x-U0 | clang-format-diff.py -i + +""" +from __future__ import absolute_import, division, print_function + +import argparse +import difflib +import re +import subprocess +import sys + +if sys.version_info.major >= 3: + from io import StringIO +else: + from io import BytesIO as StringIO + + +def main(): + parser = argparse.ArgumentParser(description= + 'Reformat changed lines in diff. Without -i ' + 'option just output the diff that would be ' + 'introduced.') + parser.add_argument('-i', action='store_true', default=False, + help='apply edits to files instead of displaying a diff') + parser.add_argument('-p', metavar='NUM', default=0, + help='strip the smallest prefix containing P slashes') + parser.add_argument('-regex', metavar='PATTERN', default=None, + help='custom pattern selecting file paths to reformat ' + '(case sensitive, overrides -iregex)') + parser.add_argument('-iregex', metavar='PATTERN', default= + r'.*\.(cpp|cc|c\+\+|cxx|c|cl|h|hpp|m|mm|inc|js|ts|proto' + r'|protodevel|java)', + help='custom pattern selecting file paths to reformat ' + '(case insensitive, overridden by -regex)') + parser.add_argument('-sort-includes', action='store_true', default=False, + help='let clang-format sort include blocks') + parser.add_argument('-v', '--verbose', action='store_true', + help='be more verbose, ineffective without -i') + parser.add_argument('-style', + help='formatting style to apply (LLVM, Google, Chromium, ' + 'Mozilla, WebKit)') + parser.add_argument('-binary', default='clang-format', + help='location of binary to use for clang-format') + args = parser.parse_args() + + # Extract changed lines for each file. + filename = None + lines_by_file = {} + for line in sys.stdin: + match = re.search(r'^\+\+\+\ (.*?/){%s}(\S*)' % args.p, line) + if match: + filename = match.group(2) + if filename == None: + continue + + if args.regex is not None: + if not re.match('^%s$' % args.regex, filename): + continue + else: + if not re.match('^%s$' % args.iregex, filename, re.IGNORECASE): + continue + + match = re.search(r'^@@.*\+(\d+)(,(\d+))?', line) + if match: + start_line = int(match.group(1)) + line_count = 1 + if match.group(3): + line_count = int(match.group(3)) + if line_count == 0: + continue + end_line = start_line + line_count - 1 + lines_by_file.setdefault(filename, []).extend( + ['-lines', str(start_line) + ':' + str(end_line)]) + + # Reformat files containing changes in place. + for filename, lines in lines_by_file.items(): + if args.i and args.verbose: + print('Formatting {}'.format(filename)) + command = [args.binary, filename] + if args.i: + command.append('-i') + if args.sort_includes: + command.append('-sort-includes') + command.extend(lines) + if args.style: + command.extend(['-style', args.style]) + p = subprocess.Popen(command, + stdout=subprocess.PIPE, + stderr=None, + stdin=subprocess.PIPE, + universal_newlines=True) + stdout, stderr = p.communicate() + if p.returncode != 0: + sys.exit(p.returncode) + + if not args.i: + with open(filename) as f: + code = f.readlines() + formatted_code = StringIO(stdout).readlines() + diff = difflib.unified_diff(code, formatted_code, + filename, filename, + '(before formatting)', '(after formatting)') + diff_string = ''.join(diff) + if len(diff_string) > 0: + sys.stdout.write(diff_string) + +if __name__ == '__main__': + main() diff --git a/utils/reformat.sh b/utils/lib/reformat.sh similarity index 100% rename from utils/reformat.sh rename to utils/lib/reformat.sh From 7cb37d43fd2efe8522fddff47111963efb9b89ec Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Thu, 10 Oct 2019 10:40:20 +0200 Subject: [PATCH 09/50] run tidy on cpp files only --- utils/clang-tidy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/clang-tidy b/utils/clang-tidy index d4b3ead37d08..59d7e667867d 100755 --- a/utils/clang-tidy +++ b/utils/clang-tidy @@ -38,10 +38,11 @@ if ! [[ $version_string =~ $re ]]; then fi ## find relevant files + #-type f "(" -name "*.cpp" -o -name "*.h" ")" \ files="$( find arangod arangosh lib enterprise \ -name Zip -prune -o \ - -type f "(" -name "*.cpp" -o -name "*.h" ")" \ + -type f "(" -name "*.cpp" ")" \ "!" "(" -name "tokens.*" -o -name "v8-json.*" -o -name "voc-errors.*" -o -name "grammar.*" -o -name "xxhash.*" -o -name "exitcodes.*" ")" )" From 6b9b2332f4fc1eed1cd8e2ba2eb1b9477ab1df0f Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Thu, 10 Oct 2019 17:19:45 +0200 Subject: [PATCH 10/50] allow travis to run on test branch --- .travis.yml | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9a7323443409..5df258579b02 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,16 +2,7 @@ branches: only: - master - devel - - "1.4" - - "2.3" - - "2.4" - - "2.5" - - "2.6" - - "2.7" - - "2.8" - - "3.0" - - "3.1" - - "3.2" + - feature/clang-tidy-format language: cpp cache: ccache From 6c5fb46b91491b63aad0f4a4498730c9783e3dd7 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Thu, 10 Oct 2019 17:20:10 +0200 Subject: [PATCH 11/50] let clang-tidy be less verbose --- utils/clang-tidy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/clang-tidy b/utils/clang-tidy index 59d7e667867d..aa6877deabf9 100755 --- a/utils/clang-tidy +++ b/utils/clang-tidy @@ -46,4 +46,4 @@ files="$( "!" "(" -name "tokens.*" -o -name "v8-json.*" -o -name "voc-errors.*" -o -name "grammar.*" -o -name "xxhash.*" -o -name "exitcodes.*" ")" )" -${clang_tidy} -checks=-*,clang-analyzer-*,-clang-analyzer-cplusplus* ${files} +${clang_tidy} --quiet -checks=-*,clang-analyzer-*,-clang-analyzer-cplusplus* ${files} From a7e444a2bbdb12f9e47ccd82941133ff60db7b9a Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Fri, 11 Oct 2019 07:56:32 +0200 Subject: [PATCH 12/50] prepare travis yaml --- .travis.yml | 57 +++++++++++++++++++++++------------------------------ 1 file changed, 25 insertions(+), 32 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5df258579b02..0cc830368e11 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,39 +6,32 @@ branches: language: cpp cache: ccache -compiler: g++ -sudo: false -dist: trusty +sudo: required -addons: - apt: - sources: - - ubuntu-toolchain-r-test - - george-edison55-trusty-backports - packages: - - g++-5 - - gcc-5 - - binutils-gold - - gdb - - cmake-data - - cmake +matrix: + include: + - name: "clang-format" + compiler: g++ + addons: + apt: + sources: + - ubuntu-toolchain-r-test -install: - -# prepare environment -- export PATH="$HOME/bin:$PATH" -- export CC="$HOME/bin/gcc" -- export CXX="$HOME/bin/g++" -- export CFLAGS="-B$HOME/bin/gold $CFLAGS" -- export CXXFLAGS="-B$HOME/bin/gold $CXXFLAGS" + packages: + - clang-8 + - clang-tools-8 + - clang-tidy-8 -before_script: "bash -c Installation/travisCI/before_script.sh" -script: "bash -c Installation/travisCI/build.sh" -after_failure: "bash -c Installation/travisCI/after_failure.sh" -after_script: "bash -c Installation/travisCI/after_script.sh" +before_install: +install: +before_script: +script: +after_suceess: +after_failure: +after_script: -notifications: - slack: - secure: JrnDfdroyURrS85HIVsI4xw82taol+lvOJxduxz4T8mQuckaE3ECRYcxX7MzLJfjpeSLST5kttUiZBckHdZ/pnmraZlQ+1/b1VE6k5hFzkbeM0ShjXKTxHdudXaJKuENunMxDAjVWaBaTTh/iy8ZZbKUYQtWLtLfw3xa5zCKVaQ= - on_success: change - on_failure: always +#notifications: +# slack: +# secure: JrnDfdroyURrS85HIVsI4xw82taol+lvOJxduxz4T8mQuckaE3ECRYcxX7MzLJfjpeSLST5kttUiZBckHdZ/pnmraZlQ+1/b1VE6k5hFzkbeM0ShjXKTxHdudXaJKuENunMxDAjVWaBaTTh/iy8ZZbKUYQtWLtLfw3xa5zCKVaQ= +# on_success: change +# on_failure: always From cb50c1a57505045d00cf8dda051b01007e20b36a Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Fri, 11 Oct 2019 08:04:12 +0200 Subject: [PATCH 13/50] try to run camke to get compile database --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0cc830368e11..0a5592959bad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ branches: - feature/clang-tidy-format language: cpp -cache: ccache +#cache: ccache sudo: required matrix: @@ -25,6 +25,8 @@ matrix: before_install: install: before_script: + - mkdir build && cd build || exit 1 + - CXX=clang++-8 CC=clang-8 cmake .. script: after_suceess: after_failure: From 7f4fd0a53343b3c65ab4897d6b0f94fd780c4b2c Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Fri, 11 Oct 2019 08:09:29 +0200 Subject: [PATCH 14/50] fix packages --- .travis.yml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0a5592959bad..8f2949c1f184 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,14 +13,9 @@ matrix: - name: "clang-format" compiler: g++ addons: - apt: - sources: - - ubuntu-toolchain-r-test - - packages: - - clang-8 - - clang-tools-8 - - clang-tidy-8 + apt: + sources: [ 'ubuntu-toolchain-r-test' ] + packages: [ 'clang-8', 'clang-tools-8', 'clang-tidy-8' ] before_install: install: From 258b7b5ee3934d9ae5cf9744063762c9f1e68d86 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Fri, 11 Oct 2019 08:17:43 +0200 Subject: [PATCH 15/50] add llvm tool chain --- .travis.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8f2949c1f184..b444d97846f0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,14 +14,17 @@ matrix: compiler: g++ addons: apt: - sources: [ 'ubuntu-toolchain-r-test' ] + sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-xenial-8'] packages: [ 'clang-8', 'clang-tools-8', 'clang-tidy-8' ] + env: + - MATRIX_ENV="export CXX=clang++-8 CC=clang-8" before_install: install: -before_script: +before_script: + - eval "${MATRIX_ENV}" - mkdir build && cd build || exit 1 - - CXX=clang++-8 CC=clang-8 cmake .. + - cmake .. script: after_suceess: after_failure: From a69db53bf93c8b5357d521ddd141fa37b392686f Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Fri, 11 Oct 2019 08:21:51 +0200 Subject: [PATCH 16/50] add check script to travis --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index b444d97846f0..a272b74918b1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,6 +26,8 @@ before_script: - mkdir build && cd build || exit 1 - cmake .. script: + ./utils/clang-format-check + after_suceess: after_failure: after_script: From 91ac2419610e5f36ba3b9a43689d33fe002b3cfd Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Fri, 11 Oct 2019 08:25:19 +0200 Subject: [PATCH 17/50] try to swith to clang 9 we can revert to clang-6 if frank wants this but 8 was never an option so far --- .travis.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index a272b74918b1..91c51567ce2a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,10 +14,10 @@ matrix: compiler: g++ addons: apt: - sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-xenial-8'] - packages: [ 'clang-8', 'clang-tools-8', 'clang-tidy-8' ] + sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-xenial-9'] + packages: [ 'clang-9', 'clang-tools-9', 'clang-tidy-9' ] env: - - MATRIX_ENV="export CXX=clang++-8 CC=clang-8" + - MATRIX_ENV="export CXX=clang++-9 CC=clang-9" before_install: install: @@ -26,7 +26,8 @@ before_script: - mkdir build && cd build || exit 1 - cmake .. script: - ./utils/clang-format-check + - exort ARANGODB_CLANG_FORMAT_VERSION=9.0.0 + - ./utils/clang-format-check after_suceess: after_failure: From 91893ebfbb85e39b8c434056c3a1d1385430fa4c Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Fri, 11 Oct 2019 08:26:45 +0200 Subject: [PATCH 18/50] fix current directory before calling script --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 91c51567ce2a..a7ad17adf6f6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,6 +25,7 @@ before_script: - eval "${MATRIX_ENV}" - mkdir build && cd build || exit 1 - cmake .. + - cd .. script: - exort ARANGODB_CLANG_FORMAT_VERSION=9.0.0 - ./utils/clang-format-check From 6bca460944ac0f503c1e3440b87ed7c0e5245a87 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Fri, 11 Oct 2019 08:31:00 +0200 Subject: [PATCH 19/50] change toolchain --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a7ad17adf6f6..fcce88b1d970 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,7 @@ matrix: compiler: g++ addons: apt: - sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-xenial-9'] + sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-xenial'] packages: [ 'clang-9', 'clang-tools-9', 'clang-tidy-9' ] env: - MATRIX_ENV="export CXX=clang++-9 CC=clang-9" From e61eab579d83ea154593429a22ecbd0c2bd82517 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Fri, 11 Oct 2019 08:37:08 +0200 Subject: [PATCH 20/50] try to make clang9 available --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index fcce88b1d970..33768c74e235 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,7 @@ matrix: compiler: g++ addons: apt: - sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-xenial'] + sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-xenial-8', 'llvm-package-travis'] packages: [ 'clang-9', 'clang-tools-9', 'clang-tidy-9' ] env: - MATRIX_ENV="export CXX=clang++-9 CC=clang-9" From 3865544f7de9c1148376fd4babb1b4809e48db55 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Fri, 11 Oct 2019 08:52:33 +0200 Subject: [PATCH 21/50] try to make it work with clang 6 - we hate travis --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 33768c74e235..652af9255edc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,10 +14,10 @@ matrix: compiler: g++ addons: apt: - sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-xenial-8', 'llvm-package-travis'] - packages: [ 'clang-9', 'clang-tools-9', 'clang-tidy-9' ] + sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-xenial-6'] + packages: [ 'clang-6', 'clang-tools-6', 'clang-tidy-6' ] env: - - MATRIX_ENV="export CXX=clang++-9 CC=clang-9" + - MATRIX_ENV="export CXX=clang++-6 CC=clang-6" before_install: install: @@ -27,7 +27,7 @@ before_script: - cmake .. - cd .. script: - - exort ARANGODB_CLANG_FORMAT_VERSION=9.0.0 + - exort ARANGODB_CLANG_FORMAT_VERSION=6.0.0 - ./utils/clang-format-check after_suceess: From 93da1ef64b1ac205a2d4c1d6eaec7603ae6d59ba Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Fri, 11 Oct 2019 08:56:06 +0200 Subject: [PATCH 22/50] try again official mirror --- .travis.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 652af9255edc..4ff77b72cbfd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,18 +8,20 @@ language: cpp #cache: ccache sudo: required +#see https://apt.llvm.org/ matrix: include: - name: "clang-format" compiler: g++ addons: apt: - sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-xenial-6'] - packages: [ 'clang-6', 'clang-tools-6', 'clang-tidy-6' ] + sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-xenial-9'] + packages: [ 'clang-9', 'clang-tools-9', 'clang-tidy-9' ] env: - - MATRIX_ENV="export CXX=clang++-6 CC=clang-6" + - MATRIX_ENV="export CXX=clang++-9 CC=clang-9" before_install: + install: before_script: - eval "${MATRIX_ENV}" From d620df1e44b345d85b26e87c791628bc0c9d1212 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Fri, 11 Oct 2019 09:03:44 +0200 Subject: [PATCH 23/50] use llvm script --- .travis.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4ff77b72cbfd..4a83248d3b63 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,12 +15,13 @@ matrix: compiler: g++ addons: apt: - sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-xenial-9'] - packages: [ 'clang-9', 'clang-tools-9', 'clang-tidy-9' ] + sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-xenial-8'] + #packages: [ 'clang-9', 'clang-tools-9', 'clang-tidy-9' ] env: - MATRIX_ENV="export CXX=clang++-9 CC=clang-9" before_install: + - sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" install: before_script: @@ -29,7 +30,7 @@ before_script: - cmake .. - cd .. script: - - exort ARANGODB_CLANG_FORMAT_VERSION=6.0.0 + - export ARANGODB_CLANG_FORMAT_VERSION=9.0.0 - ./utils/clang-format-check after_suceess: From 26a13092bc3e045b5c9b8fc8b9b53bc0e729f4fa Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Fri, 11 Oct 2019 09:10:17 +0200 Subject: [PATCH 24/50] select llvm versoin --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4a83248d3b63..62129f69f021 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,9 @@ matrix: - MATRIX_ENV="export CXX=clang++-9 CC=clang-9" before_install: - - sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" + - wget https://apt.llvm.org/llvm.sh + - chmod +x llvm.sh + - sudo ./llvm.sh 9 || sudo apt-get install -y clang-9 lldb-9 lld-9 clangd-9 llvm-9-dev install: before_script: From 80c5221449b33289452660c328050c2618ffdad1 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Fri, 11 Oct 2019 09:14:39 +0200 Subject: [PATCH 25/50] add tools --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 62129f69f021..8ba07c6b3da4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,7 +23,7 @@ matrix: before_install: - wget https://apt.llvm.org/llvm.sh - chmod +x llvm.sh - - sudo ./llvm.sh 9 || sudo apt-get install -y clang-9 lldb-9 lld-9 clangd-9 llvm-9-dev + - sudo ./llvm.sh 9 || sudo apt-get install -y clang-9 lldb-9 lld-9 clangd-9 llvm-9-dev llvm-9-tools install: before_script: From 3445b73d392a84e57d211ab502b456f00797c8b8 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Fri, 11 Oct 2019 09:17:42 +0200 Subject: [PATCH 26/50] last desperate tries --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8ba07c6b3da4..a683036b6396 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,7 +23,7 @@ matrix: before_install: - wget https://apt.llvm.org/llvm.sh - chmod +x llvm.sh - - sudo ./llvm.sh 9 || sudo apt-get install -y clang-9 lldb-9 lld-9 clangd-9 llvm-9-dev llvm-9-tools + - sudo ./llvm.sh 9 || sudo apt-get install -f -y clang-9 lldb-9 lld-9 clangd-9 llvm-9-tools install: before_script: From 8381617920e443112fe477371c90ea455071fa16 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Fri, 11 Oct 2019 09:22:35 +0200 Subject: [PATCH 27/50] add sourceline --- .travis.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index a683036b6396..50506a5f6c8e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,15 +15,18 @@ matrix: compiler: g++ addons: apt: - sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-xenial-8'] - #packages: [ 'clang-9', 'clang-tools-9', 'clang-tidy-9' ] + sources: + - [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-xenial-8'] + - sourceline: 'deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main' + key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" + packages: [ 'clang-9', 'clang-tools-9', 'clang-tidy-9' ] env: - MATRIX_ENV="export CXX=clang++-9 CC=clang-9" before_install: - - wget https://apt.llvm.org/llvm.sh - - chmod +x llvm.sh - - sudo ./llvm.sh 9 || sudo apt-get install -f -y clang-9 lldb-9 lld-9 clangd-9 llvm-9-tools + # - wget https://apt.llvm.org/llvm.sh + #- chmod +x llvm.sh + #- sudo ./llvm.sh 9 || sudo apt-get install -f -y clang-9 lldb-9 lld-9 clangd-9 llvm-9-tools install: before_script: From 756b95e58b35d18e0a09b26ade9a4d606a0e42f2 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Fri, 11 Oct 2019 09:30:34 +0200 Subject: [PATCH 28/50] get rid of clang-7 --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 50506a5f6c8e..25b655318eee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,6 +27,7 @@ before_install: # - wget https://apt.llvm.org/llvm.sh #- chmod +x llvm.sh #- sudo ./llvm.sh 9 || sudo apt-get install -f -y clang-9 lldb-9 lld-9 clangd-9 llvm-9-tools + - sudo apt-get -y remove clang-7 install: before_script: From 75d2fb89589784f3450d739aa7934fe882124012 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Fri, 11 Oct 2019 09:44:41 +0200 Subject: [PATCH 29/50] list clang packages --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 25b655318eee..024db8863882 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,6 +27,7 @@ before_install: # - wget https://apt.llvm.org/llvm.sh #- chmod +x llvm.sh #- sudo ./llvm.sh 9 || sudo apt-get install -f -y clang-9 lldb-9 lld-9 clangd-9 llvm-9-tools + - dpkg -l | grep clang - sudo apt-get -y remove clang-7 install: From 221802c89daed73ac6edb6f93e41bc2b600a096f Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Fri, 11 Oct 2019 09:48:52 +0200 Subject: [PATCH 30/50] how can clang 7 be used if it is not installed? --- .travis.yml | 1 - utils/clang-format-check | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 024db8863882..3f58adcb2744 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,7 +28,6 @@ before_install: #- chmod +x llvm.sh #- sudo ./llvm.sh 9 || sudo apt-get install -f -y clang-9 lldb-9 lld-9 clangd-9 llvm-9-tools - dpkg -l | grep clang - - sudo apt-get -y remove clang-7 install: before_script: diff --git a/utils/clang-format-check b/utils/clang-format-check index 487b66573641..45bf749b6866 100755 --- a/utils/clang-format-check +++ b/utils/clang-format-check @@ -9,11 +9,11 @@ readonly bash_source_dir="$(dirname $(readlink -f ${BASH_SOURCE[0]}))" ## locate executable clang_format="${ARANGODB_CLANG_FORMAT:-""}" -clang_format_version="${ARANGODB_CLANG_FORMAT_VERSION:-"6.0.1"}" +clang_format_version="${ARANGODB_CLANG_FORMAT_VERSION:-"9.0.0"}" # fallback if nothing is found if [[ -z $clang_format ]]; then - for candidate in "$HOME/.local/bin/clang-format" "clang-format-arangodb" "clang-format-6" "clang-format"; do + for candidate in "$HOME/.local/bin/clang-format" "clang-format-arangodb" "clang-format-9" "clang-format"; do echo "checking candidate $candidate" path="$(type -p ${candidate})" if [[ -n $path ]]; then From 0a86b0a7655db7f584dabb0193b3c6d2d6a8a082 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Fri, 11 Oct 2019 09:54:57 +0200 Subject: [PATCH 31/50] show clang packages --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 3f58adcb2744..3fd2f32566fb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,6 +36,10 @@ before_script: - cmake .. - cd .. script: + - sudo apt-get install apt-file + - sudo apt-file update + - apt-file show clang-9 + - apt-file show clang-tools-9 - export ARANGODB_CLANG_FORMAT_VERSION=9.0.0 - ./utils/clang-format-check From fcabfda97b0ee285ea3aee619f160b4a80b5c1ce Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Fri, 11 Oct 2019 10:01:40 +0200 Subject: [PATCH 32/50] another way to see the files --- .travis.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3fd2f32566fb..c1ed72c25175 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,10 +36,8 @@ before_script: - cmake .. - cd .. script: - - sudo apt-get install apt-file - - sudo apt-file update - - apt-file show clang-9 - - apt-file show clang-tools-9 + - dpkg -L clang-9 + - dpkg -L show clang-tools-9 - export ARANGODB_CLANG_FORMAT_VERSION=9.0.0 - ./utils/clang-format-check From 60416502a333de0c2b901fa79e966dddc3eabbdb Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Fri, 11 Oct 2019 10:17:01 +0200 Subject: [PATCH 33/50] add format that is not part of tools --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c1ed72c25175..5c2aa7c6aaa0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ matrix: - [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-xenial-8'] - sourceline: 'deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main' key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" - packages: [ 'clang-9', 'clang-tools-9', 'clang-tidy-9' ] + packages: [ 'clang-9', 'clang-tools-9', 'clang-tidy-9', 'clang-format-9'] env: - MATRIX_ENV="export CXX=clang++-9 CC=clang-9" From b49ecbbc59603460a59ccadca7733ddcbb8d2735 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Fri, 11 Oct 2019 10:22:29 +0200 Subject: [PATCH 34/50] remove debug lines --- .travis.yml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5c2aa7c6aaa0..27dd50b31679 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,11 +24,6 @@ matrix: - MATRIX_ENV="export CXX=clang++-9 CC=clang-9" before_install: - # - wget https://apt.llvm.org/llvm.sh - #- chmod +x llvm.sh - #- sudo ./llvm.sh 9 || sudo apt-get install -f -y clang-9 lldb-9 lld-9 clangd-9 llvm-9-tools - - dpkg -l | grep clang - install: before_script: - eval "${MATRIX_ENV}" @@ -36,14 +31,12 @@ before_script: - cmake .. - cd .. script: - - dpkg -L clang-9 - - dpkg -L show clang-tools-9 - export ARANGODB_CLANG_FORMAT_VERSION=9.0.0 - ./utils/clang-format-check after_suceess: -after_failure: -after_script: +after_failure: +after_script: #notifications: # slack: From 1e52aad31f15b429ef827d5b773c173b73b99797 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Fri, 11 Oct 2019 10:27:07 +0200 Subject: [PATCH 35/50] remove cmake step as we do not need it if we are not using tidy --- .travis.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 27dd50b31679..f2efa26b1680 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,10 +26,11 @@ matrix: before_install: install: before_script: - - eval "${MATRIX_ENV}" - - mkdir build && cd build || exit 1 - - cmake .. - - cd .. + # we need this only to create the compilation databse for clang tidy + # - eval "${MATRIX_ENV}" + # - mkdir build && cd build || exit 1 + # - cmake .. + # - cd .. script: - export ARANGODB_CLANG_FORMAT_VERSION=9.0.0 - ./utils/clang-format-check From c367fa1d3ec13b05269f266d78df37729f3ba1c6 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Fri, 11 Oct 2019 10:42:48 +0200 Subject: [PATCH 36/50] break formatting and exit with 1 if there is a diff --- arangod/Aql/Query.cpp | 8 ++++---- utils/lib/clang-format-diff.py | 6 +++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/arangod/Aql/Query.cpp b/arangod/Aql/Query.cpp index 15945f57f52b..734edadea207 100644 --- a/arangod/Aql/Query.cpp +++ b/arangod/Aql/Query.cpp @@ -29,10 +29,10 @@ #include "Aql/ExecutionEngine.h" #include "Aql/ExecutionPlan.h" #include "Aql/Optimizer.h" -#include "Aql/Parser.h" -#include "Aql/PlanCache.h" -#include "Aql/QueryCache.h" -#include "Aql/QueryList.h" + #include "Aql/Parser.h" + #include "Aql/PlanCache.h" + #include "Aql/QueryCache.h" + #include "Aql/QueryList.h" #include "Aql/QueryProfile.h" #include "Aql/QueryRegistry.h" #include "Basics/Exceptions.h" diff --git a/utils/lib/clang-format-diff.py b/utils/lib/clang-format-diff.py index 3ba0abefc9f5..f57e8486bdf7 100755 --- a/utils/lib/clang-format-diff.py +++ b/utils/lib/clang-format-diff.py @@ -65,6 +65,7 @@ def main(): # Extract changed lines for each file. filename = None lines_by_file = {} + status = 0 for line in sys.stdin: match = re.search(r'^\+\+\+\ (.*?/){%s}(\S*)' % args.p, line) if match: @@ -122,6 +123,9 @@ def main(): diff_string = ''.join(diff) if len(diff_string) > 0: sys.stdout.write(diff_string) + status = 1 + + return status if __name__ == '__main__': - main() + sys.exit(main()) From 27bd703f0f4ea87022ec1c9c54b857f05de82915 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Fri, 11 Oct 2019 10:59:40 +0200 Subject: [PATCH 37/50] add colordiff and fix/break formatting --- .travis.yml | 4 ++-- arangod/Aql/Query.cpp | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index f2efa26b1680..a317f98c8597 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,14 +12,14 @@ sudo: required matrix: include: - name: "clang-format" - compiler: g++ + compiler: clang++-9 addons: apt: sources: - [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-xenial-8'] - sourceline: 'deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main' key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" - packages: [ 'clang-9', 'clang-tools-9', 'clang-tidy-9', 'clang-format-9'] + packages: [ 'clang-9', 'clang-tools-9', 'clang-tidy-9', 'clang-format-9', 'colordiff'] env: - MATRIX_ENV="export CXX=clang++-9 CC=clang-9" diff --git a/arangod/Aql/Query.cpp b/arangod/Aql/Query.cpp index 734edadea207..7e349431245f 100644 --- a/arangod/Aql/Query.cpp +++ b/arangod/Aql/Query.cpp @@ -21,7 +21,7 @@ /// @author Jan Steemann //////////////////////////////////////////////////////////////////////////////// -#include "Query.h" + #include "Query.h" #include "Aql/AqlItemBlock.h" #include "Aql/AqlTransaction.h" @@ -29,10 +29,10 @@ #include "Aql/ExecutionEngine.h" #include "Aql/ExecutionPlan.h" #include "Aql/Optimizer.h" - #include "Aql/Parser.h" - #include "Aql/PlanCache.h" - #include "Aql/QueryCache.h" - #include "Aql/QueryList.h" +#include "Aql/Parser.h" +#include "Aql/PlanCache.h" +#include "Aql/QueryCache.h" +#include "Aql/QueryList.h" #include "Aql/QueryProfile.h" #include "Aql/QueryRegistry.h" #include "Basics/Exceptions.h" From b5a75ad2d9b0f6a2b59b7bc0fa6807673d2b3fb2 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Fri, 11 Oct 2019 11:09:16 +0200 Subject: [PATCH 38/50] diff against correct branch --- utils/clang-format-check | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/utils/clang-format-check b/utils/clang-format-check index 45bf749b6866..feaac921fab4 100755 --- a/utils/clang-format-check +++ b/utils/clang-format-check @@ -42,7 +42,14 @@ if ! [[ $version_string =~ $re ]]; then fi -diff="$(git diff -U0 --no-color HEAD^)" +diff_target="HEAD" +if $TRAVIS; + diff_target="${TRAVIS_BRANCH}" + echo "diffing against ${diff_target}" +then + +diff="$(git diff -U0 --no-color "${diff_target}")" + if type colordiff 2>/dev/null; then #need pipefail option ${bash_source_dir}/lib/clang-format-diff.py --verbose -binary "${clang_format}" -style=file -p1 <<<"$diff" | colordiff -u3 From b3009edd65d2abcb6eb50cc669252ac45b59018a Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Fri, 11 Oct 2019 11:13:52 +0200 Subject: [PATCH 39/50] add code that will enable the check for prs only --- utils/clang-format-check | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/utils/clang-format-check b/utils/clang-format-check index feaac921fab4..bb709cd5d707 100755 --- a/utils/clang-format-check +++ b/utils/clang-format-check @@ -43,12 +43,17 @@ fi diff_target="HEAD" -if $TRAVIS; +if $TRAVIS; then + # TODO - enable this once done + # if ! $TRAVIS_PULL_REQUEST; then + # echo "NOT A PULL REQUEST" + # exit 0 + # fi diff_target="${TRAVIS_BRANCH}" echo "diffing against ${diff_target}" -then +fi -diff="$(git diff -U0 --no-color "${diff_target}")" +diff="$(git diff -U0 --no-color "${diff_target}" )" if type colordiff 2>/dev/null; then #need pipefail option From 4d152a313a8972da361af0fdf90809554c93f54a Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Fri, 11 Oct 2019 11:18:34 +0200 Subject: [PATCH 40/50] make it work for PR and non PR --- arangod/Aql/Query.cpp | 2 +- utils/clang-format-check | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/arangod/Aql/Query.cpp b/arangod/Aql/Query.cpp index 7e349431245f..d16c9bfe6b18 100644 --- a/arangod/Aql/Query.cpp +++ b/arangod/Aql/Query.cpp @@ -21,7 +21,7 @@ /// @author Jan Steemann //////////////////////////////////////////////////////////////////////////////// - #include "Query.h" + #include "Query.h" #include "Aql/AqlItemBlock.h" #include "Aql/AqlTransaction.h" diff --git a/utils/clang-format-check b/utils/clang-format-check index bb709cd5d707..bc5c5be00433 100755 --- a/utils/clang-format-check +++ b/utils/clang-format-check @@ -44,12 +44,10 @@ fi diff_target="HEAD" if $TRAVIS; then - # TODO - enable this once done - # if ! $TRAVIS_PULL_REQUEST; then - # echo "NOT A PULL REQUEST" - # exit 0 - # fi diff_target="${TRAVIS_BRANCH}" + if ! $TRAVIS_PULL_REQUEST; then + diff_target="${diff_target}^" + fi echo "diffing against ${diff_target}" fi From 087e704a9ef43b58f24285cd563521af0eaf99e9 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Fri, 11 Oct 2019 11:22:21 +0200 Subject: [PATCH 41/50] fix formatting --- arangod/Aql/Query.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arangod/Aql/Query.cpp b/arangod/Aql/Query.cpp index d16c9bfe6b18..15945f57f52b 100644 --- a/arangod/Aql/Query.cpp +++ b/arangod/Aql/Query.cpp @@ -21,7 +21,7 @@ /// @author Jan Steemann //////////////////////////////////////////////////////////////////////////////// - #include "Query.h" +#include "Query.h" #include "Aql/AqlItemBlock.h" #include "Aql/AqlTransaction.h" From 8be3f3130103edbc86a3effbc21c8dbb7c6b541a Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Sat, 12 Oct 2019 11:28:29 +0200 Subject: [PATCH 42/50] run on all branches --- .travis.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index a317f98c8597..747ba1de5e80 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,8 @@ -branches: - only: - - master - - devel - - feature/clang-tidy-format +#branches: +# only: +# - master +# - devel +# - feature/clang-tidy-format language: cpp #cache: ccache From 42ee81f32f57c0299b389a2e288b7f7baeb10322 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Mon, 14 Oct 2019 11:20:23 +0200 Subject: [PATCH 43/50] add some quotes --- utils/clang-format-changed-only | 4 ++-- utils/clang-format-check | 6 +++--- utils/clang-format-everything | 2 +- utils/clang-tidy | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/utils/clang-format-changed-only b/utils/clang-format-changed-only index e77669483e0f..11618295dca4 100755 --- a/utils/clang-format-changed-only +++ b/utils/clang-format-changed-only @@ -9,7 +9,7 @@ clang_format_version="${ARANGODB_CLANG_FORMAT_VERSION:-"6.0.1"}" if [[ -z $clang_format ]]; then for candidate in "$HOME/.local/bin/clang-format" "clang-format-arangodb" "clang-format-6" "clang-format"; do echo "checking candidate $candidate" - path="$(type -p ${candidate})" + path="$(type -p "${candidate}")" if [[ -n $path ]]; then clang_format="$path" echo "selecting this candidate" @@ -50,7 +50,7 @@ for gf in ${git_files[@]}; do echo "---------------------" for f in ${files[@]}; do echo "$gf -- $f" - if [[ $gf == $f ]]; then + if [[ $gf == "$f" ]]; then files_final+=( "$f" ) continue fi diff --git a/utils/clang-format-check b/utils/clang-format-check index bc5c5be00433..9ea1baecdb87 100755 --- a/utils/clang-format-check +++ b/utils/clang-format-check @@ -15,7 +15,7 @@ clang_format_version="${ARANGODB_CLANG_FORMAT_VERSION:-"9.0.0"}" if [[ -z $clang_format ]]; then for candidate in "$HOME/.local/bin/clang-format" "clang-format-arangodb" "clang-format-9" "clang-format"; do echo "checking candidate $candidate" - path="$(type -p ${candidate})" + path="$(type -p "${candidate}")" if [[ -n $path ]]; then clang_format="$path" echo "selecting this candidate" @@ -55,8 +55,8 @@ diff="$(git diff -U0 --no-color "${diff_target}" )" if type colordiff 2>/dev/null; then #need pipefail option - ${bash_source_dir}/lib/clang-format-diff.py --verbose -binary "${clang_format}" -style=file -p1 <<<"$diff" | colordiff -u3 + "${bash_source_dir}/lib/clang-format-diff.py" --verbose -binary "${clang_format}" -style=file -p1 <<<"$diff" | colordiff -u3 else - ${bash_source_dir}/lib/clang-format-diff.py --verbose -binary "${clang_format}" -style=file -p1 <<<"$diff" + "${bash_source_dir}/lib/clang-format-diff.py" --verbose -binary "${clang_format}" -style=file -p1 <<<"$diff" fi diff --git a/utils/clang-format-everything b/utils/clang-format-everything index bede6f9a9550..0e2fe4a648c3 100755 --- a/utils/clang-format-everything +++ b/utils/clang-format-everything @@ -9,7 +9,7 @@ clang_format_version="${ARANGODB_CLANG_FORMAT_VERSION:-"6.0.1"}" if [[ -z $clang_format ]]; then for candidate in "$HOME/.local/bin/clang-format" "clang-format-arangodb" "clang-format-6" "clang-format"; do echo "checking candidate $candidate" - path="$(type -p ${candidate})" + path="$(type -p "${candidate}")" if [[ -n $path ]]; then clang_format="$path" echo "selecting this candidate" diff --git a/utils/clang-tidy b/utils/clang-tidy index aa6877deabf9..26c99175f995 100755 --- a/utils/clang-tidy +++ b/utils/clang-tidy @@ -11,7 +11,7 @@ clang_tidy_version="${ARANGODB_CLANG_TIDY_VERSION:-"9.0.0"}" if [[ -z $clang_tidy ]]; then for candidate in "$HOME/.local/bin/clang-tidy" "clang-tidy-arangodb" "clang-tidy-9" "clang-tidy"; do echo "checking candidate $candidate" - path="$(type -p ${candidate})" + path="$(type -p "${candidate}")" if [[ -n $path ]]; then clang_tidy="$path" echo "selecting this candidate" From c8e583fbbbc73507fb498207a74839be07a3690d Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Tue, 15 Oct 2019 08:39:10 +0200 Subject: [PATCH 44/50] Update utils/clang-tidy Co-Authored-By: Simon --- utils/clang-tidy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/clang-tidy b/utils/clang-tidy index aa6877deabf9..640e6915add8 100755 --- a/utils/clang-tidy +++ b/utils/clang-tidy @@ -46,4 +46,4 @@ files="$( "!" "(" -name "tokens.*" -o -name "v8-json.*" -o -name "voc-errors.*" -o -name "grammar.*" -o -name "xxhash.*" -o -name "exitcodes.*" ")" )" -${clang_tidy} --quiet -checks=-*,clang-analyzer-*,-clang-analyzer-cplusplus* ${files} +${clang_tidy} --quiet --checks=-*,clang-analyzer-*,-clang-analyzer-cplusplus* ${files} From f06b680b37c5e3557a0b8fc1ddc64903d8c0c969 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Tue, 15 Oct 2019 08:41:12 +0200 Subject: [PATCH 45/50] Update arangod/Aql/Query.cpp Co-Authored-By: Wilfried Goesgens --- arangod/Aql/Query.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arangod/Aql/Query.cpp b/arangod/Aql/Query.cpp index 7e349431245f..15945f57f52b 100644 --- a/arangod/Aql/Query.cpp +++ b/arangod/Aql/Query.cpp @@ -21,7 +21,7 @@ /// @author Jan Steemann //////////////////////////////////////////////////////////////////////////////// - #include "Query.h" +#include "Query.h" #include "Aql/AqlItemBlock.h" #include "Aql/AqlTransaction.h" From 4c102da14f752c287feb5c37daa02cb4e5b741ce Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Tue, 15 Oct 2019 09:39:51 +0200 Subject: [PATCH 46/50] make it work outside of travis --- utils/clang-format-check | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/utils/clang-format-check b/utils/clang-format-check index 9ea1baecdb87..c54e1076290e 100755 --- a/utils/clang-format-check +++ b/utils/clang-format-check @@ -4,12 +4,14 @@ set -u # Make any failure in piped commands be reflected in the exit code. set -o pipefail -readonly bash_source_dir="$(dirname $(readlink -f ${BASH_SOURCE[0]}))" +TRAVIS=${TRAVIS:-false} +readonly bash_source_dir="$(dirname $(readlink -f ${BASH_SOURCE[0]}))" +readonly first_arg="$1" ## locate executable +readonly clang_format_version="${ARANGODB_CLANG_FORMAT_VERSION:-"9.0.0"}" clang_format="${ARANGODB_CLANG_FORMAT:-""}" -clang_format_version="${ARANGODB_CLANG_FORMAT_VERSION:-"9.0.0"}" # fallback if nothing is found if [[ -z $clang_format ]]; then @@ -42,7 +44,7 @@ if ! [[ $version_string =~ $re ]]; then fi -diff_target="HEAD" +diff_target="${first_arg:-'HEAD'}" if $TRAVIS; then diff_target="${TRAVIS_BRANCH}" if ! $TRAVIS_PULL_REQUEST; then @@ -53,10 +55,17 @@ fi diff="$(git diff -U0 --no-color "${diff_target}" )" +command=( + "${bash_source_dir}/lib/clang-format-diff.py" + --verbose + -binary "${clang_format}" + -style=file + -p1 +) + if type colordiff 2>/dev/null; then #need pipefail option - "${bash_source_dir}/lib/clang-format-diff.py" --verbose -binary "${clang_format}" -style=file -p1 <<<"$diff" | colordiff -u3 + "${commandp[@]}" <<<"$diff" | colordiff -u3 else - "${bash_source_dir}/lib/clang-format-diff.py" --verbose -binary "${clang_format}" -style=file -p1 <<<"$diff" + "${commandp[@]}" <<<"$diff" fi - From 723f850f4061ec55f32cf19937b06bea8d8f3f36 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Tue, 15 Oct 2019 09:59:11 +0200 Subject: [PATCH 47/50] use clang-format-diff instead of find --- utils/clang-format-changed-only | 57 ++++++++++++++++++++------------- utils/clang-format-check | 12 ++++--- 2 files changed, 42 insertions(+), 27 deletions(-) diff --git a/utils/clang-format-changed-only b/utils/clang-format-changed-only index 11618295dca4..555c841f3e5b 100755 --- a/utils/clang-format-changed-only +++ b/utils/clang-format-changed-only @@ -35,27 +35,40 @@ if ! [[ $version_string =~ $re ]]; then exit 1 fi - -## find relevant files -files="$( - find arangod arangosh lib enterprise \ - -name Zip -prune -o \ - -type f "(" -name "*.cpp" -o -name "*.h" ")" \ - "!" "(" -name "tokens.*" -o -name "v8-json.*" -o -name "voc-errors.*" -o -name "grammar.*" -o -name "xxhash.*" -o -name "exitcodes.*" ")" -)" - -git_files=$(git diff --name-only) -files_final=() -for gf in ${git_files[@]}; do - echo "---------------------" - for f in ${files[@]}; do - echo "$gf -- $f" - if [[ $gf == "$f" ]]; then - files_final+=( "$f" ) - continue - fi - done -done - # do final formatting ${clang_format} -i -verbose -style=file ${files_final[@]} +command=( + "${bash_source_dir}/lib/clang-format-diff.py" + --verbose + -i + -binary "${clang_format}" + -style=file + -regex '(lib|tests|arangod)/.*' + -p1 +) + +echo "${command[@]}" +"${command[@]}" + +## keep this for now +# ## find relevant files +# files="$( +# find arangod arangosh lib enterprise \ +# -name Zip -prune -o \ +# -type f "(" -name "*.cpp" -o -name "*.h" ")" \ +# "!" "(" -name "tokens.*" -o -name "v8-json.*" -o -name "voc-errors.*" -o -name "grammar.*" -o -name "xxhash.*" -o -name "exitcodes.*" ")" +# )" +# +# git_files=$(git diff --name-only) +# files_final=() +# for gf in ${git_files[@]}; do +# echo "---------------------" +# for f in ${files[@]}; do +# echo "$gf -- $f" +# if [[ $gf == "$f" ]]; then +# files_final+=( "$f" ) +# continue +# fi +# done +# done + diff --git a/utils/clang-format-check b/utils/clang-format-check index c54e1076290e..7507ab48322e 100755 --- a/utils/clang-format-check +++ b/utils/clang-format-check @@ -4,10 +4,11 @@ set -u # Make any failure in piped commands be reflected in the exit code. set -o pipefail +diff_target="${1:-HEAD}" TRAVIS=${TRAVIS:-false} readonly bash_source_dir="$(dirname $(readlink -f ${BASH_SOURCE[0]}))" -readonly first_arg="$1" +readonly project_dir="$(readlink -f $(dirname $(readlink -f ${BASH_SOURCE[0]}))/..)" ## locate executable readonly clang_format_version="${ARANGODB_CLANG_FORMAT_VERSION:-"9.0.0"}" @@ -43,8 +44,6 @@ if ! [[ $version_string =~ $re ]]; then exit 1 fi - -diff_target="${first_arg:-'HEAD'}" if $TRAVIS; then diff_target="${TRAVIS_BRANCH}" if ! $TRAVIS_PULL_REQUEST; then @@ -55,17 +54,20 @@ fi diff="$(git diff -U0 --no-color "${diff_target}" )" + #-regex "'${project_dir}"'/(lib|tests|arangod).*'"'" command=( "${bash_source_dir}/lib/clang-format-diff.py" --verbose -binary "${clang_format}" -style=file + -regex '(lib|tests|arangod)/.*' -p1 ) +echo "${command[@]}" if type colordiff 2>/dev/null; then #need pipefail option - "${commandp[@]}" <<<"$diff" | colordiff -u3 + "${command[@]}" <<<"$diff" | colordiff -u3 else - "${commandp[@]}" <<<"$diff" + "${command[@]}" <<<"$diff" fi From f4c7205e9f48c50ba4132d95232f42e9a18197e6 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Tue, 15 Oct 2019 10:47:18 +0200 Subject: [PATCH 48/50] fix clang version so it matches what we have available in travis --- .travis.yml | 1 - utils/clang-format-check | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 747ba1de5e80..fdbc8204c1b2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,7 +32,6 @@ before_script: # - cmake .. # - cd .. script: - - export ARANGODB_CLANG_FORMAT_VERSION=9.0.0 - ./utils/clang-format-check after_suceess: diff --git a/utils/clang-format-check b/utils/clang-format-check index 7507ab48322e..f403b9247803 100755 --- a/utils/clang-format-check +++ b/utils/clang-format-check @@ -11,7 +11,7 @@ readonly bash_source_dir="$(dirname $(readlink -f ${BASH_SOURCE[0]}))" readonly project_dir="$(readlink -f $(dirname $(readlink -f ${BASH_SOURCE[0]}))/..)" ## locate executable -readonly clang_format_version="${ARANGODB_CLANG_FORMAT_VERSION:-"9.0.0"}" +readonly clang_format_version="${ARANGODB_CLANG_FORMAT_VERSION:-"9.0.1"}" clang_format="${ARANGODB_CLANG_FORMAT:-""}" # fallback if nothing is found @@ -40,7 +40,7 @@ echo "checking version of $clang_format" version_string=$(${clang_format} --version) re=".*version ${clang_format_version}.*" if ! [[ $version_string =~ $re ]]; then - echo "your version: '$version_string' does not match version 6.0.1" + echo "your version: '$version_string' does not match version regular expression '$re'" exit 1 fi From 04e90b7dc0c58b46220785174196bab16edabe36 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Tue, 15 Oct 2019 16:26:28 +0200 Subject: [PATCH 49/50] fix clang-format-diff call --- utils/clang-format-changed-only | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/utils/clang-format-changed-only b/utils/clang-format-changed-only index 555c841f3e5b..8d7ded311002 100755 --- a/utils/clang-format-changed-only +++ b/utils/clang-format-changed-only @@ -35,6 +35,8 @@ if ! [[ $version_string =~ $re ]]; then exit 1 fi + +diff="$(git diff -U0 --no-color)" # do final formatting ${clang_format} -i -verbose -style=file ${files_final[@]} command=( @@ -48,7 +50,7 @@ command=( ) echo "${command[@]}" -"${command[@]}" +"${command[@]}" <<<"$diff" ## keep this for now # ## find relevant files From 433ccfee64ab98127f6dcda404ca20435497750a Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Fri, 18 Oct 2019 10:08:33 +0200 Subject: [PATCH 50/50] remove sudo --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index fdbc8204c1b2..64a7a565e254 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,6 @@ language: cpp #cache: ccache -sudo: required #see https://apt.llvm.org/ matrix: