blob: c89756f987c27c4c32ec7ebeb876b8817dc9eb5e [file] [log] [blame]
Ray Milkey20d22522017-11-08 10:55:52 -08001#!/bin/bash -ex
Ray Milkeycb569c32017-12-12 13:42:20 -08002
3# exit on errors
4set -eu -o pipefail
5
Ray Milkey20d22522017-11-08 10:55:52 -08006ONOS_ROOT=`pwd`
7. tools/build/envDefaults
8
Ray Milkeyfaa66c92017-11-08 12:58:43 -08009# download and install Sonar scanner
Ray Milkeyb3f52442017-11-08 12:22:54 -080010SONAR_SCANNER_VERSION=3.0.3.778
Ray Milkeyabba8322017-11-08 12:03:58 -080011curl -L -o /tmp/sonar-scanner-cli.zip -X GET https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION.zip
Ray Milkey20d22522017-11-08 10:55:52 -080012unzip /tmp/sonar-scanner-cli.zip
Ray Milkeyfaa66c92017-11-08 12:58:43 -080013
14# Configure ONOS specific properties
Andrew Grimberg6ecb1b12017-11-16 14:42:39 -080015echo "sonar.host.url=https://sonar.onosproject.org" >>sonar-scanner-$SONAR_SCANNER_VERSION/conf/sonar-scanner.properties
Ray Milkey20d22522017-11-08 10:55:52 -080016
Ray Milkey04e6f5e2017-11-08 13:14:11 -080017# Be sure buck is installed
18onos-buck --version
19
Ray Milkeyfaa66c92017-11-08 12:58:43 -080020# Generate coverage data
21tools/build/onos-prepare-sonar
22
23# Upload coverage to Sonar
Ray Milkeyabba8322017-11-08 12:03:58 -080024sonar-scanner-$SONAR_SCANNER_VERSION/bin/sonar-scanner
Ray Milkey20d22522017-11-08 10:55:52 -080025
26