Addin used to execute the MSBuild scanner for SonarQube using cake aliases. Don't forget to include the tool package.
#tool nuget:?package=MSBuild.SonarQube.Runner.Tool
#addin nuget:?package=Cake.Sonar
Task("Sonar")
.IsDependentOn("SonarBegin")
.IsDependentOn("Build")
.IsDependentOn("Unit")
.IsDependentOn("SonarEnd");
Task("SonarBegin")
.Does(() => {
SonarBegin(new SonarBeginSettings{
# Supported parameters
Key = "MyProject",
Url = "sonarcube.contoso.local",
Login = "admin",
Password = "admin",
Verbose = true,
# Custom parameters
ArgumentCustomization = args => args
.Append("/d:sonar.gitlab.project_id=XXXX")
.Append("/d:sonar.gitlab.xxx=XXXX")
});
});
});
Task("SonarEnd")
.Does(() => {
SonarEnd(new SonarEndSettings{
Login = "admin",
Password = "admin"
});
});