-
Notifications
You must be signed in to change notification settings - Fork 588
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #564 from jamescrowley/NDepend
NDepend helper
- Loading branch information
Showing
2 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
module Fake.NDepend | ||
|
||
open Fake | ||
open System | ||
open System.IO | ||
open System.Text | ||
|
||
let getWorkingDir workingDir = | ||
Seq.find isNotNullOrEmpty [workingDir; environVar("teamcity.build.workingDir"); "."] | ||
|> Path.GetFullPath | ||
|
||
let buildParamsAndExecute parameters buildArguments toolPath workingDir = | ||
let args = buildArguments parameters | ||
trace (toolPath + " " + args) | ||
let result = ExecProcess (fun info -> | ||
info.FileName <- toolPath | ||
info.WorkingDirectory <- getWorkingDir workingDir | ||
info.Arguments <- args) TimeSpan.MaxValue | ||
if result <> 0 then failwithf "Error running %s" toolPath | ||
|
||
type NDependParams = | ||
{ ToolPath: string | ||
WorkingDir: string | ||
ProjectFile: string | ||
CoverageFiles: string list } | ||
|
||
let NDependDefaults = | ||
{ ToolPath = findToolInSubPath "ndepend.console.exe" (currentDirectory @@ "tools" @@ "NDepend") | ||
WorkingDir = "" | ||
ProjectFile = "" | ||
CoverageFiles = [] } | ||
|
||
let buildNDependArgs parameters = | ||
new StringBuilder() | ||
|> append parameters.ProjectFile | ||
|> appendWithoutQuotes "/CoverageFiles " | ||
|> appendFileNamesIfNotNull parameters.CoverageFiles | ||
|> toText | ||
|
||
let NDepend (setParams: NDependParams -> NDependParams) = | ||
let parameters = (NDependDefaults |> setParams) | ||
buildParamsAndExecute parameters buildNDependArgs parameters.ToolPath parameters.WorkingDir |