-
-
Save laurentkempe/ebf5bc8a9cb752505127 to your computer and use it in GitHub Desktop.
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
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment