Skip to content

Instantly share code, notes, and snippets.

@lubiepomaranczki
Last active December 3, 2018 19:57
Show Gist options
  • Save lubiepomaranczki/67e7db6e69c1e959c5977c8514f2bf90 to your computer and use it in GitHub Desktop.
Save lubiepomaranczki/67e7db6e69c1e959c5977c8514f2bf90 to your computer and use it in GitHub Desktop.
#!/bin/bash
PATH_TO_PROJECT="$1"
SONAR_TOKEN="{YOUR-TOKEN}"
PROJECT_NAME="$( echo "$1" | sed 's@.*/@@' )"
if [[ -z "$PROJECT_NAME" ]]; then
echo "Project name can't be null. Either project does not exist or you have / at the end of path"
exit;
fi
if [ ! -d ~/${PATH_TO_PROJECT} ] && [ ! -d ${PATH_TO_PROJECT} ]; then
echo "File not found!"
exit;
fi
cd ~/$PATH_TO_PROJECT
Echo "Starting SonarScanner for $PROJECT_NAME..."
mono {PATH-TO-UNZIPPED-SONAR}/SonarScanner.MSBuild.exe begin /k:${PROJECT_NAME}
# for me it is:
# mono ~/Downloads/sonar-scanner-msbuild-4.4.1.1530-net46/SonarScanner.MSBuild.exe begin /k:${PROJECT_NAME}
Echo "Rebuilding..."
MSbuild /t:rebuild
Echo "Rebuild done"
mono {PATH-TO-UNZIPPED-SONAR}/SonarScanner.MSBuild.exe end
Echo "SonarScanner ended..."
open http://localhost:9000
tput bel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment