Alok Bhatt | adb0367 | 2020-10-24 14:24:53 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | echo "---> cmake-sonarqube.sh starts" |
| 4 | |
| 5 | CMAKE_OPTS= |
Anil Belur | 439502c | 2023-05-07 12:39:38 +1000 | [diff] [blame] | 6 | BUILD_DIR="${WORKSPACE}"/src |
| 7 | BUILD_WRAP_DIR="${WORKSPACE}"/bw-output |
Alok Bhatt | adb0367 | 2020-10-24 14:24:53 +0000 | [diff] [blame] | 8 | |
| 9 | |
Anil Belur | 439502c | 2023-05-07 12:39:38 +1000 | [diff] [blame] | 10 | build_dir="${BUILD_DIR:-${WORKSPACE}/build}" |
| 11 | build_wrap_dir="${BUILD_WRAP_DIR:-${WORKSPACE}/bw-output}" |
| 12 | # shellcheck disable=SC2034 |
Alok Bhatt | adb0367 | 2020-10-24 14:24:53 +0000 | [diff] [blame] | 13 | cmake_opts="${CMAKE_OPTS:-}" |
| 14 | make_opts="${MAKE_OPTS:-}" |
| 15 | |
| 16 | cd src || exit 1 |
| 17 | wget -q -O bw.zip https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip |
| 18 | unzip -q bw.zip |
| 19 | sudo mv build-wrapper-* /opt/build-wrapper |
| 20 | |
| 21 | mkdir -p "$build_dir" |
| 22 | cd "$build_dir" || exit 1 |
| 23 | |
| 24 | |
| 25 | # $make_opts may be empty. |
| 26 | # shellcheck disable=SC2086 |
| 27 | /opt/build-wrapper/build-wrapper-linux-x86-64 --out-dir "$build_wrap_dir" make $make_opts |
| 28 | |
| 29 | echo "---> cmake-sonarqube.sh ends" |