Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to pass parameter to sonarqube end #1381

Merged
merged 1 commit into from
Sep 19, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions FAKE.sln
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "help", "help", "{564BD198-0
help\nuget.md = help\nuget.md
help\octopusdeploy.md = help\octopusdeploy.md
help\slacknotification.md = help\slacknotification.md
help\sonarcube.md = help\sonarcube.md
help\specifictargets.md = help\specifictargets.md
help\teamcity.md = help\teamcity.md
help\templates\template-project.html = help\templates\template-project.html
Expand Down
10 changes: 3 additions & 7 deletions help/sonarcube.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,17 @@ compilation has finished. Then the result is collected and send to the SonarQube
## Minimal working example

Target "BeginSonarQube" (fun _ ->

SonarQube Begin (fun p ->
{p with
Key = "MyProject"
Name = "Main solution"
Version = "1.0.0" }
)
)

Target "EndSonarQube" (fun _ ->
SonarQube End (fun p ->
{p with
Key = "MyProject"
Name = "Main solution"
Version = "1.0.0" }
)
SonarQubeEnd()
)

Target "Default" DoNothing

Expand Down
18 changes: 13 additions & 5 deletions src/app/FakeLib/SonarQubeHelper.fs
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,24 @@ let SonarQubeDefaults =
let SonarQubeCall (call: SonarQubeCall) (parameters : SonarQubeParams) =
let sonarPath = parameters.ToolsPath
let setArgs = parameters.Settings |> List.fold (fun acc x -> acc + "/d:"+x+" ") ""
//match parameters.Settings with
//| Some(x) -> (" /d:"+x)
//| None -> ""

let cfgArgs =
match parameters.Config with
| Some(x) -> (" /s:"+x)
| None -> ""

let args =
match call with
| Begin -> "begin /k:\"" + parameters.Key + "\" /n:\"" + parameters.Name + "\" /v:\"" + parameters.Version + "\" " + setArgs + cfgArgs
| End -> "end"
| End -> "end " + setArgs + cfgArgs

let result =
ExecProcess (fun info ->
info.FileName <- sonarPath
info.Arguments <- args) System.TimeSpan.MaxValue
if result <> 0 then failwithf "Error during sonar qube call %s" (call.ToString())

/// This task to can be used to run [Sonar Qube](http://conarqube.org/) on a project.
/// This task to can be used to run [Sonar Qube](http://sonarqube.org/) on a project.
/// ## Parameters
///
/// - `call` - Begin or End, to start analysis or finish it
Expand All @@ -71,3 +70,12 @@ let SonarQube (call: SonarQubeCall) setParams =
let parameters = setParams SonarQubeDefaults
SonarQubeCall call parameters
traceEndTask "SonarQube" (call.ToString())

/// This task can be used to run the end command of [Sonar Qube](http://sonarqube.org/) on a project.
///
/// ## Sample

/// SonarQubeEnd
///
let SonarQubeEnd() =
SonarQube End (fun p -> { p with Settings = [] })