From 6895a44ddbee9e95a007cf67322244afb7d23c11 Mon Sep 17 00:00:00 2001 From: Vasily Date: Wed, 17 Apr 2019 12:17:52 +0200 Subject: [PATCH] Refactor build_linux.sh into configure.sh This moves all the error handling and setup into configure.sh, for a cleaner script. --- build_scripts/linux/build_linux.sh | 18 ++---------------- build_scripts/linux/configure.sh | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 16 deletions(-) create mode 100644 build_scripts/linux/configure.sh diff --git a/build_scripts/linux/build_linux.sh b/build_scripts/linux/build_linux.sh index 5dc78f0..49d6606 100755 --- a/build_scripts/linux/build_linux.sh +++ b/build_scripts/linux/build_linux.sh @@ -1,21 +1,7 @@ #!/usr/bin/env bash set -e -if [[ -z $QMAKE_SPEC ]]; then - QMAKE_SPEC='linux-g++' -fi - -if [[ -z $USE_TIDY ]]; then - MAKE_COMMAND='make --jobs' - CLANG_TIDY= -else - # Bear replaces the compile database, it does not update it. - # If you run 'bear make' and there is nothing to compile, you - # will get an empty database. - # Clean up the artifacts and run everything together in that case. - MAKE_COMMAND='bear make --jobs' - QMAKE_SPEC='linux-clang' - CLANG_TIDY='../build_scripts/linux/run-clang-tidy.sh' -fi +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +. $DIR/configure.sh echo $MAKE_COMMAND mkdir -p build diff --git a/build_scripts/linux/configure.sh b/build_scripts/linux/configure.sh new file mode 100644 index 0000000..bdf5478 --- /dev/null +++ b/build_scripts/linux/configure.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +set -e +if [[ -z $QMAKE_SPEC ]]; then + QMAKE_SPEC='linux-g++' +fi + +if [[ -z $USE_TIDY ]]; then + MAKE_COMMAND='make --jobs' + CLANG_TIDY= +else + # Bear replaces the compile database, it does not update it. + # If you run 'bear make' and there is nothing to compile, you + # will get an empty database. + # Clean up the artifacts and run everything together in that case. + MAKE_COMMAND='bear make --jobs' + QMAKE_SPEC='linux-clang' + CLANG_TIDY='../build_scripts/linux/run-clang-tidy.sh' +fi +