Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
make clean before make all for sonarqube
[simgrid.git] / tools / internal / travis-sonarqube.sh
1 #! /bin/sh
2
3 # Run SonarQube on travis. First version was given per email by one of the SonarQube engineer.
4
5 # Install required software
6 installSonarQubeScanner() {
7   export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-2.6
8   rm -rf $SONAR_SCANNER_HOME
9   mkdir -p $SONAR_SCANNER_HOME
10   curl -sSLo $HOME/.sonar/sonar-scanner.zip http://repo1.maven.org/maven2/org/sonarsource/scanner/cli/sonar-scanner-cli/2.6/sonar-scanner-cli-2.6.zip
11   unzip $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
12   rm $HOME/.sonar/sonar-scanner.zip
13   export PATH=$SONAR_SCANNER_HOME/bin:$PATH
14   export SONAR_SCANNER_OPTS="-server"
15 }
16 installBuildWrapper() {
17   curl -LsS https://nemo.sonarqube.org/static/cpp/build-wrapper-linux-x86.zip > build-wrapper-linux-x86.zip
18   unzip build-wrapper-linux-x86.zip
19 }
20 installSonarQubeScanner
21 installBuildWrapper
22
23 # triggers the compilation through the build wrapper to gather compilation database
24 # We need to clean the build that was used for the tests before to ensure that everything gets rebuilt:
25 #   sonarqube only use what's built throught its wrappers
26 make clean
27 ./build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-outputs make all
28
29 # and finally execute the actual SonarQube analysis (the SONAR_TOKEN is set from the travis web interface, to not expose it)
30 sonar-scanner -Dsonar.host.url=https://nemo.sonarqube.org -Dsonar.login=$SONAR_TOKEN