X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Fcmake-sonar.sh;h=e64ca69cf83803f80640dcff040565ca9557b67d;hb=a86c6e8d376c95aa00b179fce9d207e61c8f72d0;hp=0a41a95a51df99cc2aaf1a600475242a31b8d527;hpb=8709ee5e00526ce3298b92a85a79a7f058d4216b;p=releng%2Fglobal-jjb.git diff --git a/shell/cmake-sonar.sh b/shell/cmake-sonar.sh index 0a41a95a..e64ca69c 100644 --- a/shell/cmake-sonar.sh +++ b/shell/cmake-sonar.sh @@ -20,15 +20,21 @@ make_opts="${MAKE_OPTS:-}" set -ex -o pipefail +export SET_JDK_VERSION="${SET_JDK_VERSION:-openjdk11}" +echo "$SET_JDK_VERSION" +bash <(curl -s https://raw.githubusercontent.com/lfit/releng-global-jjb/master/shell/update-java-alternatives.sh) +# shellcheck disable=SC1091 +source /tmp/java.env + cd /tmp || exit 1 -wget -O /tmp/sonar-scan.zip \ +wget -q -O /tmp/sonar-scan.zip \ "https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip" -unzip sonar-scan.zip +unzip -q sonar-scan.zip sudo mv sonar-scanner-* /opt/sonar-scanner -wget -O /tmp/bw.zip \ +wget -q -O /tmp/bw.zip \ "https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip" -unzip bw.zip +unzip -q bw.zip sudo mv build-wrapper-* /opt/build-wrapper mkdir -p "$build_dir" @@ -37,8 +43,10 @@ cd "$build_dir" || exit 1 # shellcheck disable=SC2086 eval cmake -DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" $cmake_opts .. +# $make_opts may be empty. +# shellcheck disable=SC2086 /opt/build-wrapper/build-wrapper-linux-x86-64 --out-dir "$WORKSPACE/bw-output" \ - make "$make_opts" + make $make_opts /opt/sonar-scanner/bin/sonar-scanner \ -Dsonar.projectKey="${PROJECT_KEY}" \